Skip to content

Topic 10 · Boolean logic

The six logic gates

20 minFree preview

What is a logic gate?

A logic gate is a tiny electronic circuit that takes one or two binary inputs (0 or 1) and produces one binary output. Processors are built from billions of them.

In the exam you need six gates. NOT has one input; all the others have two inputs.

The six gates

GateOutput is 1 when…Expression
NOTthe input is 0 (it flips the input)X = NOT A
ANDboth inputs are 1X = A AND B
ORat least one input is 1X = A OR B
NANDnot both inputs are 1 (opposite of AND)X = A NAND B
NORneither input is 1 (opposite of OR)X = A NOR B
XORthe inputs are differentX = A XOR B

Try every gate in the simulator below before you look at the tables.

Truth tables for each gate

A truth table lists every possible combination of inputs and the output for each one. With two inputs there are 2 × 2 = 4 rows.

ABANDORNANDNORXOR
0000110
0101101
1001101
1111000
ANOT A
01
10

Memory tricks

  • AND is strict: everyone has to agree.
  • OR is relaxed: anyone will do.
  • N in front (NAND, NOR) means "then flip the answer". In the drawn symbol, that's the little circle on the output.
  • XOR is "one or the other, but not both".

Drawing the symbols

In the exam you must use the standard symbols (the ones in the syllabus). The key shapes: AND has a flat back and a round front (like a D); OR has a curved back and a pointed front; NOT is a triangle with a small circle; NAND and NOR are AND and OR with a small circle on the output; XOR is OR with an extra curved line behind it.

Key terms

TermMeaning
Logic gateA circuit that performs a logical operation on one or more binary inputs to give one binary output
Truth tableA table showing the output for every possible combination of inputs
Logic expressionA written statement of a circuit, e.g. X = (A AND B) OR NOT C
Try every gate
Pick a gate, then switch the inputs A and B on and off.

Quiz

Quick check: logic gates

4 questions

Enjoying this? Create a free account to save your progress and take the quizzes.