Algorithms and flowcharts
SOF ICSO · AI, Robotics and IT · about 6 minutes
An algorithm is a clear, finite list of steps to solve a problem. A flowchart draws it with standard shapes.
Questions ask you to trace a flowchart, find its output or spot a missing step.
Shapes
Each shape has one job, so anyone can read a flowchart. Arrows show the order. A decision diamond always has two exits, labelled yes and no.
Tracing
Make a column for each variable and one row per step. Update the values exactly as the chart says and stop when you reach End.
Worked examples
Example 1Start with s = 0, i = 1. Repeat: s = s + i, i = i + 2, until i > 7. Output s.
- Add 1, 3, 5, 7.
Answer: 16
See it move
Where marks are lost
- Running a loop one time too many.
- Using a rectangle for a decision.
Exam tips
- Oval: start/end. Parallelogram: input/output. Rectangle: process. Diamond: decision.
- A loop goes back to an earlier step until a condition changes.
- Trace with a table of variable values.
Practice questions
Which flowchart symbol shows a decision?
An algorithm must be…
A flowchart sets n = 1 and doubles n until n > 20. The final n is…
More worked examples
Try each one first, then open the working.
Trace the flowchart. What number is printed?
Show the working
Start: Write down s and n after every pass round the loop.
s takes the values 14 + 11 + 8 + 5 + 2 = 40.
Answer: 40
Fill the trace table. What value replaces “?”?
Show the working
Start: Each row adds i × k to the total from the row above.
total after i = 3: 0 + 4 + 8 + 12 = 24.
Answer: 24
How many times does this run? for i in range(4, 9, 3):
Show the working
Start: List the values of i.
range stops before the end value.
Answer: 2
Trace the flowchart. What number is printed?
Show the working
Start: Write down s and n after every pass round the loop.
s takes the values 14 + 12 + 10 + 8 + 6 + 4 + 2 = 56.
Answer: 56
Practise more
New questions every time, at exam level
Trace the flowchart. What number is printed?
Learn it properly
Full chapters with animations, each with an “Explained simply” version.