Exercises — Truth tables construction
Level 1 — Recognition
Exercise 1.1
How many rows does a truth table have for a function of 5 inputs?
Recall Solution
The number of rows is because each input independently chooses between values, so the choices multiply. Answer: 32 rows.
Exercise 1.2
For (OR), which single row makes the output ?
Recall Solution
OR is whenever at least one input is . The only way to get is if no input is . That is the row .
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Answer: the single row .
Exercise 1.3
Read the standard column pattern: in a 3-input table, what does the middle column () look like from top to bottom?
Recall Solution
Convention: rightmost column () toggles every 1 row (); the middle column () toggles every 2 rows; the leftmost () every 4. So is: Answer: .
Level 2 — Application
Exercise 2.1
Build the full truth table for (NOT-A AND B), 2 inputs. Use one intermediate column.
Recall Solution
First compute the inside piece , then AND it with (Feynman: small piece first, then combine).
| 0 | 0 | 1 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 0 |
Only row 2 gives : there and , so AND is . Everywhere else at least one factor is . Answer output column (top→bottom): .
Exercise 2.2
Build the truth table for , 2 inputs.
Recall Solution
Intermediate column first, then OR with .
| 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 |
Only row 2 is : there and (since ), so . Answer output column: .
Exercise 2.3
Build the truth table for (XOR), 2 inputs, from the definition "1 when they differ".
Recall Solution
XOR outputs exactly when the two inputs are not equal.
| differ? | |||
|---|---|---|---|
| 0 | 0 | no | 0 |
| 0 | 1 | yes | 1 |
| 1 | 0 | yes | 1 |
| 1 | 1 | no | 0 |
Answer output column: .
Level 3 — Analysis
Exercise 3.1
Build the full 8-row table for using two intermediate columns, then state on how many rows .
Recall Solution
Columns: toggles every row, every 2, every 4. Intermediates: and , then OR them.
| 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 1 | 1 |
| 1 | 0 | 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 | 1 |
Count the s: rows 1,3,5,7,8 → 5 rows where . Answer: on 5 of the 8 rows.
Exercise 3.2
Two students claim and (material implication) are the same function. Verify by comparing full truth tables.
Recall Solution
Implication is defined as "false only when true but false". Compare:
| 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
Both columns read — identical. Same table ⇒ logically equivalent. Answer: yes, they are the same function ().
Exercise 3.3
Use truth tables to check De Morgan's law for 2 inputs.
Recall Solution
Build both sides column by column.
| 0 | 0 | 0 | 1 | 1 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 | 1 | 1 |
| 1 | 1 | 1 | 0 | 0 | 0 | 0 |
Left side . Right side . Identical ⇒ the law holds. See Boolean Algebra Laws. Answer: both sides ; the law is verified.
Level 4 — Synthesis
Exercise 4.1
A circuit turns a light ON () exactly when an odd number of its three inputs are . Build its truth table.
Recall Solution
Count how many of are in each row; output if that count is odd ( or ).
| number of 1s | (odd?) | |||
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 |
| 0 | 1 | 1 | 2 | 0 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 0 | 1 | 2 | 0 |
| 1 | 1 | 0 | 2 | 0 |
| 1 | 1 | 1 | 3 | 1 |
This is exactly (three-input XOR / parity). Answer output column: .
Exercise 4.2
Design (as a truth table) a 2-input equality detector: when , else . Then give a Boolean expression for it.
Recall Solution
Equal means both or both .
| equal? | |||
|---|---|---|---|
| 0 | 0 | yes | 1 |
| 0 | 1 | no | 0 |
| 1 | 0 | no | 0 |
| 1 | 1 | yes | 1 |
Output column is the exact opposite of XOR (), so (called XNOR). Reading the two -rows off the table as a Sum of Products: . Answer: output ; .
Exercise 4.3
Build the truth table for , 3 inputs, using intermediate columns. On how many rows is ?
Recall Solution
Intermediates and , then AND them.
| 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 |
needs and . That happens on rows 3,5,7 → 3 rows. Answer: on 3 rows; output column .
Level 5 — Mastery
Exercise 5.1
A 4-input function is exactly when the 4 bits , read as a binary number, are a multiple of 3 (including 0). Build the full 16-row table.
Recall Solution
Read as a number . Mark where that number is (the multiples of 3 from 0 to 15).
| value | |||||
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 1 |
| 0 | 0 | 0 | 1 | 1 | 0 |
| 0 | 0 | 1 | 0 | 2 | 0 |
| 0 | 0 | 1 | 1 | 3 | 1 |
| 0 | 1 | 0 | 0 | 4 | 0 |
| 0 | 1 | 0 | 1 | 5 | 0 |
| 0 | 1 | 1 | 0 | 6 | 1 |
| 0 | 1 | 1 | 1 | 7 | 0 |
| 1 | 0 | 0 | 0 | 8 | 0 |
| 1 | 0 | 0 | 1 | 9 | 1 |
| 1 | 0 | 1 | 0 | 10 | 0 |
| 1 | 0 | 1 | 1 | 11 | 0 |
| 1 | 1 | 0 | 0 | 12 | 1 |
| 1 | 1 | 0 | 1 | 13 | 0 |
| 1 | 1 | 1 | 0 | 14 | 0 |
| 1 | 1 | 1 | 1 | 15 | 1 |
Count of s: values → 6 rows. Answer: on 6 rows (values ).
Exercise 5.2
Prove — using truth tables — that (the distributive law) for all 3-input combinations.
Recall Solution
Build both sides fully.
| LHS | RHS | ||||||
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 | 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 | 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
LHS column . RHS column . Identical on all 8 rows ⇒ the law holds. See Boolean Algebra Laws. Answer: both sides ; distributive law verified.
Exercise 5.3
A 3-bit majority voter outputs when at least two of are (used in fault-tolerant hardware). Build its truth table and read off its SOP expression.
Recall Solution
Output where the number of s is .
| number of 1s | ||||
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 2 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 2 | 1 |
| 1 | 1 | 0 | 2 | 1 |
| 1 | 1 | 1 | 3 | 1 |
The four -rows are . As SOP and after grouping: Answer: on 4 rows; .
Wrap-up
Recall One-line summary of every level
- L1: rows ; recognise gate outputs.
- L2: build small tables with one intermediate column.
- L3: multi-gate tables, verify equivalences and laws.
- L4: design a table from a word-spec (parity, equality, gated OR).
- L5: 4-input specs, prove laws, read SOP from a voter.
Connections
- Parent: Truth tables construction
- Logic Gates AND OR NOT — each exercise is gates wired together.
- Boolean Algebra Laws — L3.3 and L5.2 prove laws by table.
- Sum of Products (SOP) — L4.2, L5.3 read expressions off -rows.
- Karnaugh Maps — next step for simplifying these tables.
- Binary Number System — the counting behind every row.
- Combinational Logic Circuits — what these functions become as hardware.