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.
SangakkaraB.
SehwagC.
SteynD.
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:
continueskips the current iteration's remainder. In aforloop, it proceeds through increment, then the condition test.breakexits the nearest loop orswitch.gototransfers to a named label.returnleaves 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 statementsB.
Exit statementsC.
goto statementsD.
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-iB.
a-iii, b-iv, c-i, d-iiC.
a-iv, b-iii, c-ii, d-iD.
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 RaceB.
RaceC.
KrrishD.
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.
abcdefghijklmnopqrstuvwxyzB.
It will print nothingC.
Runtime errorD.
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.JohnsonB.
M.MuralidaranC.
M.G.Johnson Brett Lee M.MuralidaranD.
None of the above
Answer: C. At check = 2, the trace is:
First matching label | Prints in order | Exit point |
|---|---|---|
|
| 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 ChoiceB.
Choice AC.
Choice A
Choice B No ChoiceD.
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.
FiveB.
TenC.
FiveTen OtherD.
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 15B.
16 20 21C.
16 21D.
15 20
Answer: C. Trace both iterations:
Value entering | Matched label | Value after each fall-through update | Value printed | Value after |
|---|---|---|---|---|
0 |
|
| 16 |
|
17 |
|
| 21 |
|
Then 22 < 20 is false, ending the loop. Output: 16 21.
Exam source: TCS, 2026.

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.




