← IGCSE Computer Science Paper 2

Logic expression for a single gate

A logic expression for one gate: write the output X, an equals sign, then the input letters joined by the gate name in capitals, such as X = NOT A or X = A XOR B.

Understanding Logic expression for a single gate in IGCSE Computer Science Paper 2

What it does: The expression follows the pattern X = input gate-name input, with NAND in capitals between A and B. Gate names are written in capitals in Cambridge logic expressions, so AND not and. NOT goes before the input letter. It only has one input, so there is nothing to join. XOR is its own gate name. Writing OR describes a different gate. The output X is written first, then an equals sign, then the inputs and the gate name. NOT has one input and is written before it, as in X = NOT A, not after it.

Common mistakes: Gate names must be written in capitals. The line should be X = A AND B. A logic expression starts with the output, X, then an equals sign, then the inputs and gate. It should be X = A XOR B.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 552–561) and word search (Modules 539–580).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which is the correct logic expression for an AND gate with inputs A and B?
X = A and BX = A AND B
Matches
X = A and B
↓
The gate name is written in lower case. Gate names must be in capitals, so it should be X = A AND B.
Applying
Meanings
Term
X = A AND B
Meaning
A logic expression for one gate: write the output X, an equals sign, then the input letters joined by the gate name in capitals, such as X = NOT A or X = A XOR B.
Practice
X = A AND B
Testing
Gaps
X = A
Check Answer
Spots
1X = A and B
2X = A NAND B

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Butterfly' badge — Branch Hopper, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which is the correct logic expression for an AND gate with inputs A and B?
A. X = A AND B ✓
B. X = A and B
Gate names are written in capitals in Cambridge logic expressions, so AND not and.
2. Which is the correct logic expression for a NOT gate with input A?
A. X = A NOT
B. X = NOT A ✓
NOT goes before the input letter. It only has one input, so there is nothing to join.
3. Which expression shows an XOR gate with inputs A and B?
A. X = A OR B
B. X = A XOR B ✓
XOR is its own gate name. Writing OR describes a different gate.
4. Which expression describes a NAND gate with inputs A and B?
A. X = A NAND B ✓
B. X = NAND A B
A two-input gate name sits between the two input letters: A NAND B.
5. What does a logic expression start with?
A. The output: X = ✓
B. The inputs: A B =
The output X is written first, then an equals sign, then the inputs and the gate name.

Match the Pairs

X = A AND B → The output X is 1 only when both input A and input B are 1.
X = NOT A → The output X is the opposite of input A: 1 becomes 0 and 0 becomes 1.
A NAND gate with inputs A and B is written with the output X, an equals sign and the gate name in capitals between the inputs. → X = A NAND B
An XOR gate with inputs A and B is written with the gate name XOR in capitals between the input letters. → X = A XOR B
X = A and B → The gate name is written in lower case. Gate names must be in capitals, so it should be X = A AND B.
X = A NOT → NOT is placed after the input letter. NOT goes before the input it applies to, so it should be X = NOT A.

Key Term

X = A AND B
A logic expression for one gate: write the output X, an equals sign, then the input letters joined by the gate name in capitals, such as X = NOT A or X = A XOR B.

Fill in the Blanks

1. X = NOT A
Hint: Type the gate name, in capitals, that inverts a single input.
2. X = A AND B
Hint: Type the gate name, in capitals, that gives 1 only when both inputs are 1.
3. X = A NAND B
Hint: Type the gate name, in capitals, that gives the reverse output of the gate that needs both inputs to be 1.
4. X = A XOR B
Hint: Type the gate name, in capitals, that gives 1 when the two inputs are different.
5. X = A NAND B
Hint: Type the letter used for the output of the gate.

Spot the Error

Question 1
A X = A and B
B X = A NAND B
C X = A XOR B
D X = NOT A
Line A — Gate names must be written in capitals. The line should be X = A AND B.
Question 2
A X = NOT A
B X = A NOR B
C A XOR B = X
Line C — A logic expression starts with the output, X, then an equals sign, then the inputs and gate. It should be X = A XOR B.
Question 3
A X = A AND B
B X = A OR B
C X = A NAND B
D X = A NOT
Line D — NOT has only one input, and the gate name goes before it. It should be X = NOT A.
Question 4
A X = NOT A
B X A NAND B
C X = A XOR B
Line B — The equals sign is missing after X. The expression should be X = A NAND B.
Question 5
A Inputs A, B and output X
B X = A XOR C
C X = NOT A
Line B — This circuit only has inputs A and B, so C should not appear. The line should be X = A XOR B.

Student with a class code? Join your class →