Question 129

What is the output? int n = 2;

What is the output? int n = 2; switch (n) { case 1: printf("A"); case 2: printf("B"); case 3: printf("C"); break; default: printf("D"); }
  1. AB
  2. BBCD
  3. CABC
  4. DBC
Show answerHide answer

Correct answer: (D) BC

Explanation

Execution starts at case 2 and falls through to case 3 until break.

From DSSSB TGT Computer Science Full Mock Test 1

This is question 129 of DSSSB TGT Computer Science Full Mock Test 1. 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.