Debugging worksheet for Years 3–6: Bug hunt
All 5 worksheets in this game
One for each chapter
Bug Hunt is a printable computing worksheet for Years 3 to 6 (ages 7 to 11) that teaches children to test an if-else program, spot the bug that makes it go wrong, and fix it. It follows the KS2 national curriculum in England for computing: use logical reasoning to detect and correct errors in algorithms and programs.
- 3 A4 pages
- Answers sheet
- About 35 minutes
- Colour or black and white
- National curriculum
For members Membership opens every worksheet and every game. Already a member? Log in
Start with the free one: True or false conditions (chapter 1).
Print it on A4, in colour or black and white. Do it after the chapter, or before it to see what your child already knows.
What's on the worksheet
Teaches children to test an if-else program both ways, spot bugs such as swapped actions, a wrong condition or a block outside the if-else, and fix them. Includes a robot grown-up game and an answers sheet.
- Page 1 · Learn
- Three kinds of if-else bug (swapped actions, a wrong condition and a block outside), then a worked example debugging an umbrella program by testing it both ways.
- Page 2 · Try it together
- Robot grown-up: the grown-up follows three buggy program cards exactly, using a spoon, a cup and a book, and the child finds and fixes each bug.
- Pages 2–3 · Practise
- Name the bug in three programs, test a score program in a table and fix its condition, fix the fan program, and explain a block outside the if-else.
- Answers sheet
- Every answer by page, what to watch out for (swapped actions, wrong conditions, blocks outside the if-else) and quick ideas to go further.
3 A4 pages and an answers sheet · about 35 minutes
Using it at home
- Be a very literal robot in Try it together: do exactly what the card says, even when it's silly. The funnier the mistake, the easier the bug is to spot.
- Praise finding bugs as much as fixing them. Ask "What should it do instead?" before your child changes anything.
Watch out for
- Not noticing when the two actions are in the wrong parts of an if-else.
- Ask: "When the condition is true, what should happen? Is that in the then part?"
- Not noticing when a condition checks the wrong thing.
- Read the goal again and ask: "What does the program need to check?" Then compare it with the condition.
- Missing a block placed outside the if-else, so it runs every time.
- Run a finger down the program: anything outside the if-else runs every time, whatever the condition.
Questions from the worksheet
- Goal: fan on when it's hot. If is it hot? then fan off, else fan on. Which kind of bug is it?
- Goal: say "You win" when the score is 10 or more. The program checks "is score more than 10?" Test it with 12, 10 and 4.
- Fix the fan program. Fill in the blocks so it works.
- In program A3, a player scores 4. What does it say? Why is that a problem?
- Leo says: "I tested my program once and it worked, so it has no bugs." Is he right?
The answers are on the answers sheet, for grown-ups.
National curriculum in England
This worksheet practises this statement from the Years 3–6 computing programme of study:
- Use logical reasoning to explain how some simple algorithms work and to detect and correct errors in algorithms and programs
Source: National curriculum in England: computing programmes of study (DfE)
In the classroom
- Robot grown-up works well in pairs: one child is the robot, the other debugs, then they swap cards.
- Use set B to teach testing on the edge: ask the class which score is most likely to find a bug, and why.
Questions and answers
What is debugging in KS2 computing?
Debugging means finding and fixing mistakes, called bugs, in a program or algorithm. Children test the program, compare what it does with what it should do, then change it and test again.
Why should you test an if-else program both ways?
Each test only runs one part of an if-else. Testing once with the condition true and once with it false checks both parts, so a bug can't hide in the part you didn't run.
More worksheets from If and Else in Coding: Make Choices with Bit the Robot
More Year 3 technology worksheets
One for every chapter of every game, with answers.
