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

What will be the output of the following code? int main() {

What will be the output of the following code? #include <stdio.h> int main() { int x = 5; switch(x) { case 5: printf("Five"); default: printf("Default"); } return 0; }
  1. ADefault
  2. BCompilation error
  3. CFive
  4. DFiveDefault
Show answerHide answer

Correct answer: (D) FiveDefault

Explanation

case 5 matches and prints "Five". There is no break, so control falls through to default and also prints "Default", giving FiveDefault.

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

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