QuestionQ84

Controlling Program Flow

Given this code fragment:

Question Image

What is the output?

  • A Region 2
  • B Invalid grade.
  • C Region 2 -Region 3 -Invalid grade.
  • D Region 2 -Region 3
Explanation

The value 5 does not match any case label (1, 2, 3, 4, 6, or 7, 9), so the default switch rule executes and prints Invalid grade.

Community Discussion

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