Skip to the page
Year 8 · Autumn 1 · Computer Systems

Logic gates AND, OR, NOT and truth tables

UnpluggedPresent ▶

What this lesson covers

Topic 9 Logic gates

KS3 Computing · A logic gate is a tiny circuit. Bits go in, one bit comes out, by a fixed rule. Join millions of gates and a CPU can decide things and do maths.

Computer SystemsCambridge Lower Secondary Computing 0860

You will learn to

  • Explain the rules for the AND, OR and NOT gates.
  • Complete a truth table for each gate, with every row of inputs.
  • Work out how many rows a truth table needs: 2 inputs give 4 rows, 3 inputs give 8.
  • Use the gates toy to build a two-gate circuit and predict its output.

Success criteria

  • I can say the output of AND, OR and NOT for any inputs.
  • I can complete three truth tables with no missing rows.
  • I can predict the output of a two-gate circuit before I test it.

Key words

Say each word, then read what it means. Every one is in the glossary too.

truth table
Lists every input combination and its output.
half adder
An XOR gate plus an AND gate: adds two bits.
Boolean
A value that is only True or False.
Logic gate
A tiny circuit that takes bits in and gives one bit out by a fixed rule.
Boolean expression
A rule written with AND, OR and NOT that gives True or False, like A AND NOT B.
Transistor
An electronic switch with no moving parts.

The explanation

Read it here, or open the study page below to go one step at a time with things to try.

The basic gates

A truth table lists every input and its output. 2 inputs = 2² = 4 rows.

ABA AND BA OR BA XOR B
00000
01011
10011
11110
  • NOT flips the bit: 0 → 1, 1 → 0.
  • AND: 1 only if both are 1.
  • OR: 1 if at least one is 1.
  • XOR: 1 if they're different. AQA uses it; OCR sticks to AND, OR, NOT.
e.g.Example

'You can go out if homework is done AND your room is tidy.' 'Juice OR milk' (having both still counts as true).

Combining gates

Gates feed into each other. 3 inputs = 2³ = 8 rows. Work out the middle columns first.

e.g.Example

A car alarm sounds if (alarm set) AND (door open OR window broken): ALARM = S AND (D OR W).

★Remember

To write input columns without missing a row, count 0 to 7 in binary: 000, 001, 010 … 111.

How gates do arithmetic

ABSumCarry
0000
0110
1010
1101
  • The carry column is the AND table.
  • The sum column is the XOR table.
★Remember

1 XOR + 1 AND gate = a half adder. Chain them and you can add bytes. That's all addition is inside the ALU.

Study it

Open the study page and go one step at a time.

The steps for this lesson

Try it

Build it

Check yourself

One question at a time. The reason shows after each answer.

Saved on this device.