Unit 2 Cycle 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?
"apcs-keyword">int score = "apcs-number">90;
"apcs-keyword">if (score > "apcs-number">90)
{
System.out.print("A");
}
"apcs-keyword">else "apcs-keyword">if (score > "apcs-number">80)
{
System.out.print("B");
}
else
{
System.out.print("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