GCSE Computer Science, Unit 10, Lesson 1 of 3

Logic gates and truth tables

About 1 min to read, then 7 practice questions

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.

A truth table lists every combination of inputs: n inputs need 2^n rows, counting up in binary.

Symbols and notation

AND has a flat back and a round front; OR has a curved back and a pointed front; XOR is OR with an extra curve; NOT is a triangle with a small circle.

WordsOCRAQA
A AND BA ∧ BA . B
A OR BA ∨ BA + B
NOT A¬AA with a bar over it
A XOR BA ⊕ B

When you type an answer here, you can use words (AND, OR, NOT, XOR) or symbols (. + ∧ ∨ ¬ ⊕); answers are marked on their truth table.

Try it: add one gate, wire A and B into it and its output to Q, then switch the inputs.

Practise this: 7 questions, about 5 min

Answering from memory soon after reading is what makes it stick, so now is a good time.

  • XP for every question right first time
  • This lesson fills in on your course map

Sign in to keep your XP and course map.

Start practising