Skip to content
IGCSE·Tuition
Tools

Restricted pseudocode trace trainer

Reading an algorithm is easy until you have to say what every variable holds after each line.

On this page
  1. How do you use it?
  2. How do you read the result?
  3. Example walk-through
  4. What are the assumptions and limits?
  5. Which lessons explain the result?

Everything you enter stays on this device. Nothing is sent to us.

This tool runs a small piece of pseudocode one statement at a time and records the result as a trace table. Each row shows every variable after that step, and each decision is explained in words.

You can trace by hand first, then run the tool and compare your table with its table.

How do you use it?

  1. Pick an algorithm from the list, or edit the code in the text box. The six starting algorithms are: sum of 1 to 5, largest of three numbers, halving until below 1, grade with nested IF, REPEAT UNTIL doubling, and a faulty loop that never ends.
  2. Predict first. On paper, write the variables as column headings and fill in the table yourself.
  3. Press Trace it. Reset returns to the first algorithm.
  4. Compare row by row. Where your table differs, read the “What happened” note for that row.

The supported statements are assignment (← or <-), OUTPUT, IF/THEN/ELSE/ENDIF, WHILE/DO/ENDWHILE, REPEAT/UNTIL and FOR/TO/STEP/NEXT. It understands + - * / DIV MOD, AND OR NOT and comparisons.

How do you read the result?

The heading says whether the program finished normally and in how many steps. Under it is the trace table with one column for each variable, plus an Output column.

Loop headers are logged each time they are checked. A WHILE line appears once more than the body runs, because the last check is the false one. A REPEAT UNTIL condition appears after each pass of the body.

Example walk-through

Choose Sum of 1 to 5. It sets total to 0, then runs a FOR loop with i from 1 to 5 adding i each time.

Expect twelve steps. Step 1 sets total to 0. Then each value of i produces two rows: one for the FOR line (i = 1, 2, 3, 4, 5) and one for the addition.

The total column reads 1, 3, 6, 10, 15. The last row is OUTPUT with 15.

Now choose Grade with nested IF. The mark is 67. The first test, mark >= 80, is FALSE, so the ELSE part runs.

The inner test, mark >= 60, is TRUE, so grade becomes 2. The trace shows both decisions and the output 2.

Finally, choose Faulty loop (never ends). x is 0 and the loop runs while x < 5, but nothing inside changes x.

The tool prints 0 again and again, stops at the safety limit and explains why. Add a line x <- x + 1 inside the loop and run it again: the output becomes 0, 1, 2, 3, 4.

What are the assumptions and limits?

  • It supports a restricted notation only. Real exam pseudocode may use features that this tool does not recognise.
  • The 2026 to 2028 notation needs a source check, and this tool is not the default for papers that move to Python only. Confirm the exam year with your centre and the Cambridge syllabus.
  • Programs are stopped at 300 steps, and only the first 100 rows are displayed.
  • Variables must have a value before they are used. The tool says so if not.
  • Use original practice algorithms. It is not an exam tool and does not check assessed work.

Which lessons explain the result?

For the idea of tracing, read trace a sequence with a state table. Loops are covered in trace a count-controlled loop and trace a condition-controlled loop. When your trace is one step off, see repair an off-by-one error.

Notation and year questions are in use the verified 2026-2028 convention and check the exam year before choosing notation. For loops that never end, read repair a pseudocode loop termination condition.

The full topic is in pseudocode for the applicable syllabus. If you would like a teacher to watch your tracing, see online one-to-one Computer Science tuition. More tools are in the learning tools directory.

Questions people ask

Is this the pseudocode style used in my exam?

Not necessarily. Notation differs between syllabus years, and this trainer uses a small common subset. Check the current Cambridge syllabus document for the exact style your exam year expects. Use the tool to practise the thinking, which is the same in every notation: follow the values, line by line.

Why did my program stop after 300 steps?

That is the safety limit. A loop whose condition never changes would run forever, so the tool stops it and tells you so. Look inside the loop and ask which variable in the condition is being changed. If none is, that is your fault to fix.

Can I type my own algorithm?

Yes. Edit the text box or start from an example. It accepts a small set of statements and up to 60 lines. If a line is not recognised, the tool names the line number so you can correct it. Use it only for original practice, not assessed coursework.

What does the trace table show?

One row per step. Each row has the step number, the line, the value of every variable at that moment, any output, and a plain-English note on what happened. For IF and loop lines, the note says whether the condition was true or false and what that caused.

Sources

  1. Cambridge IGCSE Computer Science 0478 syllabus page

Updated:

Your next step

If trace tables still go wrong halfway down, a one-to-one teacher can watch you trace a fresh algorithm and stop you at the exact line where the value slips.

Paid one-hour trial at your assigned teacher’s confirmed rate, starting from RM80. Other fees, schedules and ongoing arrangements are confirmed directly with your teacher after the trial class.

Tuition is arranged with a parent or guardian. Send them this page on WhatsApp and they can enquire for you.

Parent or guardian? Enquire here

9,000+ students helped through our service