Hardware
Logic circuits, expressions and truth tables
What you need to be able to do
- 3.2Construct a truth table from a logic expression, a logic circuit or a problem statement.
- 3.2Construct a logic expression from a logic circuit, a truth table or a problem statement.
- 3.2Construct a logic circuit from a logic expression, a truth table or a problem statement.
You need: Logic gates and truth tables.
There are three ways of writing the same logic: an expression (words: X = (A AND B) OR NOT C), a circuit (gate symbols wired together) and a truth table (every input combination with its output). Each question gives you one and asks for another. Write expressions with the gate names (AND, OR, NOT…), not Boolean algebra symbols, and bracket every gate's inputs.
Expression → truth table
- List the inputs in binary counting order: 000, 001, 010 … 111 (the paper prints them for you).
- Find the innermost brackets and make a working column for each one, then for the next layer out, and so on.
- Fill each working column row by row using only the columns before it; the last column is the output.
- Don't forget a NOT outside the brackets: it inverts the whole bracket's column (a common slip, November 2022).
Example (computed): X = (A NOR B) NAND (C XOR B)
| A | B | C | A NOR B | C XOR B | X |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 0 | 1 |
| 0 | 0 | 1 | 1 | 1 | 0 |
| 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 0 | 1 |
| 1 | 0 | 0 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 0 | 0 | 1 |
Try it yourself. Fill every working cell, then the output: a wrong cell is explained from the columns it depends on. “Next expression” gives more.
Truth table dry run
| A | B | C | A NOR B | C XOR B | X |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 0 | 1 |
| 0 | 0 | 1 | 1 | 1 | 0 |
| 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 0 | 1 |
| 1 | 0 | 0 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 0 | 0 | 1 |
Circuit → expression
- Start at the inputs (left). Label the output of each first-level gate with its little expression, e.g.
A AND B. - Move right: each gate's output = its gate name between its two input labels, in brackets:
(A AND B) XOR C. - A NOT gate (triangle + circle) on a wire puts NOT in front:
NOT B. - The final gate gives the whole expression. Don't simplify unless asked.
Expression → circuit
- Find the innermost brackets: each one is a gate near the inputs.
- Draw one gate for each operator, all with two inputs (only NOT has one): A AND B AND C needs two AND gates.
- Wire each gate's output into the gate that uses it, working towards the single output.
- Draw NOT gates as a triangle with a circle; use the exact syllabus shapes so AND / OR and XOR / NOR can't be confused.
| A | B | NOT A AND NOT B | A NAND B | A NOR B |
|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 1 |
| 0 | 1 | 0 | 1 | 0 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 | 0 |
Truth table → expression
- Find every row where the output is 1.
- For each one, write an AND term of all the inputs, with NOT in front of any input that is 0 in that row: row A=1, B=1, C=0 →
(A AND B AND NOT C). - Join the terms with OR (“sum of products”). That expression is always correct.
- Look for a simpler pattern before you write it all out: if the output simply copies (or inverts) one input, the answer is that input (or NOT it).
| R | S | T | Q |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 0 |
Q is 1 in two rows: R=0, S=0, T=1 and R=1, S=1, T=0, so Q = (NOT R AND NOT S AND T) OR (R AND S AND NOT T).
Problem statement → expression → circuit
- Give each condition its letter and note what 1 means (e.g. T = 1 means “too high”).
- Turn the words into gates: “and” → AND, “or” → OR, “not / off / acceptable / closed” when 1 means the opposite → NOT.
- Group with brackets exactly as the sentence groups the conditions (bullet points are usually separate brackets).
- Write the expression, then draw the circuit from it.
1 Greenhouse window
The window opens (X = 1) if the temperature is too high (T = 1) and the wind speed is acceptable (W = 0), and rain is not detected (R = 0) or the manual override is off (M = 0).
AskedXKnowacceptable / not / off = 0Routetwo bracketed groups ANDed
- First group: too hot AND wind acceptable → T AND NOT W
- Second group: no rain OR override off → NOT R OR NOT M
- X = (T AND NOT W) AND (NOT R OR NOT M)
NOT R OR NOT M must stay as two NOT gates into an OR: replacing it with a single NOR was a reported error (it means NOT (R OR M), a different thing).
2 Security floodlight
X = 1 if the system is on (E = 1) and it is dark (A = 1) and a person is detected (C = 1).
AskedXKnowall three conditionsRouteAND them
- X = E AND A AND C (two AND gates in a circuit)
3 Alarm
Y = 1 if the system is on (E = 1) and one or more doors (B, D) are open or a person is detected (C).
AskedYKnowon AND (any of three)RouteOR the three, then AND with E
- Y = E AND (B OR C OR D)
Mark-scheme focus
Draw the circuit for T = (NOT A OR B) XOR (C NAND D) (2 marks)
![(a) Draw the logic circuit for this logic expression: T = (NOT A OR B) XOR (C NAND D). [2]](/notes-content/9618/hardware/img/9618_s23_11_q05_a.png)
- 1 mark for 2 correct gates, 2 marks for all 4 gates (NOT on A, OR, NAND, XOR) with correct inputs
- NOT A OR B drawn as a NOR gate
- Gate shapes that can't be told apart; NOT without its circle
The report: “A common incorrect circuit was where the NOT A OR B had been incorrectly replaced with A NOR B.”
From: 9618/11/M/J/23 Q5(a)
Write the logic expressions for the security system (2 marks)
![(b) The floodlight (X) and audio alarm (Y): parameters A daylight low, B front door open, C person within 2 m, D back door open, E system on. X turns on if the system is on and the daylight is low and a person is detected. Y turns on if the system is on and one or more doors are open, or a person is detected. Write logic expressions for X and Y. [2]](/notes-content/9618/hardware/img/9618_w24_11_q05_b.png)
- X = E AND A AND C B1
- Y = E AND (B OR C OR D) B1
- Y = E AND B OR C OR D (no brackets: the AND then binds only to B)
The brackets carry the meaning: the system must be on for ANY of the three triggers.
From: 9618/11/O/N/24 Q5(b)
- Logic is in every paper, usually Q1-Q5: complete a truth table (2), write an expression for a circuit (2-3), draw a circuit (2-4).
- Marks for truth tables: 1 for the first four rows, 1 for the last four.
- Lost marks: missing final NOT, XOR applied wrongly (whole column inverted), brackets in the wrong place, gate replacements.
Worked examples
Example 1 · A truth table from an expression (Paper 1, 2 marks) ★ Easy
![Complete the truth table for the following logic expression: X = (A XOR B) AND NOT C. [2]](/notes-content/9618/hardware/img/9618_s22_12_q07.png)
Two working columns: A XOR B, then NOT C; the output ANDs them.
- AND NOT CC must be 0
- Whole8 outputs
- X
- Col 1A XOR B
- Col 2NOT C
- Xcol 1 AND col 2
5 Now solve it have a go on paper first, then open the worked solution
- A XOR B: 0 0 1 1 1 1 0 0
- NOT C: 1 0 1 0 1 0 1 0
- X = 0 0 1 0 1 0 0 0 B2
| A | B | C | A XOR B | NOT C | X |
|---|---|---|---|---|---|
| 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 | 0 | 1 | 0 |
| 1 | 1 | 1 | 0 | 0 | 0 |
X is 1 only where A ≠ B and C = 0: rows 010 and 100 ✓.
Example 2 · Expression, truth table and a missing gate (Paper 1, 8 marks) ★★ Medium
![A logic circuit is shown: A AND B feeds an XOR gate with C; B also feeds a NOT gate; the XOR output and NOT B feed an OR gate giving X. (a) Write the logic expression for the logic circuit. [3] (b) Complete the truth table. [2] (c) Identify one logic gate not used in the circuit, draw its symbol and complete its truth table. [3]](/notes-content/9618/hardware/img/9618_w21_11_q03.png)
Read the circuit left to right, label each gate's output, then use those labels as the working columns.
- not usedgates in it: AND, XOR, NOT, OR → NAND or NOR are left
- (a)expression
- (b)table
- (c)gate + symbol + table
- (a)
- 1A AND B
- 2… XOR C
- 3… OR NOT B
5 Now solve it have a go on paper first, then open the worked solution
- (a) A AND B B1 … XOR C B1 … OR NOT B B1: X = ((A AND B) XOR C) OR NOT B
- (b) X = 1 1 0 1 1 1 1 0 B2
- (c) e.g. NOR: OR shape with a circle; outputs 1 0 0 0 B3 (or NAND: 1 1 1 0)
| A | B | C | A AND B | (A AND B) XOR C | NOT B | X |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 0 | 1 | 0 | 1 | 1 | 1 |
| 0 | 1 | 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 0 | 0 | 1 | 1 |
| 1 | 0 | 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 0 | 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 |
Row 010: A AND B = 0, XOR C = 0, NOT B = 0, so X = 0 ✓.
Example 3 · Draw the circuit, then the truth table (Paper 1, 6 marks) ★★ Medium
![A logic expression is given: S = (A AND B AND C) OR (B XOR C). (a) Draw the logic circuit for the given expression. [4] (b) Complete the truth table. [2]](/notes-content/9618/hardware/img/9618_s21_12_q03.png)
A AND B AND C needs two 2-input AND gates (a 3-input AND was also accepted).
- (a)circuit
- (b)table
- (a)
- GatesAND, AND, XOR, OR
5 Now solve it have a go on paper first, then open the worked solution
- (a) one mark per correct gate with correct inputs: two ANDs, XOR, OR B4
- (b) S = 0 1 1 0 0 1 1 1 B2
| A | B | C | A AND B | (A AND B) AND C | B XOR C | S |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 1 | 0 | 1 |
Row 111: AND part 1, so S = 1 regardless of the XOR ✓.
Example 4 · From a problem statement to a circuit (Paper 1, 3 marks) ★★★ Hard
![(a) A greenhouse window X: T temperature 1 too high, W wind speed 1 too high, R rain 1 detected, M manual override 1 on. The window opens if the temperature is too high and the wind speed is acceptable, and rain is not detected or the manual override is off. Draw a logic circuit to represent the operation of the window. [3]](/notes-content/9618/hardware/img/9618_w22_12_q03_a.png)
Why it is hard: three of the four inputs must be inverted, and only careful reading of the condition table shows which.
Translate each phrase using the table: “acceptable” wind = W is 0 → NOT W; “not detected” → NOT R; “off” → NOT M.
- acceptablethe 0 value → NOT
- and / or between the bulletsthe grouping
- (a)circuit
- X
- Part 1T AND NOT W
- Part 2NOT R OR NOT M
- JoinAND
Why not R NOR M for part 2?
R NOR M is NOT (R OR M) = 1 only if both are 0; the statement says either one is enough.
5 Now solve it have a go on paper first, then open the worked solution
- T AND NOT W B1
- NOT R OR NOT M B1
- final AND joining them B1
The report: missing NOT gates and replacing NOT R OR NOT M with a NOR gate were common ✓.
Example 5 · An expression from a truth table (Paper 1, 2 marks) ★★ Medium
![(b) Write the logic expression for the following truth table: R S T Q: 000 0, 001 1, 010 0, 011 0, 100 0, 101 0, 110 1, 111 0. [2]](/notes-content/9618/hardware/img/9618_w25_11_q03_b.png)
Two rows give Q = 1: write an AND term for each and OR them.
- (b)expression
5 Now solve it have a go on paper first, then open the worked solution
- Row 001: NOT R AND NOT S AND T B1
- Row 110: R AND S AND NOT T, joined with OR B1
- Q = (R AND S AND NOT T) OR (NOT R AND NOT S AND T)
Each term is 1 in exactly its own row ✓.
Summary
- Expression → table: working columns, innermost first; last column is the output.
- Circuit → expression: label gate outputs left to right, bracket each gate.
- Expression → circuit: one 2-input gate per operator, innermost first; NOT = triangle + circle.
- Table → expression: one AND term per 1-row (NOT for 0 inputs), OR the terms.
- Statement → expression: “acceptable / off / not” usually means NOT; brackets follow the sentence.
| If you see… | do this |
|---|---|
| NOT outside brackets | invert the whole bracket's column last |
| A AND B AND C | two AND gates (2 inputs each) |
| a sentence with “or” inside an “and” | brackets round the OR group |
| (NOT A) OR B | a NOT gate then OR - never NOR |
Can I do this?
- I can complete a truth table from an expression using working columns.
- I can write the expression for a circuit.
- I can draw the circuit for an expression with 2-input gates.
- I can write an expression from a truth table.
- I can turn a problem statement into an expression and a circuit.
Anything unticked: revise that section first. All ticked: take the quiz.
Quiz
The multiple-choice and guided questions need JavaScript. The concept checks and exam practice below work without it.
Concept checks
Answer each one in your head first, then open it.
1Why are the truth table's input rows always in binary counting order?Show answer
So no combination is missed and every candidate's table lines up with the mark scheme's.
2Is there only one correct circuit for an expression?Show answer
No: equivalent circuits score if they give the same truth table and use the allowed gates (e.g. a NOR in place of OR then NOT), but the safest is to draw exactly what the expression says.
Exam-style practice
New questions, not used above. Do them on paper, then mark your work against the official mark scheme.
![(a) Draw the logic circuit for Z = (R XOR S) AND (NOT T NOR P). [2] (b) Complete the truth table for Z = (NOT P OR Q) XOR (R NOR Q). [2]](/notes-content/9618/hardware/img/9618_s23_12_q06.png)
Show the mark scheme
| Part | Answer / working | Marks | Guidance |
|---|---|---|---|
| (a) | Correct XOR and AND gates with correct inputs | B1 | |
| Correct NOT and NOR gates with correct inputs | B1 | ||
| (b) | First four rows: 0 1 1 1 | B1 | |
| Last four rows: 1 0 1 1 | B1 | ||
| Total: 4 marks | |||
![(a) Complete the truth table for Y = ((P AND Q) XOR ((NOT Q) OR R)) AND NOT P. [2] (b) Draw a logic circuit for the same expression. [2]](/notes-content/9618/hardware/img/9618_w23_13_q04.png)
Show the mark scheme
| Part | Answer / working | Marks | Guidance |
|---|---|---|---|
| (a) | First four rows: 1 1 0 1 | B1 | |
| Last four rows: 0 0 0 0 | B1 | NOT P makes every row with P = 1 output 0 | |
| (b) | P AND Q and NOT Q OR R | B1 | |
| NOT gate on P, the XOR and the final AND | B1 | ||
| Total: 4 marks | |||
![(a) Tick one box to identify the correct logic statement for the given truth table (outputs 1 0 0 0 0 0 1 0): NOT (A AND B AND C); (A XOR B) NOR C; (A OR B OR C) NOR C; NOT A AND NOT B AND NOT C. [1] (b) Draw a logic circuit for X = NOT (NOT A AND (NOT B XOR C)). [2]](/notes-content/9618/hardware/img/9618_s24_11_q01.png)
Show the mark scheme
| Part | Answer / working | Marks | Guidance |
|---|---|---|---|
| (a) | (A XOR B) NOR C | B1 | |
| (b) | NOT B XOR C | B1 | |
| NOT A, the AND and the final NOT | B1 | ||
| Total: 3 marks | |||
![Each of three truth tables has inputs A, B, C and output X. Draw one line to match each truth table with its logic expression: NOT (A XOR B) AND C; (A OR C) AND NOT B; A NAND B NAND C; (A NAND B) OR C; NOT (A AND B AND C). [3]](/notes-content/9618/hardware/img/9618_s24_13_q06.png)
Show the mark scheme
| Part | Answer / working | Marks | Guidance |
|---|---|---|---|
| Table 1 (0 1 0 0 1 1 0 0) → (A OR C) AND NOT B | B1 | ||
| Table 2 (0 1 0 0 0 0 0 1) → NOT (A XOR B) AND C | B1 | ||
| Table 3 (1 1 1 1 1 1 0 1) → (A NAND B) OR C | B1 | ||
| Total: 3 marks | |||
![(a) Write the logic expression for the given logic circuit. Do not simplify. [2] (b) For X = NOT ((A NAND B) XOR (NOT A OR NOT C)), the given truth table (outputs 1 0 1 0 1 0 1 1) has three errors. Identify the three row numbers with an incorrect output. [2]](/notes-content/9618/hardware/img/9618_w25_12_q09.png)
Show the mark scheme
| Part | Answer / working | Marks | Guidance |
|---|---|---|---|
| (a) | NOT (A XOR B) | B1 | |
| NAND ((B AND C) OR A): X = (NOT (A XOR B)) NAND ((B AND C) OR A) | B1 | ||
| (b) | Rows 2, 4 and 7 | B2 | 1 mark for one or two correct |
| correct outputs: 1 1 1 1 1 0 0 1 | |||
| Total: 4 marks | |||
Your progress on this note is saved when JavaScript is on.