Trace a flowchart by following its arrows from the start symbol, executing each instruction in order, and recording every variable change in a trace table. At each decision, evaluate the condition using the current values and follow only the appropriate branch until the flowchart ends.
This process is called a dry run: manually simulating an algorithm without executing it on a computer. It supports algorithmic thinking, an approach to computational thinking in B1.1, because it applies a precise sequence of rules to solve a problem.
Use these steps:
- Write down all initial variable values and inputs.
- Begin at the start symbol and follow the direction arrows.
- Execute each process, such as
total = total + 2. - For every decision, evaluate whether its Boolean condition is true or false.
- Record changed variables and any output after each relevant step.
- For a loop, return along the indicated arrow and test the condition again.
- Stop only when the end symbol is reached.
For example, suppose a flowchart sets x = 1, repeatedly outputs x and adds 2 while x < 5.
| Iteration | x < 5 | Output | New value of x |
|---|---|---|---|
| 1 | True | 1 | 3 |
| 2 | True | 3 | 5 |
| 3 | False | None | 5 |
The program output is therefore 1, 3. The value 5 is not output because the condition is tested before the loop body executes.
A common misconception is to follow both branches of a decision. During one execution, only the branch matching the condition's result is followed.
In an IB exam, show your working with a clearly labelled trace table. Examiners expect accurate updates in execution order, correct handling of loop conditions, and the final output rather than only the final variable values.