Question 55Asked in DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 3 (5:00 PM)

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

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

Correct answer: (C) 1 2 3 4 5

Explanation

The do-while prints i and then increments it while i <= 5, so it prints 1 2 3 4 5 and stops when i becomes 6.

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

This is question 55 of DSSSB TGT Computer Science PYQ (Technical), 12 Sep 2025, Shift 3 (5: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.