Tracing an IF statement
To trace an IF, work out if the condition is TRUE or FALSE for the current values, then follow only the THEN or ELSE path. Skipped statements get no row in the trace table.
Understanding Tracing an IF statement in IGCSE Computer Science Paper 2
What it does: The >= operator includes the limit, so 50 >= 50 is TRUE. With > the same value would give FALSE. The outer condition is traced first. If it is FALSE, the inner IF is never reached and gets no row. The condition is TRUE or FALSE. Follow just one path and ignore the other. Skipped statements are never run, so they leave no row in the trace table. 40 >= 50 is FALSE, so the ELSE path runs and Fail is output. Pass is never output. Only the path that is followed is traced. A skipped statement leaves no row.
Common mistakes: The text to display must be in double quotes. Without them, Pass is read as a variable name. It should be OUTPUT "Pass". Mark is 50, so the condition is TRUE and the THEN path runs. ELSE never has THEN after it. Only the IF line uses THEN. The line should be just ELSE. In the trace, ELSE is followed only when the condition is FALSE.
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 83–92) and word search (Modules 71–92).
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
IF Mark >= 50 THENFill in the Blanks
Spot the Error
Student with a class code? Join your class →