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?
- Aif (condition) { statements } else { statements }
- Bif (condition) then { statements } else { statements }
- Cif [condition] then { statements } else { statements }
- 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).