These questions cover the whole Boolean logic module: evaluating expressions, truth tables, circuits, equivalence and turning sentences into conditions. They are original and ordered from easier to harder.
Write full working on paper, including each bracket step. Then open the answer and compare. Order of evaluation throughout: brackets, NOT, AND, OR.
Questions
1. (Easy) Find Q = NOT A OR B when A = 1 and B = 0.
Show answer
NOT A = NOT 1 = 0. Then 0 OR 0 = 0.
2. (Easy) Find Q = (A AND B) OR C when A = 1, B = 0 and C = 1.
Show answer
Bracket: 1 AND 0 = 0. Then 0 OR 1 = 1.
3. (Easy) Find Q = NOT (A OR B) AND C when A = 0, B = 0 and C = 1.
Show answer
Bracket: 0 OR 0 = 0. NOT 0 = 1. Then 1 AND 1 = 1.
4. (Easy) How many rows does a truth table need for three inputs? For five inputs?
Show answer
23 = 8 rows. 25 = 32 rows.
5. (Medium) Complete the truth table for Q = NOT A OR B.
Show answer
| A | B | NOT A | Q |
|---|---|---|---|
| 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 1 |
Q is 0 only when A = 1 and B = 0.
6. (Medium) Inputs A and B go into an AND gate with output X. X goes into a NOT gate with output Q. Write the expression and the output column for AB = 00, 01, 10, 11.
Show answer
Q = NOT (A AND B), which is a NAND gate. A AND B for the four rows is 0, 0, 0, 1, so Q is 1, 1, 1, 0.
7. (Medium) Inputs A and B go into an XOR gate with output X. X goes into a NOT gate with output Q. Give the output column for AB = 00, 01, 10, 11.
Show answer
XOR gives 0, 1, 1, 0. NOT flips each: Q is 1, 0, 0, 1. The circuit outputs 1 when the two inputs are the same.
8. (Medium) Are NOT (A OR B) and (NOT A) AND (NOT B) equivalent?
Show answer
| A | B | NOT (A OR B) | (NOT A) AND (NOT B) |
|---|---|---|---|
| 0 | 0 | 1 | 1 AND 1 = 1 |
| 0 | 1 | 0 | 1 AND 0 = 0 |
| 1 | 0 | 0 | 0 AND 1 = 0 |
| 1 | 1 | 0 | 0 AND 0 = 0 |
All four rows match, so they are equivalent.
9. (Harder) Are A AND (NOT A OR B) and A AND B equivalent?
Show answer
If A = 0: the left side is 0 AND (1 OR B) = 0, and the right side is 0 AND B = 0. If A = 1: the left side is 1 AND (0 OR B) = B, and the right side is 1 AND B = B. Both cases match, so they are equivalent.
10. (Harder) A shop says “free delivery for orders over RM100 and for members”. Write a pseudocode condition using Total and Member, and test it with Total = 50 and Member = TRUE.
Show answer
The shop means either group qualifies, so use OR:
IF (Total > 100) OR (Member = TRUE) THEN
OUTPUT "Free delivery"
ENDIF
Test: (50 > 100) is FALSE, Member = TRUE, so FALSE OR TRUE = TRUE and delivery is free. Using AND would give FALSE and wrongly refuse a member.
11. (Harder) Trace this pseudocode and state the output.
Score ← 62
Attended ← TRUE
IF (Score >= 50) AND NOT (Attended = FALSE) THEN
OUTPUT "Pass"
ELSE
OUTPUT "Retry"
ENDIF
Show answer
(62 >= 50) is TRUE. (Attended = FALSE) is FALSE, so NOT FALSE = TRUE. Then TRUE AND TRUE = TRUE. The output is Pass.
If you got these wrong
| Where it went wrong | Go to |
|---|---|
| Wrong value after a bracket, NOT or AND/OR order (1 to 3, 11) | Evaluate a logical expression with parentheses |
| Missing rows or wrong row count (4, 5) | Construct a truth table |
| Gate output wrong, XOR mixed with OR (6, 7) | Interpret a simple logic circuit |
| Equivalence decided from too few cases (8, 9) | Compare two equivalent expressions using cases |
| Sentence turned into the wrong operator (10) | Distinguish logical AND from ordinary language ambiguity |
You can check small expressions with the Boolean and number-representation lab, trace the pseudocode in question 11 with the restricted pseudocode trace trainer. The Computer Science learning guide shows the other modules.
If the same type of question keeps catching you out, our teachers can look at your working in online one-to-one Computer Science tuition.