← IGCSE Computer Science Paper 2

Writing a logic expression from a logic circuit: several gates

Write each gate's expression from left to right, putting each earlier gate in brackets as an input to the next gate. The final gate is the outermost operator.

Understanding Writing a logic expression from a logic circuit: several gates in IGCSE Computer Science Paper 2

What it does: The OR gate comes first, so (A OR B) goes in brackets and acts as one input to the final AND gate. placeholder. Labelling each gate output lets you write one gate at a time, such as D = A AND B. Then you substitute (A AND B) into the next gate as an input, for example X = D OR C. The bracket holds the earlier AND gate, which feeds the final OR gate as one of its inputs. The final gate is the outermost operator. Without brackets the order of the gates is not shown, so the expression does not match the circuit.

Common mistakes: The first gate is an AND gate, so P = A AND B. Writing OR here makes the final expression (A AND B) OR C impossible. The final expression uses (A OR B), so the first gate must be P = A OR B, not AND.

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 562–580) 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
A circuit has an AND gate (inputs A and B) whose output goes into an OR gate with input C. Which expression is correct?
X = A AND (B OR C)X = (A AND B) OR C
Matches
X = A AND B OR C
↓
The brackets are missing, so it is unclear which gate comes first. An AND gate feeding an OR gate with C should be written X = (A AND B) OR C.
Applying
Meanings
Term
X = (A AND B) OR C
Meaning
Write each gate's expression from left to right, putting each earlier gate in brackets as an input to the next gate. The final gate is the outermost operator.
Practice
X = (A AND B) OR (NOT C)
Testing
Gaps
X = (A AND B) C
Check Answer
Spots
1AND(A,B) then OR with C
2P = A OR B

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

The 'Sea Dragon' badge — OOP Pioneer, 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. A circuit has an AND gate (inputs A and B) whose output goes into an OR gate with input C. Which expression is correct?
A. X = (A AND B) OR C ✓
B. X = A AND (B OR C)
The AND gate comes first, so its expression goes in brackets as an input to the OR gate. The OR gate is the final gate, so it is the outermost operator.
2. When writing an expression for a multi-gate circuit, which gate's operator is the outermost one?
A. The final gate, the one that gives output X ✓
B. The first gate on the left, next to the inputs
The final gate produces X, so its operator is written outside the brackets. Earlier gates go inside brackets as its inputs.
3. In which order do you build up the expression for a circuit?
A. Right to left, starting with the gate that gives X
B. Left to right, starting with the gates next to the inputs ✓
Write each gate from left to right. Put each earlier gate's expression in brackets as an input to the next gate.
4. A NOR gate (inputs A and B) feeds one input of an AND gate. The other AND input is C. Which expression is correct?
A. X = (A AND B) NOR C
B. X = (A NOR B) AND C ✓
The NOR gate is the earlier gate, so it goes in brackets. The AND gate is the final gate and is the outermost operator.
5. An OR gate (inputs A and B) feeds an AND gate along with input C. What is the correct expression?
A. X = (A OR B) AND C ✓
B. X = A OR B AND C
The brackets show that A OR B is worked out first and then used as an input to the AND gate. Without brackets, the order is not clear.

Match the Pairs

X = (A AND B) OR C → An AND gate takes A and B. Its output goes into an OR gate with C. The OR gate is the final gate that gives X.
X = (A OR B) AND (B NOT C) → Not valid
Each earlier gate's expression goes in brackets as an input to the next gate → X = (A OR B) AND C
The final gate in the circuit is the outermost operator in the expression → X = NOT (A AND B) OR C
X = A AND B OR C → The brackets are missing, so it is unclear which gate comes first. An AND gate feeding an OR gate with C should be written X = (A AND B) OR C.
X = (A AND B) OR (C NOR A) → placeholder

Key Term

X = (A AND B) OR C
Write each gate's expression from left to right, putting each earlier gate in brackets as an input to the next gate. The final gate is the outermost operator.

Fill in the Blanks

1. X = (A AND B) OR C
Hint: Type the final gate's operator, the outermost one that joins the bracketed gate to input C.
2. P = A AND B X = P OR C
Hint: Type the label given to the output of the first gate, which feeds into the next gate.
3. X = (A OR B) AND NOT C
Hint: Type the gate that acts on input C before its result reaches the final gate.
4. X = (A AND B) OR (B AND C)
Hint: Type the third input letter that enters the second AND gate.
5. P = A OR B Q = NOT C X = P AND Q
Hint: Type the operator of the last gate, which combines the two earlier gate outputs.

Spot the Error

Question 1
A AND(A,B) then OR with C
B P = A OR B
C X = P OR C
D X = (A AND B) OR C
Line B — The first gate is an AND gate, so P = A AND B. Writing OR here makes the final expression (A AND B) OR C impossible.
Question 2
A P = A AND B
B Q = NOT C
C X = P AND Q
D X = (A OR B) AND (NOT C)
Line A — The final expression uses (A OR B), so the first gate must be P = A OR B, not AND.
Question 3
A G1 = A AND B
B G2 = G1 OR C
C X = A AND B OR C
Line C — The first gate's expression must go in brackets as an input to the next gate. It should be X = (A AND B) OR C.
Question 4
A P = NOT B
B Q = P AND B
C X = (NOT A) AND B
D X = Q
Line A — The NOT gate is on input A, so P = NOT A. The final expression (NOT A) AND B shows this.
Question 5
A Gate 1: B AND C gives P
B Gate 2: A OR P gives X
C X = (A OR B) AND C
Line C — The AND gate (B AND C) is the earlier gate, so it goes in brackets as an input to the final OR gate. It should be X = A OR (B AND C).

Student with a class code? Join your class →