Computer Science Essentials, Unit 10, Lesson 1 of 3

Logic gates and truth tables

GCSE Computer Science, Boolean logic, 20 minutes

Sign in

AND, OR, NOT and XOR: their symbols, their truth tables and the different ways boards write them.

What you will learn

  • Draw and recognise the four gates
  • Complete a truth table for each
  • Read AND, OR and NOT in words, symbols and dot-plus notation

Four gates

Inside a computer, every decision is built from logic gates.

Each input and output is 1 (true, on) or 0 (false, off).

ABA AND BA OR BA XOR B
00000
01011
10011
11110
  • AND: 1 only when both inputs are 1.
  • OR: 1 when at least one input is 1.
  • XOR (exclusive OR): 1 when the inputs are different. (AQA and Edexcel use XOR; OCR GCSE uses AND, OR and NOT.)
  • NOT: one input, flipped.
  • NAND (NOT AND) is an AND gate followed by a NOT: its output is 0 only when both inputs are 1. NOR (NOT OR) is an OR gate followed by a NOT: its output is 1 only when both inputs are 0. They are drawn as AND and OR with a small circle on the output.

A truth table lists every combination of inputs: n inputs need 2^n rows, counting up in binary: 1 input needs 2 rows, 2 inputs 4 rows, 3 inputs 8 rows, 4 inputs 16 rows. A single gate always gives 0 or 1; its output depends only on its inputs.

The rest of this lesson and its 7 practice questions are locked.

In this lesson

  1. Four gates
  2. Symbols and notation
  3. Try it: Fill in a truth table

7 practice questions, marked as you go; about 20 minutes in all.

Key terms

Logic gates, XOR, NAND, NOR

In this unit: Boolean logic

AND, OR, NOT and XOR gates, truth tables, expressions and circuits, built by hand in an interactive gate builder and used to describe real systems.

All of Boolean logic