1Z0-811 Control Flow and Loops Practice Question
Which TWO statements are true about the switch statement in Java? (Choose two.)
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
✓
It can be used with char variables.
Options A and C are correct. A: Switch supports char, int, short, byte, String, and enum types, so char is valid. B is false because the break statement is optional; without it, execution falls through to the next case. C is true: the default case is optional. D is false because case labels must be compile-time constant expressions, not runtime expressions. E is false because long variables are not allowed in switch statements.
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 char variables.
Why this is correct
char is supported in switch.
- ✗
The break statement is mandatory at the end of each case.
Why it's wrong here
Break is optional; fall-through is possible.
- ✓
The default case is optional.
Why this is correct
Default case is not required.
- ✗
Case labels can be runtime expressions.
Why it's wrong here
Case labels must be compile-time constants.
- ✗
It can be used with long variables.
Why it's wrong here
long is not allowed in switch.
Go deeper
Related to this question
About these practice questions
This 1Z0-811 question is part of Courseiva's 481-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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.