Step through code and track how variables change — or hunt down the errors
A trace table is a technique used in computer science exams to check that you understand exactly what a piece of code does — step by step, line by line.
When code runs, variables change their values. A trace table tracks those changes. You get one column per variable and one row per line of code that changes something. You fill in the new value only when it changes — leave the cell blank otherwise.
Example
| x | y | |
|---|---|---|
| Line 1 | 4 | — |
| Line 2 | — | 2 |
| Line 3 | 6 | — |
Line 3: x = 4 + 2 = 6. y didn't change, so leave it blank.
Some cells are blank. Read the code, work out the value, type it in. Green = correct, red = wrong.
The table is already filled in — but some values are wrong. Click the cells you think are mistakes, then check.