Generate custom courses on any topic — with hands-on practice, AI guidance, and visuals built in.
Already have an account?
Losing marks in tracing questions usually is not about understanding the algorithm. It is about writing an inconsistent table where one row secretly includes two steps, or where a variable is left blank because it did not change.
With the tiny list A = [4, 1, 3], treat each row as the full program state after exactly one step. A step is one loop iteration, one assignment, or one swap, depending on what the pseudocode line does.
Before you see the table, answer this. If a loop reads A[i] on every iteration, what value should appear in the current_value column on the row where i = 1 for A = [4, 1, 3]?
See how a single-step state table is filled for A = [4, 1, 3].
The table works because each row repeats all tracked variables, even when they do not change. If i increases but current_value stays the same, you still write current_value again, because the mark scheme expects evidence that you kept it unchanged rather than forgetting it.
Once you can keep variables consistent row by row, arrays are the next place errors appear. The main mistake is applying a read and a write as if they happen at the same time, so the row shows a value that only exists after a later step.
An index is the position used to access an array element, such as A[0] or A[1], and you must commit to the exam’s convention. If the question states 1-based indexing, then A[1] is the first item, and every access in your trace table must follow that same rule.
Before the array snapshots, answer this. If you swap the elements at indices 0 and 1 in A = [4, 1, 3], what should the next array snapshot row show?
Explore how to record array reads and writes as separate, single-row state changes.