1Z0-829 Controlling Program Flow Practice Question
Which three of the following are valid case values in a traditional switch statement (non-pattern)?
⚠ Common exam trap
Many exam-takers assume any primitive type or literal can be used in a switch case, forgetting that only byte, short, char, int, String, and enum constants are allowed, and that boolean and floating-point types are explicitly excluded.
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
✓
42
In a traditional switch statement (non-pattern), the case values must be compile-time constants of types that are compatible with the switch expression. Integer literals like 42 are valid case values, as they are constant expressions of type int, which is one of the allowed types (byte, short, char, int, their wrapper classes, String, and enum types).
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
42
Why this is correct
Correct: int is allowed.
- ✗
true
Why it's wrong here
Incorrect; boolean is not allowed.
- ✗
3.14
Why it's wrong here
Incorrect; double is not allowed in traditional switch.
- ✓
Monday (assuming an enum constant)
Why this is correct
Correct: enum constants are allowed.
- ✓
"hello"
Why this is correct
Correct: String is allowed.
Go deeper
Related to this question
About these practice questions
Courseiva writes every 1Z0-829 question from scratch — 513 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-829 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-829 exam.