AP CSP Boolean Expressions
AP CSP Boolean Expressions AND / OR / NOT: Complete Guide (2025‑2026)
Boolean expressions evaluate to either TRUE or FALSE. AP pseudocode uses three logical operators: AND (both must be true), OR (at least one must be true), and NOT (flips the value). Boolean expressions are the engine behind every conditional and loop — and a top-tested concept on the AP CSP exam, especially in the I/II/III question format.
Contents
Truth Tables
Memorize these three patterns. The AP exam will present a boolean expression and ask you to evaluate it for specific values of the variables.
AND is strict (both must be TRUE). OR is lenient (either is enough). NOT flips. These three combine to form any logical condition.
Compound Expressions
x > 0 AND x < 10- x=5: TRUE AND TRUE = TRUE
- x=0: FALSE AND TRUE = FALSE
- x=15: TRUE AND FALSE = FALSE
- Short-circuit: if first is FALSE, result is FALSE
score < 60 OR score > 100- score=50: TRUE OR FALSE = TRUE
- score=80: FALSE OR FALSE = FALSE
- score=110: FALSE OR TRUE = TRUE
- Short-circuit: if first is TRUE, result is TRUE
Code Trace Gauntlet
Substitute values into the boolean expression before revealing. This exact skill appears on every AP CSP exam.
What does each DISPLAY output?
TRUE TRUE FALSE Line 3: (7>5)=TRUE AND (3<10)=TRUE → TRUE AND TRUE = TRUE Line 4: (7<5)=FALSE OR (3<10)=TRUE → FALSE OR TRUE = TRUE Line 5: NOT(7=7) = NOT(TRUE) = FALSE
Predict all three outputs before revealing.
TRUE FALSE TRUE Line 3: a=TRUE, NOT b = NOT FALSE = TRUE. TRUE AND TRUE = TRUE Line 4: NOT a = FALSE. FALSE OR b = FALSE OR FALSE = FALSE Line 5: a AND b = TRUE AND FALSE = FALSE. NOT FALSE = TRUE
Does grade 85 fall in the B range (80-89)?
TRUE (85 ≥ 80) = TRUE and (85 < 90) = TRUE. TRUE AND TRUE = TRUE. Grade 85 is in the B range.
Evaluate inside-out. What displays?
FALSE NOT p = NOT FALSE = TRUE. TRUE AND q = TRUE AND TRUE = TRUE. NOT(TRUE) = FALSE.
Spot the Bug
No score can be simultaneously less than 0 AND greater than 100. The AND makes this condition impossible — it will never trigger. Fix: change AND to OR. A score below 0 OR above 100 is invalid.
NOT a AND NOT b means ‘neither a nor b’. NOT(a AND b) means ‘not both’ (at least one is false). These are different. De Morgan’s Law: NOT(a AND b) = NOT a OR NOT b. To negate a compound, flip AND/OR and negate each operand.
Common Exam Pitfalls
OR is TRUE when at least one operand is TRUE. Only AND requires both. This is the #1 boolean error on the AP exam.
NOT(a AND b) is NOT the same as NOT a AND NOT b. Apply De Morgan’s Law: NOT(a AND b) = NOT a OR NOT b. NOT(a OR b) = NOT a AND NOT b.
In AP pseudocode, = inside a condition means equality comparison (not assignment). x = 5 in a boolean context asks ‘does x equal 5?’
A value cannot be both <0 AND >100 simultaneously. Always check whether your AND condition is satisfiable. If not, you likely need OR.
Check for Understanding
1. If x = 4 and y = 8, what is the value of (x > 3) AND (y < 6)?
- TRUE
- FALSE
- 4
- ERROR
2. If a = TRUE and b = FALSE, which expression evaluates to TRUE?
- a AND b
- NOT a AND b
- NOT a OR b
- a OR NOT b
3. A student wants to check if a number n is outside the range [10, 20]. Which condition is correct?
- n < 10 AND n > 20
- n < 10 OR n > 20
- NOT (n > 10 AND n < 20)
- NOT n ≥ 10 OR n ≤ 20
4. Consider statements about AND and OR:
I. AND is TRUE only when both operands are TRUE.
II. OR is TRUE only when both operands are TRUE.
III. NOT flips TRUE to FALSE and FALSE to TRUE.
Which are correct?
- I only
- I and III only
- II and III only
- I, II, and III
5. NOT (x > 5 OR y < 3) is equivalent to:
- NOT x > 5 OR NOT y < 3
- x ≤ 5 AND y ≥ 3
- x < 5 AND y > 3
- NOT x > 5 AND NOT y < 3
6. If both p and q are FALSE, which expression is TRUE?
- p AND q
- p OR q
- NOT p AND q
- NOT p OR NOT q
7. A loan application is approved if applicant’s credit score ≥ 700 AND income ≥ 50000. Which applicant is incorrectly denied?
- Score 680, income 60000 — denied
- Score 720, income 45000 — denied
- Score 700, income 50000 — denied
- Score 650, income 40000 — denied
8. What is the output of:DISPLAY(NOT(3 > 5) AND (4 = 4))
- TRUE
- FALSE
- NOT TRUE
- ERROR
9. A program checks: (temp > 90 OR humidity > 80) AND NOT rain. With temp=95, humidity=70, rain=FALSE, what is the result?
- FALSE — humidity is not above 80
- TRUE — temp above 90 satisfies OR, and rain is FALSE
- TRUE — all three conditions must be met
- FALSE — NOT rain evaluates before AND
10. Which boolean expression is always FALSE regardless of the value of x?
- x > 5 AND x < 10
- x = 5 OR x ≠ 5
- x > 10 AND x < 5
- NOT(x = x)
How the AP Exam Tests This
- Evaluate a compound boolean expression given specific variable values — most common format
- I/II/III: identify which of three statements about AND/OR/NOT are correct
- Identify which boolean condition correctly implements a described rule (e.g., valid range check)
- Spot the error in a boolean condition (AND vs OR, De Morgan’s, impossible compound)
- Determine what change to a boolean expression would produce a desired result
FAQ
Get in Touch
Whether you're a student, parent, or teacher — I'd love to hear from you.
Just want free AP CS resources?
Enter your email below and check the subscribe box — no message needed. Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.
Message Sent!
Thanks for reaching out. I'll get back to you within 24 hours.
Prefer email? Reach me directly at [email protected]