Kramizo
Log inSign up free
HomeCIE IGCSE Computer ScienceLogic gates and logic circuits (AND, OR, NOT, NAND, NOR, XOR) and truth tables
CIE · IGCSE · Computer Science · Revision Notes

Logic gates and logic circuits (AND, OR, NOT, NAND, NOR, XOR) and truth tables

2,305 words · Last updated May 2026

Ready to practise? Test yourself on Logic gates and logic circuits (AND, OR, NOT, NAND, NOR, XOR) and truth tables with instantly-marked questions.
Practice now →

What you'll learn

Logic gates form the fundamental building blocks of all digital circuits and computer processors. This topic covers the six essential logic gates tested in CIE IGCSE Computer Science: AND, OR, NOT, NAND, NOR, and XOR. You will learn to identify gate symbols, complete truth tables, interpret logic circuit diagrams, and combine gates to create more complex circuits that perform specific logical operations.

Key terms and definitions

Logic gate — An electronic component that performs a Boolean operation on one or more binary inputs to produce a single binary output.

Truth table — A table showing all possible input combinations for a logic gate or circuit, alongside the corresponding output values.

Binary — A number system using only two digits: 0 (representing false/off) and 1 (representing true/on).

Boolean expression — A mathematical notation using Boolean operators (AND, OR, NOT) to represent the logic performed by a circuit, such as Q = A AND B.

Logic circuit — A combination of two or more logic gates connected together to perform a more complex logical operation.

Input — A binary value (0 or 1) fed into a logic gate or circuit.

Output — The binary result (0 or 1) produced by a logic gate or circuit after processing its inputs.

Inverter — Another name for a NOT gate, which reverses the input value.

Core concepts

The six logic gates and their truth tables

NOT gate (inverter)

The NOT gate has one input and one output. It inverts the input value: if the input is 1, the output is 0, and vice versa.

Symbol: A triangle with a small circle (bubble) at the output end.

Truth table:

Input A Output Q
0 1
1 0

Boolean expression: Q = NOT A (also written as Q = Ā or Q = ¬A)

AND gate

The AND gate has two or more inputs and one output. The output is 1 only when all inputs are 1.

Symbol: A D-shaped gate with a flat input side.

Truth table:

Input A Input B Output Q
0 0 0
0 1 0
1 0 0
1 1 1

Boolean expression: Q = A AND B (also written as Q = A · B or Q = A ∧ B)

OR gate

The OR gate has two or more inputs and one output. The output is 1 when at least one input is 1.

Symbol: A curved gate with a pointed output end.

Truth table:

Input A Input B Output Q
0 0 0
0 1 1
1 0 1
1 1 1

Boolean expression: Q = A OR B (also written as Q = A + B or Q = A ∨ B)

NAND gate

The NAND gate (NOT-AND) has two or more inputs and one output. It produces the opposite output to an AND gate: the output is 0 only when all inputs are 1.

Symbol: An AND gate symbol with a small circle (bubble) at the output.

Truth table:

Input A Input B Output Q
0 0 1
0 1 1
1 0 1
1 1 0

Boolean expression: Q = NOT (A AND B) (also written as Q = NAND(A,B))

Key fact: NAND gates are called "universal gates" because any other logic gate can be constructed using only NAND gates.

NOR gate

The NOR gate (NOT-OR) has two or more inputs and one output. It produces the opposite output to an OR gate: the output is 1 only when all inputs are 0.

Symbol: An OR gate symbol with a small circle (bubble) at the output.

Truth table:

Input A Input B Output Q
0 0 1
0 1 0
1 0 0
1 1 0

Boolean expression: Q = NOT (A OR B) (also written as Q = NOR(A,B))

Key fact: NOR gates are also "universal gates" — any logic gate can be built using only NOR gates.

XOR gate (Exclusive OR)

The XOR gate has two inputs and one output. The output is 1 when the inputs are different (one is 1 and the other is 0).

Symbol: An OR gate symbol with an additional curved line on the input side.

Truth table:

Input A Input B Output Q
0 0 0
0 1 1
1 0 1
1 1 0

Boolean expression: Q = A XOR B (also written as Q = A ⊕ B)

Key fact: XOR gates are used in binary addition circuits and error detection systems.

Reading and drawing logic circuit diagrams

Logic circuits combine multiple gates to perform complex operations. When reading circuit diagrams:

  • Identify inputs: Typically labelled with letters (A, B, C) on the left side
  • Follow signal flow: Signals flow from left to right through the circuit
  • Trace each path: Follow each input through intermediate gates to the final output
  • Label intermediate outputs: It helps to label the output of each gate when working through complex circuits

Example circuit components:

  • Connecting lines show how outputs from one gate become inputs to another
  • A junction (dot) where lines meet indicates the signal splits to multiple gates
  • Lines crossing without a dot are not connected
  • The final output is typically labelled Q or Output on the right side

Completing truth tables for logic circuits

To complete a truth table for a logic circuit:

  1. List all input combinations: For n inputs, create 2ⁿ rows (2 inputs = 4 rows, 3 inputs = 8 rows)
  2. Add columns for intermediate outputs: Create a column for each gate's output in the circuit
  3. Work left to right: Calculate each gate's output based on its inputs, working through the circuit systematically
  4. Complete the final output column: The rightmost gate's output becomes the circuit's final output

Standard input pattern for 3 inputs (A, B, C):

A B C
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

This systematic pattern ensures all possibilities are covered: the rightmost input alternates every row (0,1,0,1...), the middle input alternates every 2 rows (0,0,1,1,0,0,1,1...), and the leftmost alternates every 4 rows.

Combining logic gates

Complex circuits combine multiple gates to achieve specific outcomes:

Common combinations:

  • AND followed by NOT creates NAND: The output is inverted after the AND operation
  • OR followed by NOT creates NOR: The output is inverted after the OR operation
  • Parallel gates feeding into another gate: Multiple gates process inputs separately, then combine results
  • Series gates: The output of one gate becomes the input to the next

Understanding these combinations allows you to:

  • Simplify complex circuits
  • Identify equivalent circuits with different gate arrangements
  • Design circuits to meet specific requirements

Practical applications

Logic gates and circuits have real-world applications:

Computer processors: Billions of logic gates perform calculations and control operations.

Memory circuits: Combinations of gates store binary data in RAM and cache.

Security systems: Logic circuits control access based on multiple conditions (e.g., correct PIN AND valid card).

Automated systems: Industrial control systems use logic gates to make decisions (e.g., if temperature is high OR pressure is low, then activate alarm).

Binary arithmetic: Special circuits called adders use XOR, AND, and OR gates to perform binary addition.

Worked examples

Example 1: Complete the truth table

Question: Complete the truth table for the following logic circuit:

A ----\
       AND ---- Q
B ----/

Solution:

A B Q
0 0 0
0 1 0
1 0 0
1 1 1

Explanation: This is a single AND gate. The output Q is 1 only when both A AND B are 1. (1 mark for each correct output value, 4 marks total)

Example 2: Multi-gate circuit truth table

Question: Complete the truth table for this logic circuit:

A ----\
       AND ----\
B ----/          \
                  OR ---- Q
C ---------------/

Solution:

A B A AND B C Q
0 0 0 0 0
0 0 0 1 1
0 1 0 0 0
0 1 0 1 1
1 0 0 0 0
1 0 0 1 1
1 1 1 0 1
1 1 1 1 1

Explanation:

  • First, calculate A AND B for each row (intermediate column)
  • Then, calculate (A AND B) OR C to find Q
  • Q is 1 when either (A AND B) is 1, or C is 1, or both (1 mark for intermediate column, 1 mark for each correct final output, 9 marks total)

Example 3: Identifying gate types from truth tables

Question: Identify which logic gate produces this truth table:

A B Q
0 0 1
0 1 0
1 0 0
1 1 0

Solution: NOR gate

Explanation: The output is 1 only when both inputs are 0. This is the characteristic behavior of a NOR gate, which outputs 1 when neither input is 1. (2 marks: 1 for correct identification, 1 for explanation)

Example 4: Drawing a logic circuit

Question: Draw a logic circuit for the Boolean expression: Q = (A AND B) OR (NOT C)

Solution:

A ----\
       AND ----\
B ----/          \
                  OR ---- Q
C ---- NOT ------/

Explanation:

  • A and B feed into an AND gate
  • C passes through a NOT gate
  • Both outputs feed into an OR gate to produce Q (1 mark for AND gate correctly connected, 1 mark for NOT gate, 1 mark for OR gate, 1 mark for correct final connection, 4 marks total)

Common mistakes and how to avoid them

  • Confusing NAND and NOR outputs: Remember that NAND outputs 0 only when all inputs are 1, while NOR outputs 1 only when all inputs are 0. The bubble on the output indicates inversion of AND or OR respectively.

  • Incomplete truth tables: For 3 inputs, you need 8 rows (2³). For 2 inputs, you need 4 rows (2²). Always use the systematic pattern (rightmost input alternates every row) to ensure you haven't missed combinations.

  • Not showing intermediate steps: In multi-gate circuits, add columns for intermediate gate outputs. This prevents errors and shows your working, earning method marks even if the final answer is incorrect.

  • Misreading circuit connections: Lines crossing without a dot are NOT connected. Only lines meeting at a junction (dot) are connected. Trace each path carefully.

  • Drawing incorrect gate symbols: Learn the standard symbols. An AND gate is D-shaped; an OR gate is curved with a pointed output. The bubble (small circle) always indicates inversion (NOT).

  • XOR confusion: XOR outputs 1 when inputs are different, not when both are 1. It's "exclusive" OR — one or the other, but not both.

Exam technique for "Logic gates and logic circuits (AND, OR, NOT, NAND, NOR, XOR) and truth tables"

  • "Complete the truth table" questions (4-8 marks): Show your working by adding intermediate columns for multi-gate circuits. Write clearly — examiners cannot award marks for ambiguous 0s and 1s. Check you have 2ⁿ rows for n inputs.

  • "Draw a logic circuit" questions (3-5 marks): Use standard gate symbols accurately. Label inputs and outputs clearly. Ensure connecting lines are unambiguous — use dots at junctions. Verify your circuit matches the given Boolean expression or truth table by tracing through one example.

  • "Identify the gate" questions (1-2 marks): If given a truth table, focus on the characteristic row: AND has all 1s giving 1; OR has all 0s giving 0; XOR has different inputs giving 1. State the gate name clearly.

  • Command word "Describe": Explain how the circuit works, stating what conditions produce a 1 output. Use precise terminology ("when both inputs are 1" not "when they're on"). Typically worth 2-3 marks.

Quick revision summary

Logic gates are electronic components performing Boolean operations on binary inputs. The six gates are NOT (inverts input), AND (1 when all inputs 1), OR (1 when any input 1), NAND (0 when all inputs 1), NOR (1 when all inputs 0), and XOR (1 when inputs differ). Truth tables show all input combinations and corresponding outputs. For n inputs, create 2ⁿ rows. Logic circuits combine multiple gates; complete truth tables systematically by calculating intermediate outputs. Remember gate symbols: D-shape for AND, curved for OR, bubble for inversion.

Free for IGCSE students

Lock in Logic gates and logic circuits (AND, OR, NOT, NAND, NOR, XOR) and truth tables with real exam questions.

Free instantly-marked CIE IGCSE Computer Science practice — 45 questions a day, no card required.

Try a question →See practice bank