Operators that combine or modify boolean expressions: AND (true only when both operands are true), OR (true when at least one operand is true), and NOT (reverses a boolean value from true to false or vice versa).
AND is strict (both must be true), OR is flexible (either works), NOT flips the result.
Showing a random 20 of 50 problems.
Example 1
medium
Evaluate NOT (True OR False) AND True using precedence.
Example 2
easy
Evaluate: True AND True AND False.Evaluating True AND True AND False left to right.
Example 3
medium
Access is granted if `(isAdmin OR isOwner) AND NOT isBanned`. For isAdmin=False, isOwner=True, isBanned=False, is access granted?(isAdmin OR isOwner) AND NOT isBanned with isAdmin=F, isOwner=T, isBanned=F.
Example 4
hard
Show that A XOR BâĄ(A AND NOT B) OR (NOT A AND B) by testing (A,B)=(T,F).
Example 5
medium
Evaluate (AÂ ANDÂ B)Â ORÂ (AÂ ANDÂ NOTÂ B) for A=True, B=False.
Example 6
challenge
XOR can be built from AND, OR, NOT. Verify that AÂ XORÂ B=(AÂ ORÂ B)Â ANDÂ NOT(AÂ ANDÂ B) for A=True,B=True.
Example 7
challenge
Write the negation of 'every student passed' using logical operators (formally).
Example 8
medium
How many rows are in the truth table for an expression with 5 boolean variables?
Example 9
hard
Simplify: (AÂ ANDÂ B)Â ORÂ (AÂ ANDÂ NOTÂ B).
Example 10
medium
Using De Morgan's law, rewrite NOTÂ (AÂ ORÂ B) without the outer NOT.
Example 11
medium
Evaluate AÂ ANDÂ NOTÂ BÂ ORÂ C for A=True, B=True, C=False, using standard precedence.
Example 12
medium
If short-circuit AND is used and `A AND B` evaluates only A when A is False, what design rule does this enable?
Example 13
easy
How many rows does the truth table for A AND B have?Complete truth table for A AND B â count the rows to answer the question.
Example 14
hard
Why is `{NAND}` (NOT AND) considered functionally complete on its own?
Example 15
hard
Three variables A,B,C. Build a truth-table expression that is True only when EXACTLY one of them is true.
Example 16
medium
Identify the bug: `if (x = 0 OR 1 OR 2)` is meant to test whether x is 0, 1, or 2.
Example 17
medium
A short-circuit AND `A AND B` skips evaluating B when A is false. If A is `False`, is B evaluated?
Example 18
medium
For a discount, a customer needs (age over 65) OR (student AND member). If age=70, student=False, member=False, does the customer qualify?Discount condition: (age > 65) OR (student AND member) with age=70, student=False, member=False.