Logic circuits, truth tables and logic expressions Cambridge IGCSE Computer Science revision

Not started

Learn it

In plain words

Join gates together and you have a logic circuit. The same circuit can be described in three ways: as a drawing, as a truth table, and as a logic expression such as X = (A AND B) OR (NOT C). The skill is moving between the three.

5 things to know

  1. A circuit with three inputs has eight rows in its truth table. Write them in binary counting order: 000, 001, 010, 011, 100, 101, 110, 111.
  2. To complete a truth table, add a column for the output of each gate inside the circuit. Work out those columns first, then the final output.
  3. To write an expression from a circuit, start at the inputs and write down what each gate does, using brackets to keep each gate's inputs together.
  4. To draw a circuit from an expression, draw one gate for each operator, working from inside the brackets outwards.
  5. From a problem statement: "and" becomes an AND gate, "or" becomes an OR gate, and "not" becomes a NOT gate. Draw the circuit as the statement is given, without simplifying it.

Worked example

Complete the truth table for X = (A AND B) OR (NOT C).

  1. Work out A AND B for the eight rows: 0, 0, 0, 0, 0, 0, 1, 1.
  2. Work out NOT C for the eight rows: 1, 0, 1, 0, 1, 0, 1, 0.
  3. OR the two columns together, row by row.
  4. X = 1, 0, 1, 0, 1, 0, 1, 1.

Worked example

An alarm (X) sounds if the system is switched on (S) and either a door is open (D) or a window is open (W). Write the logic expression.

  1. "Either a door or a window" is D OR W.
  2. That must happen together with the system being on: S AND (D OR W).
  3. X = S AND (D OR W).

Tips and tricks

  • Use the working columns. Trying to do a three-gate circuit in your head, eight times, is how rows go wrong.
  • Brackets matter. (A AND B) OR C is a different circuit from A AND (B OR C).
6 questions, about 2 minutes.

It lands in your notebook with its questions as flashcards.

Logic circuits, truth tables and logic expressions: 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. How many rows does a truth table for a circuit with three inputs have?
    • 3
    • 6
    • 8 (the answer)
    • 9

    2 × 2 × 2 combinations of inputs.

  2. A light (X) comes on if it is dark (D) and movement is detected (M). Which expression is correct?
    • X = D OR M
    • X = D AND M (the answer)
    • X = NOT D
    • X = D XOR M

    Both conditions are needed.

  3. What is the value of (A OR B) AND (NOT C) when A = 1, B = 0 and C = 1?
    • 0 (the answer)
    • 1
    • 2
    • it cannot be worked out

    A OR B is 1, but NOT C is 0, and 1 AND 0 is 0.

  4. What is the value of (A AND B) OR C when A = 1, B = 1 and C = 0?
    • 0
    • 1 (the answer)
    • 2
    • it cannot be worked out

    A AND B is 1, and 1 OR 0 is 1.

  5. Which single gate does the expression X = NOT (A AND B) describe?
    • NOR
    • NAND (the answer)
    • XOR
    • OR

    NAND is AND followed by NOT.

  6. Which expression matches this statement: X is 1 if A is 1, or if B is 1 and C is not 1?Stretch
    • X = (A OR B) AND (NOT C)
    • X = A OR (B AND (NOT C)) (the answer)
    • X = A AND (B OR (NOT C))
    • X = NOT (A OR B) AND C

    The "or" joins A to the whole of "B and not C".

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