Study smarter with Fiveable
Get study guides, practice questions, and cheatsheets for all your subjects. Join 500,000+ students with a 96% pass rate.
Boolean logic is the foundation of every decision your program makes. When you write an IF statement, combine conditions with AND or OR, or check whether a user meets multiple criteria, you're using Boolean operations. The AP exam tests whether you can trace through conditional logic, predict program output when multiple conditions combine, and recognize equivalent expressions—skills that show up in both multiple-choice questions and FRQs asking you to analyze or write code.
You're being tested on more than just knowing that AND requires both inputs to be true. The exam wants you to understand short-circuit evaluation, how to negate compound conditions, and when two different-looking expressions actually do the same thing. Don't just memorize truth tables—know how each operation behaves in real code and when to use one over another.
These three operations form the backbone of all conditional logic in programming. Every complex Boolean expression you'll encounter on the AP exam can be broken down into combinations of these fundamental operations.
AND in pseudocode; this is your go-to for situations requiring multiple criteria to be satisfied simultaneouslyNOT(A AND B) negates the whole compound conditionCompare: AND vs. OR—both combine two conditions, but AND requires all to be true while OR requires any to be true. If an FRQ asks you to check whether a value falls within a range, you need AND (e.g., x >= 0 AND x <= 100); if checking whether a value matches one of several options, you need OR.
These operations build on the core three to handle special cases. While XOR appears occasionally on the exam, understanding how negation combines with AND/OR is critical for expression simplification.
NOT(A AND B), which means it outputs true for any combination except NOT(A OR B), outputting true only for the input combinationCompare: NAND vs. NOR—both are negated versions of core operations, but NAND negates AND (false only for all-true) while NOR negates OR (true only for all-false). Recognizing these as NOT(A AND B) and NOT(A OR B) helps you apply De Morgan's Laws.
These techniques help you verify Boolean expressions, prove equivalence, and simplify complex conditions—all skills tested on the AP exam when you need to trace code or identify equivalent program segments.
NOT(A AND B) equals (NOT A) OR (NOT B)—negating an AND flips it to OR and negates each partNOT(A OR B) equals (NOT A) AND (NOT B)—negating an OR flips it to AND and negates each partCompare: Truth tables vs. De Morgan's Laws—truth tables prove equivalence by exhaustive checking (works for any expressions), while De Morgan's Laws provide direct algebraic transformation (faster for negated compound conditions). Use truth tables when unsure; use De Morgan's when you spot a negated AND or OR.
| Concept | Best Examples |
|---|---|
| Requires all conditions true | AND operation |
| Requires at least one condition true | OR operation |
| Inverts a single value | NOT operation |
| True when inputs differ | XOR operation |
| Negated compound operations | NAND, NOR |
| Systematic verification | Truth tables |
| Negation transformation | De Morgan's Laws |
| Expression optimization | Boolean simplification, logical equivalence |
If x = 5 and y = 10, what does (x > 3) AND (y < 8) evaluate to, and why does short-circuit evaluation NOT skip the second condition here?
Which two operations are universal gates, and what property makes them "universal"?
Using De Morgan's Laws, rewrite NOT(score >= 70 AND attendance >= 80) as an equivalent expression without the outer NOT.
Compare AND and XOR: for which input combination do they produce different outputs, and why does this matter when checking conditions?
An FRQ shows two code segments—one uses NOT(A OR B) and the other uses (NOT A) AND (NOT B). How would you demonstrate these are logically equivalent using a truth table?