Important MCQ

The switch statement is used for

Q.The switch statement is used for

A) repeating code
B) declaring variables
C) multi-way selection
D) reading input
Correct Answer:
Option C
Detailed Explanation:
C) multi-way selection is correct. switch performs multi-way selection using integral or enum-like values such as int and char. Case labels are constants; break exits the switch, while missing break can cause fall-through.