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

What happens if the condition in a while loop is false at the start?

  1. AThe loop runs once and then terminates.
  2. BThe loop does not run at all.
  3. CThe loop throws an error.
  4. DThe loop runs infinitely.
Show answerHide answer

Correct answer: (B) The loop does not run at all.

Explanation

A while loop checks its condition before every pass, so if the condition is false at the start, the body never runs. A do-while loop would run once.

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

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