1Z0-811 Control Flow and Loops Practice Question
Which THREE statements are true about the switch statement in Java? (Choose three.)
⚠ Common exam trap
Candidates often mistakenly believe that switch can be used with boolean expressions or that the default case must be at the end. Also, many think that switch supports String objects in older Java versions.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Without a break statement, execution falls through to the next case.
Options C, D, and E are true. Option C correctly describes fall-through behavior: without a break statement, execution continues to the next case. Option D correctly states that the default case is optional. Option E is true because, since Java 7, the switch statement can be used with String objects. Options A and B are false: A is incorrect because switch does not support boolean expressions; B is incorrect because the default case can appear anywhere in the switch block.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
It can be used with boolean expressions.
Why it's wrong here
False. Switch cannot be used with boolean expressions; it works with int, char, short, byte, String, and enum types.
- ✗
The default case must be placed at the end of the switch block.
Why it's wrong here
False. The default case can be placed anywhere in the switch block; it does not have to be at the end.
- ✓
Without a break statement, execution falls through to the next case.
Why this is correct
True. Without a break, execution falls through to the next case (fall-through behavior).
- ✓
The default case is optional.
Why this is correct
True. The default case is optional; if no case matches and no default is present, the switch does nothing.
- ✓
It can be used with String objects.
Why this is correct
True. Since Java 7, switch can be used with String objects, comparing using String.equals().
Go deeper
Related to this question
About these practice questions
Courseiva writes every 1Z0-811 question from scratch — 481 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 1Z0-811 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-811 exam.