1.
TEST EAX,EAX
JNZ SHORT program.00407190
2.
XOR EAX,EAX
JNZ SHORT program.00407190
Kindly correct me if I'm wrong. Thank you! :)
From my understanding so far:
JNZ is jump if not equal to zero, it will jump or not depending on whether ZF is set to 1 or not. If it's 1, it will not jump. Else, it will jump.
From my understanding for code #1, TEST EAX,EAX will check whether it's zero or not. If it's not equal to zero(ZF is 0), it will jump to address 00407190.
For code #2 
XOR EAX,EAX will set EAX register to 0. Does it set any flags? If not, how does JNZ instruction determine to jump or not?
Lastly, why would people want to check if EAX is 0 or not? Kindly please assist me in a easier and detailed explanation, I'm still a beginner.