Checking a trace against the real program output
Run the code with the same input you traced, then compare. If the real output differs from your trace, either the trace or the code has a mistake, so re-trace.
Understanding Checking a trace against the real program output in ACARA Digital Technologies Years 9–10
What it does: A matching trace and output means they agree for this input, which supports the trace and the code. A mismatch means re-tracing line by line to find the first point where your values and the program's values differ. A match only shows agreement for that one input. It does not prove the program works for all inputs, which is why you test a range of data. The code correctly adds 3 + 4 to get 7. Your hand calculation was wrong, so you fix the trace and not the program. Trace first so you predict the output independently. Changing the trace to fit the output hides mistakes instead of finding them.
Common mistakes: The trace gave 12, which comes from multiplying 4 by 3. The code adds instead, so the real output is 7 and does not match the trace. The line should be total = x * 3. The trace shows total building up to 12. This line replaces total each time, so the real output is 6 and does not match the trace. It should add: total = total + n.
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 536–590) and word search (Modules 536–622).
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
trace vs outputFill in the Blanks
Spot the Error
Student with a class code? Join your class →