Finding and fixing a mistake in an algorithm
A mistake in an algorithm. Follow the steps until the result goes wrong, then fix that step. It might be in the wrong order, missing, or unclear.
Understanding Finding and fixing a mistake in an algorithm in Years 5–6 Creating Digital Solutions
What it does: The fixed algorithm now has the missing step 'Add butter' put in, so the sandwich turns out right. 'Walk a bit' is unclear because no one knows how far. Walking '10 steps forward' is exact, so it can be followed the same way every time. A bug is a mistake in an algorithm. It stops the algorithm from giving the right result. Following each step in order shows you where the result first goes wrong. That step is where the bug is. All the steps are there, but 'Eat the toast' comes too early. Moving it to the end fixes the bug.
Common mistakes: The steps are in the wrong order. You cannot eat the toast before it has been made. Step 2 should be 'Put bread in the toaster'. The steps are in the wrong order. Laces cannot be tied before the shoes are on. Step 1 should be 'Put on your socks'.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 21–30) and word search (Modules 21–40).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
bugFill in the Blanks
Spot the Error
Student with a class code? Join your class →