Skip to content

Boolean logic and logic gates: GCSE Computer Science revision notes

AND: the output is 1 only if both inputs are 1. OR: the output is 1 if at least one input is 1.

In short

AND: the output is 1 only if both inputs are 1. OR: the output is 1 if at least one input is 1. NOT: the output is the opposite of the input.

For GCSE students in Years 10 and 11, on the AQA, OCR, Edexcel, Eduqas, Edexcel IGCSE and Cambridge IGCSE Computer Science courses.

Logic gates

  • AND: the output is 1 only if both inputs are 1.
  • OR: the output is 1 if at least one input is 1.
  • NOT: the output is the opposite of the input.
  • XOR: the output is 1 if the two inputs are different.

Truth tables

  • A truth table shows the output for every combination of inputs. 2 inputs give 4 rows; 3 inputs give 8 rows (2ⁿ rows for n inputs).
  • AND: 0 0 → 0, 0 1 → 0, 1 0 → 0, 1 1 → 1. OR: 0 0 → 0, 0 1 → 1, 1 0 → 1, 1 1 → 1. NOT: 0 → 1, 1 → 0.

Logic circuits and expressions

  • Gates can be joined into circuits. P = NOT (A AND B) is 0 only when A and B are both 1.
  • Work through a circuit one gate at a time, adding a column to the truth table for each gate's output.
  • Expressions may use symbols. OCR writes AND as ∧, OR as ∨ and NOT as ¬. AQA writes A AND B as A·B, A OR B as A + B, and NOT A as A with a bar over it.

Using logic

  • Logic is used in program conditions and in real systems. An alarm might sound if (a door is open OR a window is open) AND the alarm is set.

Key terms

Logic gate
An electronic component that carries out a Boolean operation on its inputs.
AND gate
Outputs 1 only when both inputs are 1.
OR gate
Outputs 1 when at least one input is 1.
NOT gate
Outputs the opposite of its single input.
XOR gate
Outputs 1 when the two inputs are different.
Truth table
A table showing the output for every possible combination of inputs.
Boolean expression
A statement using AND, OR and NOT that is either true or false.

Quick questions on Boolean logic and logic gates

What does an AND gate output when both inputs are 1?
1: Both inputs are 1, so the output is 1.
What does an OR gate output when the inputs are 0 and 1?
1: At least one input is 1.
What does a NOT gate do?
Outputs the opposite of its input: 1 becomes 0, and 0 becomes 1.
How many rows does a truth table for 3 inputs have?
8: 2³ = 8.
Which gate outputs 1 only when both inputs are 1?
AND: Both conditions must be true.
What is NOT (1 AND 1)?
0: 1 AND 1 = 1, and NOT 1 = 0.
What is (1 OR 0) AND 0?
0: 1 OR 0 = 1, and 1 AND 0 = 0.
An XOR gate has the inputs 1 and 1. What is the output?
0: The inputs are the same, so XOR gives 0.
An alarm sounds when it is set AND a door is open. The alarm is set, but no door is open. Does it sound?
No: 1 AND 0 = 0.
How many rows does a truth table with 2 inputs have?
4: 00, 01, 10 and 11.
What does an OR gate output when both inputs are 0?
0: Neither input is 1.

Boolean logic and logic gates: exam-style questions and mark schemes

  1. Which logic gate outputs 1 when at least one of its inputs is 1? [1 mark]

    Answer: OR

  2. Complete the truth table for P = A AND NOT B. Give P for each pair of inputs: A = 0, B = 0; A = 0, B = 1; A = 1, B = 0; A = 1, B = 1. [4 marks]

    • A = 0, B = 0: P = 0 (1)
    • A = 0, B = 1: P = 0 (1)
    • A = 1, B = 0: P = 1 (1)
    • A = 1, B = 1: P = 0 (1)
  3. A heater (H) switches on when the room is cold (C) and the timer (T) is on, or when the override switch (S) is pressed. Write a Boolean expression for H. [2 marks]

    • C AND T (1)
    • H = (C AND T) OR S (1)
  4. State the output of NOT (A OR B) when A = 1 and B = 0. Explain your answer. [2 marks]

    • A OR B = 1 (1)
    • NOT 1 = 0, so the output is 0 (1)
  5. A car alarm sounds (Q) if the alarm is set (A) and either a door is opened (B) or movement is detected (C). Write the Boolean expression, explain how the logic circuit works, and give the output for each combination when A = 1. [6 marks]

    • Q = A AND (B OR C) (1)
    • the brackets mean B OR C is worked out first (1)
    • an OR gate takes B and C, and its output goes into an AND gate with A (1)
    • A = 1, B = 0, C = 0 gives Q = 0 (1)
    • A = 1, B = 0, C = 1 gives Q = 1 (1)
    • A = 1, B = 1, C = 0 gives Q = 1 (1)
    • A = 1, B = 1, C = 1 gives Q = 1 (1)
    • when A = 0, Q is always 0 (1)

How to answer them: exam technique and command words.

Boolean logic and logic gates: questions and answers

An alarm sounds when it is set AND a door is open. The alarm is set, but no door is open. Does it sound?
No. 1 AND 0 = 0.
How many rows does a truth table with 2 inputs have?
4. 00, 01, 10 and 11.
What does an OR gate output when both inputs are 0?
0. Neither input is 1.

Practise Boolean logic and logic gates: 11 questions

Download these notes as a PDF

Previous topic: Data compressionNext topic: Systems software and operating systems

More in Computer systems

LycoLearn is still loading…

This can take a little longer on a busy school or home network. If nothing happens, try refreshing the page.

LycoLearn didn’t load properly

Part of it didn’t arrive. Try refreshing the page in a minute, or open LycoLearn in another browser.