C Switch and Jump Statements MCQs: 10 Solved Questions

Solve 10 C control-flow questions, then check each answer with a direct explanation of case selection, jump statements, fall-through, and loop updates.

KnowledgeGate Team

Exam prep & CS education

Updated 22 Aug 20266 min read

Switch questions are not about keyword recall alone. Evaluate the controlling expression, locate the first matching label, and trace fall-through to break or block end. That one method decides every question below, from a case label that refuses to compile to a switch sitting inside a for loop. Commit to an option before you read the explanation under it. The switch and jump statements practice hub carries the rest of this topic, and Coding and DSA Courses for Placements is the taught route around it.

1. Switch case labels and the compile-time rule

In C, case labels require integer constant expressions. A controlling expression may be integer or character, but 6.0f, 6.0, and 6.0L are invalid labels.

Q1. Floating-point case labels

What will be output when you will execute following c code?

#include<stdio.h>
void main(){
              switch(6){
                          case 6.0f: printf("Sangakkara");
                                      break;
                          case 6.0: printf("Sehwag");
                                      break;
                          case 6.0L: printf("Steyn");
                                     break;
                          default: printf("Smith");
             }
}
  • A. Sangakkara

  • B. Sehwag

  • C. Steyn

  • D. Compilation error

Answer: D. 6.0f is float, 6.0 is double, and 6.0L is long double. Their value does not make them integer constant expressions. Compilation fails before printf.

2. Continue, return, goto, and break

Use this control-transfer map:

  • continue skips the current iteration's remainder. In a for loop, it proceeds through increment, then the condition test.

  • break exits the nearest loop or switch.

  • goto transfers to a named label.

  • return leaves a function, possibly with a value.

Q2. Transfer to the next loop iteration

The statements that transfer control to the beginning of the loop is called____.

  • A. Break statements

  • B. Exit statements

  • C. goto statements

  • D. continue statements

Answer: D. continue abandons the iteration's remaining statements and starts the next-iteration process. break leaves the loop; goto transfers to a named label.

Exam source: TCS, 2024.

Q3. Match four jump statements to their effects

Match the following with respect to the jump statements :

List - I

List - II

a. return

i. The conditional test and increment portions

b. goto

ii. A value associated with it

c. break

iii. Requires a label for operation

d. continue

iv. An exit from only the innermost loop

Codes :

  • A. a-ii, b-iii, c-iv, d-i

  • B. a-iii, b-iv, c-i, d-ii

  • C. a-iv, b-iii, c-ii, d-i

  • D. a-iv, b-iii, c-i, d-ii

Answer: A. return matches a value, a-ii; goto requires a label, b-iii; break exits the innermost loop in this list, c-iv; and continue follows a for loop's increment and condition-test path, d-i.

Exam source: UGC NET Computer Science, June 2014.

3. What omission of break actually does

A matching case selects an entry point, not an exit boundary. Later statements run in order until break, return, or the closing brace. Fall-through can reach default.

Q4. Omitted break in every case block

In a switch control structure, what will happen if break is omitted in all the case blocks?

  • A. Only the matched case will execute, and control exits the switch block.

  • B. It will result in a compile-time error.

  • C. All cases after the matched case will execute sequentially until a break or end of switch.

  • D. The programme will crash due to undefined behaviour.

Answer: C. Labels are entry points, not stops. If case 2 of 4 matches without a later break, cases 2, 3, and 4 run before the switch ends.

Exam source: Beltron Programmer, Computer Science Shift-2, 2025.

4. Evaluate the switch expression before tracing cases

Parenthesise the controlling expression before checking labels. Addition outranks left shift, so movie<<2+movie means movie << (2 + movie).

Q5. Shift expression chooses the entry label

What will be output when you will execute following c code?

#include<stdio.h>
void main(){
              int movie=1;
              switch(movie<<2+movie){
                            default: printf("3 Idiots");
                            case 4: printf(" Ghajini");
                            case 5: printf(" Krrish");
                            case 8: printf(" Race");
                }
}
  • A. 3 Idiots Ghajini Krrish Race

  • B. Race

  • C. Krrish

  • D. Ghajini Krrish Race

Answer: B. With movie = 1, compute 2 + 1 = 3, then 1 << 3 = 8. Control enters case 8, prints Race, and reaches the closing brace. Earlier labels do not run.

5. Unlabelled statements inside a switch body

A switch dispatches to a matching case or default. An unlabelled statement is not an entry point. Without either label, there is nowhere to dispatch.

Q6. Switch body with no labels

What is the output of the following C code?

#include<stdio.h>
#define TRUE 1
void main(){
                 switch(1){
                             printf("abcdefghijklmnopqrstuvwxyz");
                 }
}
  • A. abcdefghijklmnopqrstuvwxyz

  • B. It will print nothing

  • C. Runtime error

  • D. Compilation error

Answer: B. Value 1 finds no case 1 and no default, so the printf is never selected and nothing is printed. The unused TRUE definition is only a distraction.

6. Trace fall-through output one print at a time

Use a three-column trace. Read the literals exactly, including any display spaces.

Q7. Fall-through from case 2 into default

What will be output when you will execute following c code?

#include<stdio.h>
void main(){
             int check=2;
             switch(check){
                            case 1: printf("D.W.Steyn");
                            case 2: printf(" M.G.Johnson");
                            case 3: printf(" Brett Lee");
                            default: printf(" M.Muralidaran");
               }
}
  • A. M.G.Johnson

  • B. M.Muralidaran

  • C. M.G.Johnson Brett Lee M.Muralidaran

  • D. None of the above

Answer: C. At check = 2, the trace is:

First matching label

Prints in order

Exit point

case 2

M.G.Johnson, Brett Lee, M.Muralidaran

Closing brace

Without break, all run; each leading space is inside its literal.

Q8. Character case and fall-through across empty labels

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"); 

    }
  • A. No Choice

  • B. Choice A

  • C.

Choice A
Choice B No Choice
  • D. Program gives no output as it is erroneous

Answer: C. The displayed \ n should be read as \n. From case 'A', execution prints Choice A, crosses empty B to the C print, then crosses D and E to default. The later literals actually join as Choice BNo Choice; therefore option C is correct.

Exam source: GATE Computer Science, 2012.

Q9. Numeric case with fall-through to default

What is the output of the following code?

int i = 5;
switch(i)
{
case 1: printf("One");
case 5: printf("Five");
case 10: printf("Ten");
default: printf("Other");
}
  • A. Five

  • B. Ten

  • C. FiveTen Other

  • D. Other

Answer: C. From case 5, the program prints Five, Ten, then Other. With no spaces in the code, the literal output is FiveTenOther; option C shows the sequence with a display space.

Exam sources: Hexaware, 2024, and CoCubes Computer Science, 2024.

7. Trace a switch inside a for loop

Trace every iteration because body updates affect the later for increment.

Q10. Two iterations with switch fall-through

What is the output of the following C program?

#include <stdio.h>
int main()
{
int i=0;
for(i=0; i<20; i++)
{
switch(i)
{
case 0:
i+=5;
case 1:
i+=2;
case 5:
i+=5;
default:
i+=4;
break;
}
printf("%d ", i);
}
getchar();
return 0;
}
  • A. 20 15

  • B. 16 20 21

  • C. 16 21

  • D. 15 20

Answer: C. Trace both iterations:

Value entering switch

Matched label

Value after each fall-through update

Value printed

Value after for increment

0

case 0

0 + 5 = 5; 5 + 2 = 7; 7 + 5 = 12; 12 + 4 = 16

16

16 + 1 = 17

17

default

17 + 4 = 21

21

21 + 1 = 22

Then 22 < 20 is false, ending the loop. Output: 16 21.

Exam source: TCS, 2026.

Two-row execution trace of the Q10 switch-in-a-for-loop program, ending with the output 16 21.

8. Score diagnosis and the next practice step

For this set, 9 to 10 correct means a stable trace. At 6 to 8, redo entry and fall-through. At 0 to 5, rebuild the method before timing.

The traps were floating-point labels, confusing continue with break, misreading movie<<2+movie, and stopping at the first print without break. Q10 adds forgetting that body updates affect the loop increment.

Evaluate the switch expression, find the entry label, trace downward, then apply the loop update. Redo Q1, Q5, Q8, and Q10 without notes. Use the C Language course for structured C practice, or Coding for Placements for a broader multi-language route. More solved sets sit in the MCQ Practice hub.