Question 66Asked in DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 1 (9:00 AM)

Which of the following is true about the for loop in C?

  1. AA for loop cannot be nested inside another for loop.
  2. BThe condition in a for loop is optional, and it can result in an infinite loop if omitted.
  3. CA for loop must always have all three components: initialization, condition, and increment/decrement.
  4. DThe increment/decrement part of the for loop is mandatory.
Show answerHide answer

Correct answer: (B) The condition in a for loop is optional, and it can result in an infinite loop if omitted.

Explanation

All three parts of a for loop are optional. If the condition is omitted, it is treated as always true, e.g. for(;;), giving an infinite loop unless break is used. For loops can also be nested.

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

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