Read a flowchart by starting at Start and following each arrow in order. To trace it, simulate every instruction using the given input, recording changes to variables and following only the correct branch at each decision.
A flowchart is a diagrammatic representation of an algorithm. In B1.1 Approaches to computational thinking, tracing helps you understand how an algorithm processes input, makes decisions, repeats instructions, and produces output.
| Symbol | Meaning when tracing |
|---|---|
| Oval | Start or end of the algorithm |
| Rectangle | Process, such as assigning or calculating a value |
| Parallelogram | Input or output |
| Diamond | Decision with branches such as Yes/No or True/False |
| Arrow | Direction of control flow |
Use this method:
- Identify the starting point and any initial input.
- Follow the arrows without skipping symbols.
- Execute each process exactly as written.
- At a decision, evaluate the condition using the current values.
- Follow only the branch matching the result.
- For a loop, return along the arrow and test the condition again.
- Stop only when the End symbol is reached.
For example, consider a flowchart that inputs n, sets total = 0, and repeatedly adds n to total before decreasing n by 1 while n > 0. For input n = 3, a trace table would be:
| Iteration | n before process | total after process |
|---|---|---|
| 1 | 3 | 3 |
| 2 | 2 | 5 |
| 3 | 1 | 6 |
The next test uses n = 0, so the condition is false and the flowchart outputs 6.
A common misconception is that a decision executes both branches. It does not: only the branch whose condition is satisfied is followed.
In an IB exam, show every variable update and repeated condition test. If asked to trace, provide the sequence of values or outputs rather than merely describing the algorithm’s overall purpose.