Unit 2 · Selection and Iteration
Compound Conditions
Practice mode with 15 Java-focused questions, immediate answer checks, and explanations.
What compound conditions covers
Compound conditions join several tests into one decision. Range checks need && because a value must satisfy both bounds, while membership checks across separate values need ||. Reading a compound condition well means substituting a concrete value and evaluating each piece, rather than pattern-matching on how the code looks.
Where students lose points
Writing 0 < x < 10 as if Java supported chained comparisons is a compile error, and the correct form is x > 0 && x < 10. Students also produce impossible conditions such as x < 5 && x > 10, which is never true, or overly permissive ones such as x < 5 || x > 10 when they meant to exclude a range.
How it shows up on the AP exam
Unit 2 content that pairs directly with Boolean operators. Exam questions often present four similar conditions and ask which one correctly describes a stated rule, so precision matters more than speed.
For practice use only.
Compound Conditions MCQ Practice
Practice AP CSA compound conditions: combining range tests with && and ||, ordering checks safely, and avoiding conditions that can never be true.
Answered 0 of 15
Choose one answer.
Which option matches the complete output produced by this segment?
public class CompoundConditionsContext
{
public static void runExample()
{
int t = 12;
System.out.print(t >= 10 && t <= 20);
}
public static void main(String[] args)
{
runExample();
}
}