Logic gates Cambridge IGCSE Computer Science revision

Not started

Learn it

In plain words

A logic gate is a tiny electronic circuit that takes one or two binary inputs and gives one binary output, following a fixed rule. Everything a processor does is built from millions of them.

There are six to learn. Three are basic, and the other three are those with their outputs flipped or tweaked.

7 things to know

  1. NOT has one input. Its output is the opposite of its input: 0 gives 1 and 1 gives 0.
  2. AND: the output is 1 only if both inputs are 1.
  3. OR: the output is 1 if either input is 1, or both.
  4. NAND (not AND): the opposite of AND. The output is 0 only if both inputs are 1.
  5. NOR (not OR): the opposite of OR. The output is 1 only if both inputs are 0.
  6. XOR (exclusive OR): the output is 1 if the two inputs are different.
  7. A truth table lists every possible combination of inputs with the output for each. Two inputs give four rows: 00, 01, 10, 11.

Worked example

Complete the output column of the truth table for a NAND gate with inputs A and B.

  1. Work out AND first, then flip it. A AND B is 1 only when both are 1.
  2. Inputs 0, 0: AND is 0, so NAND is 1. Inputs 0, 1: AND is 0, so NAND is 1.
  3. Inputs 1, 0: AND is 0, so NAND is 1. Inputs 1, 1: AND is 1, so NAND is 0.
  4. The output column reads 1, 1, 1, 0.

Tips and tricks

  • For NAND and NOR, work out AND or OR first and then swap every 0 and 1.
  • XOR and OR differ in one row only: when both inputs are 1, OR gives 1 and XOR gives 0.
6 questions, about 2 minutes.

It lands in your notebook with its questions as flashcards.

Logic gates: 6 questions and answers

These are the quiz’s questions. Do the quiz first, then come back here for the ones that got you.

  1. When is the output of an AND gate 1?
    • when either input is 1
    • only when both inputs are 1 (the answer)
    • when both inputs are 0
    • when the inputs are different

    Both, and only both.

  2. When is the output of an OR gate 0?
    • when either input is 1
    • when both inputs are 1
    • only when both inputs are 0 (the answer)
    • never

    Any 1 on the inputs gives 1.

  3. What is the output of a NAND gate when both inputs are 1?
    • 0 (the answer)
    • 1
    • 2
    • it depends

    AND would give 1, and NAND is the opposite.

  4. What is the output of a NOR gate when both inputs are 0?
    • 0
    • 1 (the answer)
    • 2
    • it depends

    OR would give 0, and NOR is the opposite.

  5. What is the output of an XOR gate when both inputs are 1?
    • 0 (the answer)
    • 1
    • 2
    • it depends

    XOR gives 1 only when the inputs are different.

  6. How many inputs does a NOT gate have?
    • 1 (the answer)
    • 2
    • 3
    • 4

    Its output is the opposite of its single input.

Still stuck on this one?Ask in the Papermunch Discord, or help someone else who is. Discord is for ages 13 and up.Join the server

Things you can type

Or go straight to

Or browse a shelf