In javaScript after executing Var z 0 var i 0 do z z i i
In javaScript, after executing Var z = 0; var i = 0; do {z = z + i; i = i + 1} while (I
Solution
The correct answer is option (b) 7
Because
Intially z=2
when i=0, z=2+1=3
when i=1, z=3+1=4
when i=2, z=4+1=5
when i=3, z=5+1=6
when i=4, z=6+1=7
when i=5 the for loop terminates as the condition i<5 (i.e 5<5) fails.
So the value of z is 7.
