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

How many times will the following loop execute? for (int i = 0; i < 5; i++) {

How many times will the following loop execute? for (int i = 0; i < 5; i++) { printf("%d ", i); }
  1. AInfinite
  2. B4
  3. C5
  4. D6
Show answerHide answer

Correct answer: (C) 5

Explanation

i takes values 0, 1, 2, 3, 4; when i becomes 5 the condition i < 5 fails, so the loop executes 5 times.

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

This is question 25 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.