Flowcharts
Interpreting a flowchart means following it from Start with the inputs you are given, writing down each value and output, and working out what the whole algorithm does.
Begin at the Start terminal and move along each arrow in turn. When you reach an input, use the value supplied. When you reach a process, carry out the change it describes. When you reach an output, record it. Keep going until you reach the Stop terminal.
To state a flowchart’s purpose, describe the overall task from its inputs, processes and outputs. For example, imagine a flowchart that inputs the number of lives a player has and sets a score to 0. A decision checks whether lives > 0: if true it adds 10 to the score and subtracts 1 from the lives, then loops back to the decision; if false it outputs the score. Its purpose is to award 10 points for each life lost until no lives remain.
With 3 lives, the first pass makes the score 10 and the lives 2. The condition is still true, so follow the loop again: score 20, lives 1. Once more: score 30, lives 0. Now lives > 0 is false, so the loop ends and the output is 30. The loop ran three times. Do not stop after one pass; keep tracing until the decision actually sends you out of the loop.
Boundary values matter. If the decision were lives >= 0, a player starting with 3 lives would make a fourth pass, because lives equal to 0 would still be true.
OCR GCSE Computer Science · Flowcharts