Brackets in pseudocode expressions
Brackets force the work inside to be done first, so A and B are added before dividing by 2. Without them, A + B / 2 divides B by 2 first. Use them in sums and AND/OR conditions.
Understanding Brackets in pseudocode expressions in IGCSE Computer Science Paper 2
What it does: / has higher priority than +, so B / 2 is calculated first and then A is added. This is not the average of A and B. Division is done before addition, so B / 2 = 5 first, then 6 + 5 = 11. The brackets make 6 + 10 = 16 happen first, then 16 / 2 = 8. The brackets add all three numbers before dividing by 3. Without them, only C is divided by 3. The brackets force A + B to be worked out before the division, so this correctly calculates the average of two values.
Common mistakes: Without brackets, Mark2 / 2 is done first and then added to Mark1. The addition must be done first, so it needs brackets: (Mark1 + Mark2) / 2. AND is done before OR, so this means (Vip AND Cash) OR Card. Anyone with Card would get in without being a Vip. The OR part needs brackets: Vip AND (Cash OR Card).
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 146–155) and word search (Modules 146–165).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
(A + B) / 2Fill in the Blanks
Spot the Error
Student with a class code? Join your class →