Question 127

What is the output? int i = 0;

What is the output? int i = 0; while (i++ < 3) printf("%d", i);
  1. A012
  2. B1234
  3. C0123
  4. D123
Show answerHide answer

Correct answer: (D) 123

Explanation

Checks 0 < 3 then prints 1; 1 < 3 prints 2; 2 < 3 prints 3; 3 < 3 fails.

From DSSSB TGT Computer Science Full Mock Test 4

This is question 127 of DSSSB TGT Computer Science Full Mock Test 4. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.