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

Which of the following is the correct syntax of an if-else statement in C?

  1. Aif (condition) { statements } else { statements }
  2. Bif (condition) then { statements } else { statements }
  3. Cif [condition] then { statements } else { statements }
  4. Dif condition: statements else: statements
Show answerHide answer

Correct answer: (A) if (condition) { statements } else { statements }

Explanation

C syntax is if (condition) { ... } else { ... }. The condition must be in parentheses, and C has no "then" keyword or colon syntax (that is Python).

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

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