Home / Blog / Trace tables

Algorithms

How to Complete a Trace Table Step by Step

Use this repeatable method to follow an algorithm carefully, record changes in the right place and avoid losing marks through rushed working.

1. Prepare Before You Trace

Read the whole algorithm once without writing anything. Identify every variable, the initial values, the loop condition and any output. If the question provides a table, use its headings exactly. If you must create one, give each variable its own column and include an output column when the program displays a value.

2. Follow One Instruction at a Time

Start with the first executable instruction. When an assignment changes a variable, calculate the new value and record it. When a condition is tested, decide whether it is true or false using the values that exist at that moment. For a loop, return to the condition after the loop body has run.

A useful habit is to point to the current line of code with a pen or cursor. Do not jump ahead because you think you know the outcome.

3. A Small Worked Example

total = 0
for number = 1 to 3
    total = total + number
next number
print(total)
numbertotaloutput
11
23
36
6

The value of total accumulates: it becomes 1, then 3, then 6. The output is recorded only when the print instruction runs.

4. Check the Mistakes Students Often Make

  • Using the old value after an assignment has changed it.
  • Recording every variable on every row when the question expects only changes.
  • Missing the final loop test or running the loop once too many times.
  • Putting a value in the output column before the output instruction runs.
  • Doing calculations mentally and skipping the written trace.

5. Trace Selection Carefully

When an algorithm contains an if statement, evaluate the condition using the current values. Follow only the branch selected by that result. Do not execute both branches. If the table includes a condition column, record true or false in the format requested.

age = 15
if age >= 16 then
    price = 8
else
    price = 5
endif

The condition is false, so only the else branch runs and price becomes 5.

6. Know When a Loop Stops

For a condition-controlled loop, write the condition test explicitly. Ask whether it is checked before or after the body. Update the variables inside the loop, then return to the test. A final false test may need to be shown if the question’s table records condition results.

7. Use a Final Accuracy Check

  • Do the first and last loop values make sense?
  • Was each assignment calculated using the latest values?
  • Does output appear only when an output instruction runs?
  • Were both branches of a selection accidentally followed?
  • Can each row be linked to a specific instruction?

If the answer to one of these questions is no, return to the first uncertain row rather than rebuilding the entire table.

Keep Practising

Download the free Trace Tables Made Easy booklet for worked practice. Students who need help connecting tracing to programming can also explore Python programming support or GCSE Computer Science tuition.