Question 59Asked in DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)

What will be the output of the following C code? int main()

What will be the output of the following C code? #include <stdio.h> int main() { int i = 1; while (i < 5) { printf("%d ", i++); i++; } return 0; }
  1. A2 4
  2. B1 3 4
  3. C1 3
  4. D1 2 3 4 5
Show answerHide answer

Correct answer: (C) 1 3

Explanation

i = 1 is printed and becomes 2, then i++ makes it 3; 3 is printed and becomes 4, then 5. Now 5 < 5 is false, so the output is 1 3.

From DSSSB TGT Computer Science PYQ (Technical), 12 Sep 2025, Shift 2 (1:00 PM)

This is question 59 of DSSSB TGT Computer Science PYQ (Technical), 12 Sep 2025, Shift 2 (1:00 PM). 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.