These eight original questions get harder as you go. Write your own table for each one before opening the answer, with every input row listed.
They cover the four skills in Boolean logic and representation. Use the timed original practice session builder to set a repeatable session length.
Questions
Question 1. Complete the truth table for P = A AND NOT B.
Answer
| A | B | NOT B | P |
|---|---|---|---|
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
P is 1 only when A is on and B is off. Lesson: building a truth table from a nested Boolean expression.
Question 2. Build the truth table for Q = (A OR B) AND NOT C and say how many rows give 1.
Answer
| A | B | C | A OR B | NOT C | Q |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 0 |
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 | 1 |
| 0 | 1 | 1 | 1 | 0 | 0 |
| 1 | 0 | 0 | 1 | 1 | 1 |
| 1 | 0 | 1 | 1 | 0 | 0 |
| 1 | 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 | 0 |
Q is 1 in 3 rows: those where C is 0 and at least one of A, B is 1.
Question 3. Evaluate R = NOT A OR B when A = 1 and B = 0, showing each step.
Answer
NOT is evaluated first: NOT A = NOT 1 = 0. Then OR: 0 OR B = 0 OR 0 = 0.
A common slip is to apply NOT to the whole expression. That gives NOT (1 OR 0) = 0, which happens to agree here, but it will not agree for other values, so always follow the order.
Question 4. Is A OR (A AND B) equivalent to A? Prove it with a table.
Answer
| A | B | A AND B | A OR (A AND B) | A |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 1 |
The last two columns match in all 4 rows, so they are equivalent.
Lesson: checking a claimed equivalence.
Question 5. A student claims NOT (A AND B) is equivalent to NOT A AND NOT B. Show whether the claim is true.
Answer
Try A = 0, B = 1. Left side: A AND B = 0, so NOT 0 = 1. Right side: NOT A = 1 and NOT B = 0, so 1 AND 0 = 0.
The results differ (1 and 0), so the claim is false. One row is enough to show this. The correct law is NOT (A AND B) = NOT A OR NOT B, which gives 1 OR 0 = 1 in this row.
Question 6. Write a condition for: “A student may enter the lab if they have a pass and either a teacher is present or it is before 5 pm.” Use P (has pass), T (teacher present) and E (before 5 pm). Test a student with a pass, no teacher, after 5 pm.
Answer
“Either a teacher is present or it is before 5 pm” is a group, and the pass applies to it. The condition is P AND (T OR E).
Test: P = 1, T = 0, E = 0. So 1 AND (0 OR 0) = 1 AND 0 = 0. The student may not enter, which matches the rule.
Lesson: turning a written requirement into a precise condition.
Question 7. Write the condition for “exactly one of the two doors is open”, using D1 and D2. Check it on the row where both are open.
Answer
Exactly one means one open and the other not: (D1 AND NOT D2) OR (NOT D1 AND D2).
Check with both open: D1 = 1, D2 = 1. First part: 1 AND 0 = 0. Second part: 0 AND 1 = 0.
So 0 OR 0 = 0, which is correct because both open is not “exactly one”. A plain D1 OR D2 would give 1 and be wrong.
Question 8. (a) How many values can 5 bits represent? (b) What is the smallest number of bits for the value 40? (c) What is the value of 00101000, and how many bits are used?
Answer
(a) 2⁵ = 32 patterns, for 0 to 31 if unsigned.
(b) 2⁵ = 32 is less than 40 and 2⁶ = 64 is greater, so 6 bits. The largest 5-bit value is 31, which is too small.
(c) The 1s are in the places worth 32 and 8, so the value is 32 + 8 = 40. The pattern uses 8 bits. Note that (b) and (c) show the same value in different sizes.
Lesson: distinguishing representation size from the value represented.
If you got these wrong
- Wrong columns or evaluation order: return to building a truth table from a nested Boolean expression.
- Claims proved from a few rows: return to checking a claimed equivalence.
- Conditions that accept the wrong cases: return to turning a written requirement into a precise condition.
- Size and value answers mixed: return to representation size versus value.
Check any table in the Boolean expression and truth-table explorer. For a teacher to go through your attempts, see online one-to-one Computer Science tuition.