Skip to content » A Level Computer Science Home » Logic Gates

Logic Gates


Introduction Video



Truth Tables

When we are working out what possibilities exist for a particular Boolean logic structure, we can use a truth table to represent that data.

Using the previous example we can produce a simple truth table for the results.

Input Output
1 1
0 0



AND Gates

A Boolean AND gate works by the following rules:

  1. If both inputs are true, then the output will be True.
  2. Otherwise the output will be false

Scratch Example

boolean and scratch

Challenge 1 – AND Gate truth table

Can you fill out the truth table for an AND gate?

Click to check your answer


OR Gates

A Boolean OR gate works by the following logic:

  1. If either input is True, the output is True.
  2. If both inputs are True, the output is True.
  3. Otherwise the output is false.

Scratch Example

boolean or scratch

Challenge 2 – Can you work out the truth table for a Boolean OR gate?

Click to check your answer!


NOT Gate

A Boolean NOT gate simply reverses whatever input is given.

  1. If the input is True, the output is False
  2. If the input is False, the output is True

Scratch Not gate Example

scratch boolean not

Challenge 3 – Can you write a truth table for a NOT gate?

Click to check your answer!


Activity 1

Have a go at connecting up multiple logic gates to see what happens, using the simulator below. Can you work out the inputs and outputs for the following examples.

Example 1

Example 2

Example 3

Example 4


Activity 2

Activity 2 – Applying Logic Gates

Using the link below, see if you can make the following systems:

Logic Gates Application Simulator

System 1 – Fan cooling system.

If the main system switch is turned on, then the fan will operate when:

  • Every 5 seconds
  • When The manual override button is pressed.

System 2 – Basic Alarm System

Make a system where if any of the 3 sensors (use 3 switches to represent sensors) are triggered, the alarm light will flash RED.

System 3 – Advanced Alarm System

Adapt the system so that:

  • The alarm will not be triggered if the system has not been armed first (use another switch for this)
  • The alarm should alternate between flashing red and sound a siren every 1 second.

System 4 – Button operated traffic light.

Make a traffic light that starts on green, then goes to amber – red – amber – green again.

Hint – You’ll need to flip flop!