QuestionQ213

Using Operators and Decision Constructs

Which statement is true regarding the switch statement?

  • A It must contain the default section.
  • B The break statement, at the end of each case block, is optional.
  • C Its case label literals can be changed at runtime.
  • D Its expression must evaluate to a collection of values.
Explanation

A break statement at the end of a case block is optional. If it is omitted, execution can fall through into the following case block unless another control-transfer statement ends it.

Community Discussion

No comments yet. Be the first to start the discussion!