IGCSE Computer Science 0478: How to Complete a Trace Table Without Losing Marks
By Zaheer | Updated 14 October 2026
Disclosure: I created the IGCSE Computer Science 0478 Mission Control app mentioned at the end and sell it on Gumroad. Everything in this post is free to use without it. This is independent study material, not affiliated with Cambridge or any exam board.
Trace tables are some of the most predictable marks in IGCSE Computer Science. You are given a short algorithm and some input values, and you fill in a table to show what happens at every step. Students lose marks here not because the idea is hard, but because of small slips: a missing starting value, a loop run once too many times, or an output written in the wrong place. This post shows a reliable method, a worked example, the five most common mistakes, and three tasks to try yourself.
What a trace table is for
A trace table records the value of each variable as an algorithm runs, so you can see what it does without running it on a computer. Examiners use it to check that you can follow the logic one line at a time and not guess what the algorithm "should" do.
The five-step method
- Make a column for every variable, plus a column for any condition being tested and a column for OUTPUT. If the question gives you column headings, use exactly those.
- Write the starting values first. Any variable set before a loop (such as
Total ← 0) gets its own row. - Work through the code line by line. Never skip ahead, and never assume what the program is trying to do.
- Add one row for each pass of a loop. Only change the variables that actually change, and carry the rest down unchanged.
- Fill the OUTPUT column at the moment the output instruction runs, not before and not after.
A worked example
Here is a short algorithm written in pseudocode. The input values, in order, are 7, 12, 3, 15.
Total ← 0
Count ← 0
FOR i ← 1 TO 4
INPUT Number
IF Number > 10 THEN
Total ← Total + Number
Count ← Count + 1
ENDIF
NEXT i
OUTPUT Total, Count
The loop runs four times, because i goes 1, 2, 3, 4. Here is the completed trace table:
| i | Number | Number > 10 | Total | Count | OUTPUT |
|---|---|---|---|---|---|
| 0 | 0 | ||||
| 1 | 7 | FALSE | 0 | 0 | |
| 2 | 12 | TRUE | 12 | 1 | |
| 3 | 3 | FALSE | 12 | 1 | |
| 4 | 15 | TRUE | 27 | 2 | 27, 2 |
Notice what the table does:
- The first row holds only the starting values of
TotalandCount. - The rows for
i= 1 and 3 showFALSE, so nothing changes and the totals are carried down. - The OUTPUT appears once, in the last row, because
OUTPUTcomes after the loop has finished.
Five mistakes that cost marks
- Leaving out the starting values. The initial row is easy to forget, and it is often worth a mark.
- Changing the wrong variable in a row. Update only what the code changes on that pass, and copy the rest down.
- Running a loop the wrong number of times.
FOR i ← 1 TO 4runs four times, not three. AWHILEloop checks its condition before every pass, including the first, and stops as soon as the condition is false. - Putting the output in the wrong place. Write each output on the row where the OUTPUT line actually runs, in the right order.
- Guessing instead of tracing. Do not decide what the algorithm "is meant to do". Follow the instructions exactly, including
MOD(the remainder after division) andDIV(division that gives a whole number).
Try these three tasks
Draw the table yourself before reading the answers.
Task 1. Run the same algorithm as the worked example, but with the input values 20, 4, 11, 9. What is the output?
Task 2. Trace this algorithm and state everything it outputs.
X ← 3 Y ← 1 WHILE Y < 20 Y ← Y * X OUTPUT Y ENDWHILE
Task 3. Trace this algorithm and state the output.
Count ← 0
FOR N ← 1 TO 6
IF N MOD 2 = 0 THEN
Count ← Count + N
ENDIF
NEXT N
OUTPUT Count
Answers
- Task 1: 20 is greater than 10, so
Totalbecomes 20 andCountbecomes 1. 4 is not greater than 10, so nothing changes. 11 is greater than 10, soTotalbecomes 31 andCountbecomes 2. 9 is not greater than 10, so nothing changes. Output: 31, 2. - Task 2:
Ystarts at 1. Pass 1: 1 < 20, soY= 3 and 3 is output. Pass 2: 3 < 20, soY= 9 and 9 is output. Pass 3: 9 < 20, soY= 27 and 27 is output. Then 27 < 20 is false, so the loop stops. Output: 3, 9, 27. - Task 3: Only the even values of
Nare added, becauseN MOD 2 = 0is true only whenNis even.Countgoes 0, 2, 2, 6, 6, 12 over the six passes. Output: 12.
Quick checklist
- I have a column for every variable, any condition, and OUTPUT.
- I wrote the starting values in their own row.
- I counted how many times the loop really runs.
- I changed only the variables that change, and carried the others down.
- I wrote each output on the row where it actually happens.
Practise more
My IGCSE Computer Science 0478 Mission Control app includes a trace table stepper that lets you walk through an algorithm one step at a time, alongside flashcards, multiple-choice questions and a logic gate builder: IGCSE Computer Science 0478 Mission Control.
The pseudocode here is written for practice. Always check the official syllabus and pseudocode guide from your exam board for the exact style used in your exams. No exam result is guaranteed.
Comments
Post a Comment