Question Detail
Question
42. How many iterations are performed in the code snippet below
sum = 0, i = 10
Do
sum = sum + i
i = i - 2
While (i >= 4)
Correct Answer
Option C is the correct answer.
Detailed Explanation
Loop runs while i >= 4. i starts at 10, then 8, 6, 4. When i becomes 2, loop stops. That's 4 iterations (i=10,8,6,4).
Hint
Count how many times i is >= 4 as it decreases by 2.