Tracing a flowchart means following that flow by hand and recording what happens at each step, so you can state the output without running any program.
Tracing is examined directly: the command term for this topic is Trace, defined as “follow and record the actions of an algorithm”.
The Six Standard Symbols
Six symbols cover every flowchart in this course, and the shape carries the meaning, so using the wrong one loses marks in a Construct question.
A decision symbol is the only one with two exits, which is why it is the symbol that makes a trace branch.
Symbol Name
Shape
Description
Start/End
Rounded rectangle or oval
Marks the beginning or the end of the process. Every flowchart has exactly one start.
Process/Operation
Rectangle
An operation that changes the value, form or location of data, such as an assignment or a calculation.
Decision
Diamond
A condition with two exits, labelled Yes and No or True and False.
Input/Output
Parallelogram
Data entering the algorithm or a result being sent out of it.
Flowline
Line with an arrowhead
Shows the order of operations by joining one symbol to the next.
Connector
Small circle
Joins two parts of a flowchart that cannot be linked directly, usually across a page break.
The syllabus names the terminator Start/End, so use those words even when a diagram you are given labels it Stop.
Note
These symbols come from ISO 5807, the international standard for flowchart notation.
Because the notation is standard, a flowchart can be read by someone who does not know the language the solution will eventually be written in.
Tracing a Flowchart: The Procedure
Tracing is the same four moves every time.
Start at the Start symbol
Find the terminator and follow the flowline to the first input, process or decision.
Follow the flowlines one symbol at a time
Carry out the action in each process symbol before moving on to the next.
Continue to the End symbol and read off the output
The output is whatever reached an output symbol along the path taken, in the order it was sent.
Then trace again with different input, to cover the branches the first trace never entered.
Hint
Set up the trace table columns before you start following the arrows.
Listing the variables first forces you to notice every one the flowchart uses.
One row per change, rather than one row per symbol, keeps a long loop readable.
Worked Trace: Summing the Even Numbers Up to a Limit
This flowchart takes one input and produces one output, and its symbols run in the following order.
Start.
Input the value limit.
Process: set total to 0.
Process: set n to 1.
Decision: leave the loop if n is greater than limit, and otherwise carry on.
Decision: go on to the next process if n is even, and otherwise skip it.
Process: set total to total + n.
Process: set n to n + 1, then a flowline runs back to the first decision.
Output total.
End.
Tracing it with limit = 7 gives one row per pass through the loop.
Pass
n
n > limit?
n even?
total after the pass
n at the end of the pass
1
1
No
No
0
2
2
2
No
Yes
2
3
3
3
No
No
2
4
4
4
No
Yes
6
5
5
5
No
No
6
6
6
6
No
Yes
12
7
7
7
No
No
12
8
8
8
Yes, leave the loop
not reached
12
8
The loop ends on the pass where n reaches 8, the first value greater than 7, so the output is 12, which is 2 + 4 + 6.
Notice that total only changes on the passes where the second decision answers Yes, which is why the value repeats down the column.
Common Mistake
Following only one branch of a decision.
Trace the Yes path and the No path, because a question asking for all possible outputs needs both.
Skipping a connector and losing the rest of the diagram.
Follow every connector to its matching pair before deciding the trace has finished.
Not writing a variable down when it changes.
An unrecorded update is the usual reason a trace that looks right ends on the wrong value.
Getting the loop test the wrong way round.
Using n greater than or equal to limit instead of n greater than limit changes nothing when limit is 7, but with limit = 8 it leaves the loop before adding 8 and outputs 12 instead of 20.
What Tracing a Flowchart Finds That a Compiler Does Not
A flowchart shows the whole logic of an algorithm at once, including the paths that only run occasionally.
Tracing one catches the errors that survive a clean compile: a loop whose condition is never false, a decision with its branches swapped, or a variable used before it is set.
Because the trace is done by hand, it also gives you the expected output to test the finished program against.
Active recall
Which flowchart symbol is a diamond, and how many exits does it have?
Name the six standard flowchart symbols.
What are the columns of a trace table?
In the worked trace, which value of n ends the loop, and why?
Why must a flowchart be traced with more than one input value?