Multiple choice technology programming languages

What will be the value of variable 'z' after execution of following code? int z; for(z=0;z<50;z++) {}

  1. 0

  2. 51

  3. 49

  4. 50

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The loop starts with z=0 and increments until the condition z<50 fails. When z reaches 50, the condition becomes false and the loop exits with z=50. The empty body doesn't affect the value.