← Back to all guides
Academic Guides

GCSE Computer Science: Revise Trace Tables Step by Step

Revise GCSE Computer Science trace tables with a five-step method, a worked loop example, common slips and a 20-minute practice routine.

Flat illustration of a printed grid table on graph paper with a pencil, ruler, retro desk clock and potted plant on a cream background, with open space on the left.

If you have ever stared at a GCSE Computer Science algorithm question and guessed the output, you are not alone. Loops, counters and conditions change several values at once, and the head cannot hold them all. A trace table solves that by moving the work onto paper, one line of code at a time.

This guide shows you how to build a trace table, a worked example you can copy the shape of, and a short routine to practise this week.

What a trace table is for

AQA's teaching guide for GCSE Computer Science 8525 describes a trace table as a table where each column stands for a variable, a condition or an output. You run through the algorithm and simulate what a computer would do, writing down how the values change. The guide gives two main uses: working out what an algorithm does, and testing its logic for errors that are hard to spot. If you sit a different exam board, check its own specification and sample questions, as pseudocode style can differ.

Why tracing by hand beats rereading

Reading a finished solution feels productive, but it is easy to nod along without checking that you could do it yourself. The Institute of Education Sciences practice guide on organising study recommends alternating worked example solutions with problems you attempt on your own, and rates the evidence for this as moderate. Trace tables suit that approach well: study one traced example, then trace a new algorithm without help.

The five-step method

  1. Read the whole algorithm once and note every variable that appears. Include any counter, total or flag.
  2. Draw the columns in the order each variable is first met. Add one column for each condition you need to check and one for OUTPUT.
  3. Fill in the starting values before any loop begins.
  4. Move down the code one line at a time. Each time a value changes, write the new value in a new row, and never in a cell above.
  5. Stop exactly when the loop condition says stop. Do not fill the table because you think you know where it ends.

Step five is where many marks are lost. AQA's guide lists auto-completing rows without checking when values should stop changing as a common mistake, such as carrying on to the end of a list after a break has already ended the loop. It also reminds you that time flows left to right and top to bottom, so a value you need is the latest one you wrote, found by looking back up the column.

A worked example

Here is a short algorithm written in the style of exam pseudocode. It adds up the even numbers between 1 and 6.

total ← 0

FOR i ← 1 TO 6

IF i MOD 2 = 0 THEN

total ← total + i

ENDIF

ENDFOR

OUTPUT total

The variables are total and i, and the condition is i MOD 2 = 0. Remember that MOD gives the remainder after division, so a remainder of 0 means the number is even. Start with total as 0, then work through each value of i.

  • Row: start, total = 0
  • Row: i = 1, condition False, total = 0
  • Row: i = 2, condition True, total = 2
  • Row: i = 3, condition False, total = 2
  • Row: i = 4, condition True, total = 6
  • Row: i = 5, condition False, total = 6
  • Row: i = 6, condition True, total = 12
  • Row: after the loop, OUTPUT 12

Check the logic as you go. Total only changes on rows where the condition is true, and the output appears once, after the loop has finished. The answer is 12, which you can confirm quickly: 2 plus 4 plus 6. That final sanity check is a good habit whenever the numbers are small enough to add by hand.

Common slips to watch for

  • Writing the output inside the loop when the OUTPUT line sits after ENDFOR.
  • Changing a value on the wrong row, so it looks as though it changed earlier than it did.
  • Forgetting that a WHILE loop checks its condition before every pass, including the last one that fails.
  • Mixing up zero-based and one-based indexing when tracing arrays. AQA's linear search example starts the index at 0, so the first item is at index 0.

A 20-minute practice routine for tonight

  1. Spend five minutes studying one traced example from your class notes or AQA's teaching guide. Cover the table and try to rebuild it from the code alone.
  2. Write your own three-line loop, such as a counter that doubles each time. Trace it, then swap with a friend or compare with a second pass on another day.
  3. Take a short algorithm from a past-paper-style question your teacher has given you. Trace it with no help, then check each row against the answer.
  4. Write one sentence at the end describing what the algorithm does, such as adding the even numbers. Exam questions often ask for exactly that.

Come back to the same algorithm in two or three days and trace it again from scratch. Spacing your practice like this is more reliable than one long session; our guide to a spaced repetition schedule at https://prepo.me/blog/spaced-repetition-study-schedule shows how to plan it.

Where to go next

Once simple loops feel easy, try nested loops, then searches such as the linear search in AQA's guide, where you also track a found flag. Keep the same columns-first habit and the same discipline of one line at a time. Tracing is a skill you build by doing it repeatedly, not by reading about it, so a few short attempts across the week will serve you better than one marathon.

Sources: AQA, Teaching guide: Trace tables (GCSE Computer Science 8525), at https://filestore.aqa.org.uk/resources/computing/AQA-8525-TG-TT.PDF, and the Institute of Education Sciences practice guide Organizing Instruction and Study to Improve Student Learning, at https://ies.ed.gov/ncee/WWC/PracticeGuide/1.