Year 10 · Computer Science · Autumn 2
Data transmission and Boolean logic · Lesson 5 of 5
Logic gates, truth tables and circuits
Exam practice10.1 The six logic gates10.2 Truth tables10.3 Expressions and circuits
Year 10 · Computer Science · Data transmission and Boolean logic · Lesson 5 of 5
You will learn to
- State the rule, symbol and truth table for NOT, AND, OR, NAND, NOR and XOR.
- Calculate the number of rows a truth table needs: 2 to the power of the number of inputs.
- Write a logic expression from a circuit, and draw a circuit from an expression.
- Complete a truth table for a three-input circuit, using working columns.
Year 10 · Computer Science · Data transmission and Boolean logic · Lesson 5 of 5
Success criteria
You have got it when you can say:
- I can draw all six gates and fill in their truth tables from memory.
- I can list the 8 input rows for three inputs in order, from 000 to 111.
- I can turn a past-paper circuit into an expression and a truth table.
Year 10 · Computer Science · Data transmission and Boolean logic · Lesson 5 of 5
Retrieval starter
Questions from before. Write your answers, then show them.
- Last lesson
Parity can…
A Detect and fix any errorB Detect one flipped bit but not fix itC Detect two flipped bits
B. Detect one flipped bit but not fix it
- Last unit
Which of these is lossy?
A JPEGB PNGC ZIP
A. JPEG
- Earlier this unit
ARQ stands for…
A Average rate queryB Automatic repeat requestC Address resolution question
B. Automatic repeat request
Year 10 · Computer Science · Data transmission and Boolean logic · Lesson 5 of 5
Key words (1 of 4)
- Boolean logic
- Logic that uses only two values, 1 (true, on) and 0 (false, off).
- Logic gate
- An electronic component that takes one or two inputs and gives one output by a fixed rule.
- Truth table
- A table that lists every possible input combination and the output for each one.
- Logic circuit
- Two or more logic gates joined together to give one output.
Year 10 · Computer Science · Data transmission and Boolean logic · Lesson 5 of 5
Key words (2 of 4)
- Logic expression
- A written description of a circuit using gate names, such as X = A AND NOT B.
- NOT
- A one-input gate whose output is the opposite of its input; also called an inverter.
- AND
- A gate whose output is 1 only when both inputs are 1.
- OR
- A gate whose output is 1 when at least one input is 1.
Year 10 · Computer Science · Data transmission and Boolean logic · Lesson 5 of 5
Key words (3 of 4)
- NAND
- NOT AND: the output is 0 only when both inputs are 1.
- NOR
- NOT OR: the output is 1 only when both inputs are 0.
- XOR (EOR)
- Exclusive OR: the output is 1 when the two inputs are different.
- Input
- A signal going into a gate or circuit, such as a sensor reading of 1 or 0.
Year 10 · Computer Science · Data transmission and Boolean logic · Lesson 5 of 5
Key words (4 of 4)
- Output
- The single result signal that comes out of a gate or circuit.
- Working column
- An extra truth-table column holding the output of one gate inside a circuit.
- Sum of products
- An expression made by AND-ing the inputs of each row with output 1, then OR-ing those groups together.
10.1 The six logic gates · The explanation · step 1 of 13 · part 1 of 2
1 and 0: the language of logic
Boolean logic works with only two values: 1 and 0. 1 means on, true or yes. 0 means off, false or no.
A logic gate is a tiny electronic switch inside a chip. It takes one or two inputs and gives one output.
A truth table lists every possible input combination and the output for each one. It is the full description of what a gate or circuit does.
10.1 The six logic gates · The explanation · step 1 of 13 · part 2 of 2
1 and 0: the language of logic (continued)
Computers use 1 and 0 because an electric signal is easy to read as two states, high voltage or low voltage. Two states leave little room for error.
10.1 The six logic gates · The explanation · step 2 of 13 · part 1 of 2
NOT gate: flips the input
NOT has one input. The output is the opposite of the input.
Input 1 gives output 0. Input 0 gives output 1. It is also called an inverter.
Symbol: a triangle with a small circle at the tip. The small circle always means "flip it".
| A | Q = NOT A |
|---|---|
| 0 | 1 |
| 1 | 0 |
10.1 The six logic gates · The explanation · step 2 of 13 · part 2 of 2
NOT gate: flips the input (continued)
10.1 The six logic gates · The explanation · step 3 of 13 · part 1 of 2
AND and OR
AND: the output is 1 only when input A and input B are both 1. Think of two switches in a row: both must be closed for the bulb to light.
OR: the output is 1 when A or B is 1, or both are. Think of two switches side by side: either one lights the bulb.
AND has a flat back and a round front. OR has a curved back and a pointed front.
10.1 The six logic gates · The explanation · step 3 of 13 · part 2 of 2
AND and OR (continued)
| A | B | A AND B | A OR B |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 |
10.1 The six logic gates · The explanation · step 4 of 13 · part 1 of 3
NAND and NOR: AND and OR, then flipped
NAND means NOT AND. Work out AND, then flip the answer. The output is 0 only when both inputs are 1.
NOR means NOT OR. Work out OR, then flip the answer. The output is 1 only when both inputs are 0.
Their symbols are the AND and OR symbols with the small "flip" circle on the output.
10.1 The six logic gates · The explanation · step 4 of 13 · part 2 of 3
NAND and NOR: AND and OR, then flipped (continued)
| A | B | A NAND B | A NOR B |
|---|---|---|---|
| 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |
Put the NAND column next to the AND column and every value is flipped. The same is true for NOR and OR. This is a quick way to check your table.
10.1 The six logic gates · The explanation · step 4 of 13 · part 3 of 3
NAND and NOR: AND and OR, then flipped (continued)
NAND is not "NOT A AND NOT B". You do the AND first, then flip the single answer.
10.1 The six logic gates · The explanation · step 5 of 13 · part 1 of 3
XOR: one or the other, not both
XOR (exclusive OR, also written EOR) gives 1 when the inputs are different.
If both inputs are the same, both 0 or both 1, the output is 0.
Symbol: the OR symbol with an extra curved line behind it.
10.1 The six logic gates · The explanation · step 5 of 13 · part 2 of 3
XOR: one or the other, not both (continued)
| A | B | A XOR B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
10.1 The six logic gates · The explanation · step 5 of 13 · part 3 of 3
XOR: one or the other, not both (continued)
OR and XOR only differ in the last row. When A = 1 and B = 1, OR gives 1 but XOR gives 0.
The explanation · 8 more steps
More on the lesson page
The lesson page has the rest of the explanation, step by step:
- All six symbols together
- How many rows?
- Filling in the inputs: count in binary
- Working columns for a 3-input circuit
- From a statement to an expression
- From an expression to a circuit
- From a circuit to an expression
- From a truth table to an expression
Year 10 · Computer Science · Data transmission and Boolean logic · Lesson 5 of 5
Try it: Play with logic gates
Year 10 · Computer Science · Data transmission and Boolean logic · Lesson 5 of 5
The maths: Rows in a truth table
Symbols first, then the words, then the equation. Change the numbers.
Year 10 · Computer Science · Data transmission and Boolean logic · Lesson 5 of 5
The maths: Logic gates as arithmetic
Symbols first, then the words, then the equation. Change the numbers.
Year 10 · Computer Science · Data transmission and Boolean logic · Lesson 5 of 5
Quick quiz · 1 of 3
XOR gives 1 when…
- A Exactly one input is 1
- B Neither input is 1
- C Both inputs are 1
A. Exactly one input is 1
Exclusive OR: one or the other, not both.
Year 10 · Computer Science · Data transmission and Boolean logic · Lesson 5 of 5
Quick quiz · 2 of 3
A truth table for 3 inputs has…
- A 6 rows
- B 8 rows
- C 3 rows
B. 8 rows
2 to the power of 3 combinations.
Year 10 · Computer Science · Data transmission and Boolean logic · Lesson 5 of 5
Quick quiz · 3 of 3
NAND is…
- A AND followed by NOT
- B NOT followed by AND
- C OR followed by NOT
A. AND followed by NOT
Not-AND: the opposite output of AND.
Year 10 · Computer Science · Data transmission and Boolean logic · Lesson 5 of 5
Exit ticket
Answer on paper before you go. Then check.
With A = 1 and B = 1, A OR B is…
A 1B 0C 2
A. 1 OR is true when at least one input is 1, including both.
X = (A AND B) OR C with A = 0, B = 1, C = 1 gives…
A 0B 1C Cannot tell
B. 1 A AND B = 0. Then 0 OR 1 = 1.
Year 10 · Computer Science · Data transmission and Boolean logic · Lesson 5 of 5
Homework and the challenge
Homework
The CS 2 and CS 10 quizzes; the logic gates study page to the quiz.
End-of-unit challenge
End-of-unit test: past-paper questions on topics 2 and 10.