Unit 2 · Selection and Iteration
Boolean Operators
Practice mode with 15 Java-focused questions, immediate answer checks, and explanations.
What boolean operators covers
Boolean expressions combine comparisons with && (and), || (or), and ! (not). Precedence runs ! first, then &&, then ||, so a || b && c evaluates as a || (b && c). De Morgan laws give the equivalences you need for negation: !(a && b) is !a || !b, and !(a || b) is !a && !b. Recognizing that two differently written conditions are logically identical is a tested skill in itself.
Where students lose points
Negating a compound condition by flipping only the comparisons and leaving && as && is the classic mistake. Students also misread precedence and insert parentheses that change meaning. A related trap is negating a range test: the opposite of x > 0 && x < 10 is x <= 0 || x >= 10.
How it shows up on the AP exam
Core Unit 2 content. Equivalent-expression questions are a reliable MCQ format, and clean Boolean logic is what keeps FRQ conditionals from failing edge cases.
For practice use only.
Boolean Operators MCQ Practice
AP CSA Boolean operator practice: &&, ||, and ! precedence, De Morgan equivalences, and negating compound conditions correctly on the exam.
Answered 0 of 15
Choose one answer.
Which option matches the complete output produced by this segment?
public class BooleanOperatorsContext
{
public static void runExample()
{
int a = 5;
int b = 8;
System.out.print(a > 3 && b < 8);
}
public static void main(String[] args)
{
runExample();
}
}