AP CSA Unit 2 Day 16: Selection If Else If Boundary
Share
Unit 2, Selection & Iteration • Cycle 2
Day 16 Advanced Practice • Harder Difficulty
Focus: Conditional Chain
Hard
Selection (if / else-if boundary)
Advanced Practice Question
Format: Selection (if / else-if boundary)
What is printed?
What is printed?
int x = 10;
if (x < 10) {
System.out.println("Less");
} else if (x == 10) {
System.out.println("Equal");
} else {
System.out.println("Greater");
}
Difficulty: Hard |
Topic: Selection (if / else-if boundary) |
Cycle: 2 (Advanced)
Why This Answer?
`n >= 1` is false. `n >= 0` is true, so it prints `B`.
Common Mistake
Watch Out!
Assuming the first false condition ends the chain (it does not).
AP Exam Strategy
In an if/else-if chain, the first true branch runs; earlier false branches don't stop evaluation.
Master This Topic
This Cycle 2 HARD question tests conditional chain. Review Unit 2 concepts to build mastery of selection and iteration.
- Understanding conditional chain
- Tracing code execution accurately
- Avoiding common pitfalls
Ready for More Challenges?
Cycle 2 questions prepare you for the hardest AP CSA exam questions.
Study Games Practice FRQs