What this topic is
Digital systems work with two states, 1 and 0. Logic gates combine them to make decisions: AND, OR and NOT.
You show what a circuit does with a truth table. You write it as a Boolean expression. You build it on the logic board or in Yenka. Microcontrollers and flowcharts are on the Programmable Control (Booklet 4b) page.
Slides and resources
Every lesson's slides, with and without answers.
Digital signals and logic states
An analogue signal can take any value in a range. A digital signal has only two values: logic 1 (high, on, true) and logic 0 (low, off, false).
A dimmer and a light switch
Both control a lamp. A dimmer can set any brightness: that is analogue. A light switch is on or off: that is digital.
Analogue signals
Can take any value in a range. Change smoothly.
An LDR divider: Vout rises as it gets darker.
Digital signals
Only two values: ON or OFF, HIGH or LOW, 1 or 0.
A push switch is digital: pressed or not.
- Pressed: near 5 V, logic 1 (high, on, true).
- Released: near 0 V, logic 0 (low, off, false).
Digital inputs and outputs
Inputs give 1 or 0: push button, limit switch, guard switch, infrared sensor.
Outputs are on or off: LED, buzzer, motor, relay.
1. Describe the difference between an analogue and a digital signal. 2 marks
Answer
2. Explain why a digital signal is not upset by a small amount of noise. 2 marks
Answer
AND, OR and NOT gates Exam
A logic gate takes digital inputs (1 or 0) and gives one digital output, Z. At National 5 you use three: AND, OR and NOT.
Past papers 2024 S1 Q1(a), (b)
The exam calls the output Z. Your booklet calls it Q.
AND gate
Z = 1 only when all inputs are 1.
Like two switches in series.
Use: the two-hand press: it moves only when both hands are on the buttons.
| A | B | Z |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
OR gate
Z = 1 when any input is 1.
Like two switches in parallel.
Use: an alarm that sounds when any door opens.
| A | B | Z |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
NOT gate
One input. The output is the opposite.
Also called an inverter.
Use: a fridge light that is on when the door is not closed.
| A | Z |
|---|---|
| 0 | 1 |
| 1 | 0 |
Drawing the symbols
- Draw the shape.
- Add the input lines.
- Add the output line.
The mistake: 0 marks
The answer: 1 mark
Testing a gate
Put a switch on every input and label them A and B. Switch up = 1. LED on = 1.
Test 00, 01, 10, 11 in order, then compare with the truth table.
In class you build it on the logic board: switches J and K are A and B. No kit? Do the same test in Yenka.
Safety: never join two outputs.
1. State the output of an AND gate when A = 1 and B = 0. 1 mark
Answer
2. Draw the symbol for an OR gate. 1 mark
Answer
Draw both input lines and the output line, or the mark is lost.
3. Describe what a NOT gate does. 1 mark
Answer
Truth tables for combinations Exam
A truth table shows the output for every set of inputs. Work it out one gate at a time. Give each gate's output its own column, D and E. Do Z last. Each column scores a mark.
Past papers 2026 S2 Q14(d) 2025 S2 Q11(c) 2024 S2 Q14(c) 2023 S2 Q12(f) 2022 S2 Q12(a) 2021 S2 Q8(e) 2019 S2 Q9(e) 2018 S2 Q12(a)(ii) · asked in 8 of 8 exam years
How many rows?
Rows = 2n
n is the number of inputs.
- 1 input: 2 rows
- 2 inputs: 4 rows
- 3 inputs: 8 rows
| A |
|---|
| 0 |
| 1 |
| A | B |
|---|---|
| 0 | 0 |
| 0 | 1 |
| 1 | 0 |
| 1 | 1 |
Filling the input columns
- C column: 0 1 0 1 0 1 0 1
- B column: 0 0 1 1 0 0 1 1
- A column: 0 0 0 0 1 1 1 1
This is counting in binary, from 000 to 111. Fill them this way and no row is missed. The exam always prints them in this order.
| A | B | C |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 0 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
| 1 | 1 | 1 |
One gate at a time
A logic circuit has no memory. The output depends only on the inputs now.
Label each gate's output: D, E. Give each one a column. Do Z last, from D and E.
The exam uses D and E for these points and Z for the output. Your booklet calls them X and Q. They mean the same thing.
Worked example: one column at a time
Complete the truth table for the logic diagram. 3 marks
- Column D = NOT A. 1 mark
- Column E = NOT B. 1 mark
- Column Z = D AND E. 1 mark
Each column scores its own mark. If D is wrong, Z can still score if it is right from your D.
| A | B | D | E | Z |
|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 1 |
| 0 | 1 | 1 | 0 | 0 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 | 0 |
1. State how many rows a truth table needs for 3 inputs. 1 mark
Answer
2. State the row that comes after 1 0 1. 1 mark
Answer
3. Explain why D and E are given their own columns. 1 mark
Answer
From a real paper: 2021 Section 2, Question 8(e). 3 marks
Marking instructions
1 mark for each correct column. FTE (follow-through error) means a later column can still score if it is right from your earlier, wrong one.
Sources & credits: © Qualifications Scotland (SQA). 2021 National 5 Engineering Science Section 2, Q8.
Boolean expressions Exam
A Boolean expression writes a whole circuit in one line. AND is a dot, OR is a plus, NOT is a bar over the letter. Brackets show which gates come first.
Past papers 2026 S1 Q5 2025 S2 Q11(d) 2024 S2 Q12(c) 2023 S1 Q3 2022 S2 Q12(b) 2021 S2 Q8(f) 2019 S1 Q6 2018 S1 Q9 · asked in 8 of 8 exam years
Boolean for each gate
- AND is a dot: A • B
- OR is a plus: A + B
- NOT is a bar: A̅
Your booklet writes AND as A.B and the output as Q. The exam writes A • B and Z.
From words to Boolean
A motor turns on when the start button is pressed and the guard is in place.
- Name the inputs: A = start button, B = guard.
- "and" means AND: a dot.
- Z = A • B
From a diagram to Boolean
- Label each first gate: D, E.
- Write each one: D = A • B, E = C̅.
- The last gate joins them: Z = D + E.
- Put brackets round each first gate: Z = (A • B) + C̅
From Boolean to a diagram
Draw Z = A̅ + (B • C).
- A, B, C on the left. Z on the right.
- The bracket first: B • C is an AND gate.
- A̅ is a NOT gate.
- The + outside the bracket is the last gate: OR.
Draw every input and output line. A gate with a line missing loses its mark.
1. Write the Boolean expression. A warning light comes on when a door is open (A) and the engine is running (B). 1 mark
Answer
2. Write the Boolean expression. A pump runs when no water is detected (A). 1 mark
Answer
3. Draw the logic diagram for Z = (A + B) • C. 2 marks
Answer
1 mark for each gate wired to the right inputs.
From a real paper: 2019 Section 1, Question 6. 3 marks
Marking instructions
1 mark for each gate wired to the right inputs. No FTE from a gate: a gate wired wrongly loses the marks after it too.
Sources & credits: © Qualifications Scotland (SQA). 2019 National 5 Engineering Science Section 1, Q6.
Designing logic for engineering problems Exam
To design a control system, underline the inputs and the output. Choose AND, OR or NOT. Write the Boolean. Then draw it and check it with a truth table.
Past papers 2023 S2 Q12(g) 2019 S2 Q9(d)
Worked example 1: a fan
A fan runs when it is hot and the door is not open.
- A = hot, B = door open. Z = fan.
- AND, with NOT on B.
- Z = A • B̅
- Draw it, then check: is Z = 1 only when it is hot and the door is shut?
| A | B | D | Z |
|---|---|---|---|
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
Worked example 2: a lift
A lift moves when the door is closed and the floor or call button is pressed.
- A = door closed, B = floor button, C = call button.
- B OR C first, then AND with A.
- Z = A • (B + C)
- Check: the lift moves only with the door closed (A = 1).
In class: you build this on the logic board and test all 8 rows. Switches J, K, L are A, B, C.
| A | B | C | D | Z |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 1 |
From a truth table to Boolean
- Find each row with Z = 1.
- AND its inputs, with a bar on each 0.
- Row 0 1: (A̅ • B)
- Row 1 0: (A • B̅)
- OR the brackets: Z = (A̅ • B) + (A • B̅)
| A | B | Z |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
1. State the gate and write the Boolean. An alarm sounds when any one of three windows (A, B, C) is opened. 2 marks
Answer
2. Write the Boolean. A press works when the start button (A) and the guard (B) are on. The emergency stop (C) must not be pressed. 2 marks
Answer
3. Write the Boolean. A truth table has Z = 1 only in row A = 1, B = 1, C = 0. 2 marks
Answer
From a real paper: 2019 Section 2, Question 9(d). 3 marks
Marking instructions
One bracket for each row with Z = 1, a bar on each 0, then OR the brackets.
Sources & credits: © Qualifications Scotland (SQA). 2019 National 5 Engineering Science Section 2, Q9.
Check your booklet work
Answers to Booklet 4a. Try each one first, then open it. These use the booklet's letters, X and Q.
Task 1 — Logic states (page 4)
| Situation | Logic state |
|---|---|
| A switch is being pressed. | 1 |
| A switch is not being pressed. | 0 |
| A guard sensor detects the guard is in place. | 1 |
| A buzzer is silent. | 0 |
| A motor is running. | 1 |
Lesson 1 Review Questions
- Analogue: any value in a range. Digital: only two values.
- Any two: push button, limit switch.
- Any two: LED or lamp, buzzer.
- Near 5 V.
- Near 0 V.
- Logic 1.
- The guard is not in place.
- A buzzer sounds, to warn the user.
- It has only two levels, so noise can't flip it.
- Analogue.
Lesson 2 Review Questions
- AND, OR, NOT.
- The output is 1 only when all inputs are 1.
- The output is 1 when any input is 1.
- The output is the opposite of the input.
- Q column: 0, 0, 0, 1.
- Q column: 0, 1, 1, 1.
- AND gate.
- OR gate.
- Logic 0.
- It inverts: the output is the opposite of the input.
Practical Task 1 — Testing the gates (page 7)
| A | B | Z (AND) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
| A | B | Z (OR) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
| A | Z (NOT) |
|---|---|
| 0 | 1 |
| 1 | 0 |
Task 4 — Truth tables (page 11)
| A | B | X | Q |
|---|---|---|---|
| 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 |
| A | B | X | Q |
|---|---|---|---|
| 0 | 0 | 1 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 0 |
Task 5 — Three inputs (page 12)
| A | B | C | X | Q |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 1 |
| 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 1 |
Lesson 3 Review Questions (page 13)
- Rows = 2n.
- 4.
- 8.
- The output depends on the inputs now only.
- One gate at a time, so mistakes are easy to spot.
Task 6 — Words to Boolean (page 14)
| Description | Boolean |
|---|---|
| Buzzer: either of two doors | Q = A + B |
| Warning light: door open and engine on | Q = A • B |
| Pump off: no water detected | Q = A̅ |
| Heater: temperature low and timer on | Q = A • B |
Task 7 — Drawing diagrams (pages 14 to 15)
Check each diagram has every input and output line.
- Q = A.B: one AND gate.
- Q = A + B: one OR gate.
- Q = A̅.B: A through a NOT gate, then AND with B.
- Q = A + (B.C): B AND C first, then OR with A.
Lesson 4 Review Questions
- Q = A • B
- Q = A + B
- Q = A̅
- Q = A • B • C̅
- Q = (A • B) + C
- Q = A + (B • C)
Questions 5, 6, 7 and 10 are diagrams. Check them against the With Answers slides for Lesson 4.
Task 8 — Design problems (pages 18 to 20)
| Part | Inputs | Boolean |
|---|---|---|
| (a) | A front door, B back door | Q = A + B |
| (b) | A door closed, B start | Q = A • B |
| (c) | A dark, B movement | Q = A • B |
| (d) | A stop button (1 = not pressed) | Q = A |
Lesson 5 Review Questions (pages 21 to 22)
- AND; Q = A • B
- OR; Q = A + B + C
- Q = A • B • C̅
- OR; Q = A + B
- AND (three inputs)
- AND
- Q = A • B
- Q = A̅ • B
- Q = (A • B) + C̅
Question 10:
| A | B | C | Q |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 |
Check yourself
Rate your confidence: the I Can statements
R not yet, A getting there, G confident. Saved on this device only.
Recap and words
What loses marks
- A gate shape with no input or output lines.
- Jumping straight to Z: fill D, then E, then Z.
- Input columns out of order: count in binary, 000 to 111.
- Boolean with the brackets left out.
- A bar missing, or on the wrong letter.
- Writing Boolean from a table with a bracket missing for a row with Z = 1.
Glossary
- Analogue signal
- Can take any value in a range. Changes smoothly.
- Digital signal
- Only two values: 1 or 0, on or off.
- Logic 1 / logic 0
- Logic 1 is high, on, true (near 5 V). Logic 0 is low, off, false (near 0 V).
- AND gate
- Output 1 only when all inputs are 1.
- OR gate
- Output 1 when any input is 1.
- NOT gate (inverter)
- Output is the opposite of the input.
- Truth table
- Every set of inputs and its output. Rows = 2ⁿ.
- Boolean expression
- A circuit in one line: • for AND, + for OR, a bar for NOT.
- Combinational logic
- The output depends only on the inputs now. No memory.
Where this comes up next
Sources & credits: the text, logic diagrams, truth tables and the logic board drawing are by R Stewart, written for Booklet 4a; dimmer switch photo: Paolomarco, CC BY-SA 4.0, via Wikimedia Commons; the logic board is drawn from the UKESF / University of Southampton Logic and Arithmetic kit teacher guide. Past paper references, past paper questions and marking instructions © Qualifications Scotland (SQA). R Stewart - November 2026.