LearnFrenzy
Sign in Take a free test

Control Instructions · Control Instructions MCQ · Question 7

Can default appear before other cases in a switch? Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 7 Back to Exercise

Which is true about default in a switch?

  • A It must be last
  • B It can be anywhere and runs only when no case matches Correct
  • C It runs every time
  • D Every switch must have one
Correct Answer: Option B

default is optional and may be placed anywhere. It is chosen only if no case matches – but if it has no break, control falls through into the cases written after it.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links