AP CSA Unit 2 Day 2: Selection If Else If
Share
Unit 2, Selection & Iteration • Cycle 2
Day 2 Advanced Practice • Harder Difficulty
Focus: Boundary Values
Hard
Selection (if / else-if)
Advanced Practice Question
Format: Selection (if / else-if)
What is printed?
What is printed?
int score = 85;
if (score >= 90) {
System.out.println("A");
} else if (score >= 80) {
System.out.println("B");
} else {
System.out.println("C");
}
Difficulty: Hard |
Topic: Selection (if / else-if) |
Cycle: 2 (Advanced)
Why This Answer?
`score > 90` is false (90 is not greater than 90). The next condition `score > 80` is true, so it prints `B`.
Common Mistake
Watch Out!
Reading `>` as `>=` at boundary values like 90.
AP Exam Strategy
Always test boundary numbers (exactly 90 here) against the operator used.
Master This Topic
This Cycle 2 HARD question tests boundary values. Review Unit 2 concepts to build mastery of selection and iteration.
- Understanding boundary values
- 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