ProgrammingEasyTCS NQT · Infosys · Accenture

What will be the output of the following pseudocode?

What will be the output of the following pseudocode?
Integer i = 10
while (i > 2)
    i = i - 3
end while
Print i
  1. A. 2
  2. B. -2
  3. C. 1
  4. D. 4

Correct answer: C. 1

i goes 10, 7, 4, 1; at 1 the condition i > 2 fails, so 1 is printed.

More Pseudocode and Code Tracing questions

Exams that ask this topic