ProgrammingHardTCS NQT · Infosys

int n = 0; while (n++ < 3) ; What is n after the loop?

  1. A. 4
  2. B. 3
  3. C. 2
  4. D. 5

Correct answer: A. 4

The test uses the old value of n each time, so the loop stops when n has been incremented past 3. The final value is 4.

More C Programming questions

Exams that ask this topic