Question 31Asked in DSSSB TGT Computer Science (Technical), 13 Sep 2025, Shift 3 (5:00 PM)What will happen if we DO NOT use the break statement in a switch case?
- AThe program will throw a compilation error.
- BThe control will continue executing the following cases until the end of the switch
block is encountered.
- CThe control will break out of the switch automatically after the first matching case.
- DThe program will throw a runtime error.
Show answerHide answer
Correct answer: (B) The control will continue executing the following cases until the end of the switch
block is encountered.
Explanation
Without break, execution falls through: after the matching case, the statements of all the following cases run until a break or the end of the switch.