# Logic gates

> Computer Science · CIE A-Level 9618
> Source: https://www.owlsprep.com/study/cie-9618-u3-logic-gates/

This sub-topic covers all standard 1-input and 2-input logic gates, their symbols, truth tables and core behaviour. You will learn to interpret and build simple combinational logic circuits for exam questions.

**Prerequisites:** [Basic Boolean algebra concepts](https://www.owlsprep.com/study/cie-9618-u3-boolean-algebra/)

## Learning objectives

- Identify and draw standard logic gate symbols
- Write truth tables for individual gates and combined circuits
- Explain the behaviour of universal gates (NAND/NOR)
- Recognise common applications of different gate types

## Standard Logic Gate Types

Logic gates are the basic building blocks of all digital computer hardware. Each gate takes binary inputs (0 = off/false, 1 = on/true) and produces a single binary output based on a fixed Boolean rule.

**Logic gate** — A digital circuit that performs a single Boolean logical operation on one or more binary inputs to produce one output

*Notation:* Each gate type has a unique standard circuit symbol used in all CIE exam questions

*Example:* A 2-input AND gate only outputs 1 when both of its inputs are 1

- **1-input gate**: NOT (inverter): outputs the opposite value of the input
- **2-input gates**: AND, OR, NAND, NOR, XOR, XNOR: all take two inputs and produce one output based on their rule

**Worked example:** Write the full truth table for a 2-input NAND gate, and state the output when A = 1, B = 1

1. List all four possible input combinations for two 1-bit inputs, then calculate output for each, since NAND = NOT (A AND B):
2. | A | B | Output = NOT (A AND B) |
| --- | --- | --- |
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
3. From the table, when A = 1 and B = 1, the output of the NAND gate is 0.

> **Exam tip:** CIE often asks to identify gates from their diagrams – memorise the unique shape for each of the 7 standard gate types.

## Truth Tables for Combined Logic Circuits

Most practical logic circuits combine multiple gates together. To find the output of a combined circuit for all input combinations, calculate the output of each intermediate gate step-by-step to build the full truth table.

> **tip**
>
> Always add intermediate columns to your truth table for the output of each gate in the circuit – this makes it easy for examiners to mark and avoids simple errors.

**Worked example:** A circuit has two inputs A and B: NOT A feeds one input of an OR gate, and B feeds the other input. Find the output when A=1, B=0, and write the full truth table.

1. Define intermediate output $X = \text{NOT } A$, and final output $Y = X \text{ OR } B$. Add an intermediate column for X to the truth table:
2. | A | B | X = NOT A | Y = X OR B |
| --- | --- | --- | --- |
| 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 1 |
3. When A=1 and B=0, intermediate X = 0, so Y = 0 OR 0 = 0, which matches the full truth table above.

## Universal Gates (NAND and NOR)

NAND and NOR gates are classified as universal gates because any other logic gate can be constructed using only NAND gates or only NOR gates. This simplifies manufacturing, as entire chips can be built from a single type of gate.

**Universal gate** — A gate type that can be used to construct any Boolean logic gate without requiring any other gate types

*Example:* Any logic circuit can be built using only NAND gates, no other gate types are needed

**Worked example:** Show how to construct a NOT gate using only a single 2-input NAND gate

1. Connect the single input A of the NOT gate to both input pins of the 2-input NAND gate.
2. Calculate the output of the NAND gate: $\text{Output} = \text{NOT } (A \text{ AND } A)$
3. Since $A \text{ AND } A = A$, this simplifies to $\text{Output} = \text{NOT } A$, which is exactly the behaviour of a NOT gate.

> **Exam tip:** If asked to construct a NOT gate from a NAND or NOR, always remember to connect the input to both pins of the 2-input gate.

## Common Applications of Logic Gates

Different gate types have specific common uses in digital computer hardware:

- NOT gates: Used as signal inverters to flip binary values in clock and control circuits
- XOR gates: Used as the basic building block of half adders for binary addition, and for parity checking
- NAND gates: Used to build latch circuits for static RAM (SRAM) memory modules
- NOR gates: Used to build flash memory cell circuits and basic flip-flops

**Check your understanding**

Check your understanding of core gate behaviour:

1. Which gate outputs 1 only when its two inputs are different?

   - AND
   - XOR
   - NOR
   - XNOR

   *Why:* Correct! XOR stands for exclusive OR, which outputs 1 only when its two input values differ.

## Common pitfalls

- **Wrong:** Mixing up NAND and NOR gate truth tables or symbols
  - Why it fails: NAND is NOT AND (output 0 only when all inputs 1), while NOR is NOT OR (output 0 when any input is 1)
  - Correct: Memorise: NAND outputs 1 for all combinations except 1 AND 1, NOR outputs 1 only when all inputs are 0
- **Wrong:** Skipping intermediate columns when building truth tables for multi-gate circuits
  - Why it fails: Calculating outputs in your head leads to preventable simple arithmetic errors that cost marks
  - Correct: Always add a separate column for every intermediate gate output, even for small circuits
- **Wrong:** Confusing XOR and XNOR truth tables
  - Why it fails: Students often mix up which gate outputs 1 for same vs different inputs
  - Correct: Remember XNOR is the negation of XOR: XOR = 1 when different, XNOR = 1 when same
- **Wrong:** Thinking only NAND is a universal gate
  - Why it fails: Many students forget that both NAND and NOR are universal gates
  - Correct: Both NAND and NOR are acceptable answers for a universal gate question unless specified otherwise

## Cheatsheet

| Gate Type | Inputs | Output Rule | Output when all inputs = 1 |
| --- | --- | --- | --- |
| NOT | 1 | Opposite of input | 0 |
| AND | 2 | 1 only if all inputs 1 | 1 |
| NAND | 2 | 0 only if all inputs 1 | 0 |
| OR | 2 | 1 if any input 1 | 1 |
| NOR | 2 | 1 only if all inputs 0 | 0 |
| XOR | 2 | 1 if inputs are different | 0 |
| XNOR | 2 | 1 if inputs are same | 1 |

## What's next

Logic gates are the fundamental building block of all digital hardware you will study in this unit. Mastering gate behaviour and truth tables prepares you to work with more complex combinational and sequential circuits, including adders, flip-flops and memory circuits, which are frequently tested in CIE 9618 Paper 1. It also provides the foundation for learning Boolean simplification techniques, which are used to reduce the size and cost of digital circuits. You are now ready to explore more advanced logic concepts and applications.

- [Boolean Algebra and Simplification](https://www.owlsprep.com/study/cie-9618-u3-boolean-algebra/)
- [Karnaugh Maps](https://www.owlsprep.com/study/cie-9618-u3-karnaugh-maps/)
- [Computer Architecture](https://www.owlsprep.com/study/cie-9618-u3-computer-architecture/)

---

From [OwlsPrep](https://www.owlsprep.com) — free study guides for A-Level, IB, AP and IGCSE, written against the official syllabus. Canonical page: https://www.owlsprep.com/study/cie-9618-u3-logic-gates/
