Writing a logic expression from a problem statement
Give each condition a letter (A, B, C), turn key words like AND, OR and NOT into gates, and use brackets to group parts so that X matches the wording of the statement.
Understanding Writing a logic expression from a problem statement in IGCSE Computer Science Paper 2
What it does: Each condition gets a letter. 'AND' links A and B, 'OR' links that group to C, and brackets show the grouping. 'OR' links A and B, and the machine must also be running. Brackets make sure A OR B is worked out before AND C. The key word AND means both conditions must be true, so the AND gate is used. The brackets group A and B together because the statement says either of them, and the result is then combined with C using AND. NOT applies only to condition B, as the wording says. NOT (A AND B) would invert the whole AND result instead.
Common mistakes: The statement says door OR window, so the alarm sounds when either is open. The line should use OR: X = A OR B. The alarm needs both conditions to be true, so the key word AND gives an AND gate. The line should be X = A AND B.
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.
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
X = (A AND B) OR CFill in the Blanks
Spot the Error
Student with a class code? Join your class →