What will be the output of the following C program segment? char inChar = 'A';…

GATE · 2012 · CS · Computer Science & ITModified — slightly modified from the official paper; see the solution

What will be the output of the following C program segment?

char inChar = 'A';
switch (inChar) {
    case 'A': printf("Choice A\n");
    case 'B':
    case 'C': printf("Choice B");
    case 'D':
    case 'E':
    default: printf(" No Choice");
}
  1. A.

    No Choice

  2. B.

    Choice A

  3. C.

    Choice A

    Choice B No Choice

  4. D.

    Program gives no output as it is erroneous

Attempted by 1335 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…