Multiple choice

Which of the following statements is FALSE regarding switch case statement?

  1. We can have any number of case statements within a switch.

  2. When a break statement is reached, the switch terminates.

  3. Using default in switch case is optional.

  4. The value to be compared can be of any type.

  5. Every case need not have a break statement.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The value to be compared should be of integral type. We cannot compare a floating point value using a switch-case.