← IGCSE Computer Science Paper 2

Brackets in logic expressions

Brackets show which gate is worked out first. Here A AND B is done first, then its result goes into OR with C. A AND (B OR C) uses the same letters but gives a different output.

Understanding Brackets in logic expressions in IGCSE Computer Science Paper 2

What it does: The innermost bracket (A AND B) is done first, then the OR bracket, and the NOT is applied last to that result. B OR C gives 1, but then 0 AND 1 gives 0. With (A AND B) OR C the same inputs would give 1. There is one gate for each operator. The letters are inputs, not gates. AND and OR are the two operators, so there are 2 gates. Brackets first: 0 AND 0 = 0. Then 0 OR 1 = 1. The brackets go around the gate that must be worked out first. Here that is A OR B, so (A OR B) AND C is correct.

Common mistakes: The inner bracket is worked out first. With A = 1 and B = 0, A AND B = 0, not 1, because AND needs both inputs to be 1. The bracket B OR C is worked out first. With B = 1 and C = 1, OR gives 1, not 0, because OR outputs 1 when at least one input is 1.

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
In (A AND B) OR C, which gate is worked out first?
OR, because it is written lastAND, because it is inside the brackets
Matches
X = A AND B OR C
↓
There are no brackets, so it is unclear which gate is worked out first. It needs brackets such as (A AND B) OR C or A AND (B OR C).
Applying
Meanings
Term
(A AND B) OR C
Meaning
Brackets show which gate is worked out first. Here A AND B is done first, then its result goes into OR with C. A AND (B OR C) uses the same letters but gives a different output.
Practice
X = (A AND B) OR C
Testing
Gaps
X = (A B) OR C
Check Answer
Spots
2X = (A AND B) OR C
3Inner bracket: A AND B = 1

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

The 'Cheetah' badge — Savannah Sprinter, 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. In (A AND B) OR C, which gate is worked out first?
A. OR, because it is written last
B. AND, because it is inside the brackets ✓
The inner brackets are always worked out first. A AND B is done first, then its result goes into the OR gate with C.
2. How many gates are in the expression (A AND B) OR C?
A. 2 gates: one AND and one OR ✓
B. 3 gates: one for each input letter
There is one gate for each operator. The letters are inputs, not gates. AND and OR are the two operators, so there are 2 gates.
3. True or false: (A AND B) OR C and A AND (B OR C) always give the same output.
A. True: they use the same letters and the same gates
B. False: moving the brackets changes which gate is done first ✓
Same letters and gates can still give different outputs. For A=0, B=0, C=1 the first gives 1 and the second gives 0.
4. A=0, B=0, C=1. What is the output of (A AND B) OR C?
A. 1 ✓
B. 0
Brackets first: 0 AND 0 = 0. Then 0 OR 1 = 1.
5. A=0, B=0, C=1. What is the output of A AND (B OR C)?
A. 0 ✓
B. 1
Brackets first: 0 OR 1 = 1. Then 0 AND 1 = 0. This differs from (A AND B) OR C for the same inputs.

Match the Pairs

X = (A AND B) OR C → A AND B is worked out first, then its result goes into OR with C
X = A AND (B OR C) → B OR C is worked out first, then its result goes into AND with A
Inner brackets are worked out first: A AND B, then OR with C, then the whole result is inverted by NOT → X = NOT ((A AND B) OR C)
Same letters with different brackets can give a different output: when A=0, B=0 and C=1 this expression gives 0 → X = A AND (B OR C)
X = A AND B OR C → There are no brackets, so it is unclear which gate is worked out first. It needs brackets such as (A AND B) OR C or A AND (B OR C).
X = (A AND (B OR C) → A closing bracket is missing, so the brackets do not pair up. It should be X = A AND (B OR C) or X = (A AND (B OR C)).

Key Term

(A AND B) OR C
Brackets show which gate is worked out first. Here A AND B is done first, then its result goes into OR with C. A AND (B OR C) uses the same letters but gives a different output.

Fill in the Blanks

1. X = (A AND B) OR C
Hint: Type the gate inside the brackets, which is worked out first.
2. X = A AND (B OR C)
Hint: Type the gate inside the brackets that is worked out before the AND.
3. A = 1, B = 0, C = 1 (A AND B) OR C = 1
Hint: Type the output bit: work out the bracket first, then use OR with C.
4. A = 0, B = 1, C = 1 (A AND B) OR C = 1 A AND (B OR C) = 0
Hint: Type the output bit when the brackets are moved: B OR C is done first.
5. X = (A AND B) OR C Step 1: P = A AND B Step 2: X = P OR C
Hint: Type the input that joins the bracket result P in the second gate.

Spot the Error

Question 1
A A = 1, B = 0, C = 1
B X = (A AND B) OR C
C Inner bracket: A AND B = 1
D X = 0 OR 1 = 1
Line C — The inner bracket is worked out first. With A = 1 and B = 0, A AND B = 0, not 1, because AND needs both inputs to be 1.
Question 2
A A = 0, B = 1, C = 1
B X = A AND (B OR C)
C Inner bracket B OR C = 0
D X = 0 AND 1 = 0
Line C — The bracket B OR C is worked out first. With B = 1 and C = 1, OR gives 1, not 0, because OR outputs 1 when at least one input is 1.
Question 3
A A = 1, B = 1, C = 0
B X = (A AND B) OR C
C A AND B = 1
D X = 1 OR 0 = 0
Line D — The result of the bracket (1) goes into OR with C (0). 1 OR 0 = 1, because OR outputs 1 when at least one input is 1. So X = 1, not 0.
Question 4
A X = A AND (B OR C)
B Work out B OR C first
C Then A OR the result
Line C — The expression is A AND (B OR C). After the bracket is worked out, its result goes into an AND gate with A, not an OR gate.
Question 5
A A = 1, B = 0, C = 0
B (A OR B) AND C: A OR B = 0
C then 1 AND C = 1 AND 0 = 0
Line B — The bracket is worked out first. A OR B with A = 1 and B = 0 gives 1, not 0, because OR outputs 1 when at least one input is 1.

Student with a class code? Join your class →