Debugging worksheet for Years 3–4: Bug hunt
All 4 worksheets in this game
One for each chapter
Bug Hunt is a printable debugging worksheet for Years 3 and 4 (ages 7 to 9) that teaches children to find and fix mistakes in programs and algorithms, then test them again. It follows the national curriculum in England for computing in Years 3 to 6: use logical reasoning to explain how some simple algorithms work and to detect and correct errors in algorithms and programs.
- 3 A4 pages
- Answers sheet
- About 30 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: Getting the order right (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
Find and fix bugs in programs and everyday algorithms using run it, find it, fix it, test it: wrong turns, wrong repeat counts and steps in the wrong order. With a bugged route game and answers.
- Page 1 · Learn
- Flip introduces run it, find it, fix it, test it, then debugs a robot program with a wrong turn step by step. A warm-up finds the bug in getting-dressed instructions.
- Page 2 · Try it together
- Bugged route: a grown-up writes a route to a hidden toy with one mistake; your child walks it, finds the bug, fixes it and tests it, then writes one for the grown-up.
- Page 2–3 · Practise
- Ring the bug in three robot programs, fix a wrong turn for a robot facing down, put a muddled cup-of-squash algorithm in order, and judge a fix in the Challenge.
- Answers sheet
- Every answer by page, what to watch out for (changing a block that was right, a repeat count one out, left and right) and quick ideas without paper.
3 A4 pages and an answers sheet · about 30 minutes
Using it at home
- For the bugged route, try different kinds of bug each time: a wrong turn, one step too many, or two steps in the wrong order. It takes about 10 minutes.
- Praise careful debugging more than getting it right first time. Ask "Where did it first go wrong?" rather than starting the program again from scratch.
Watch out for
- Changing a block that was already right, instead of the one with the bug.
- Trace from the top and stop at the first place the robot leaves the right path. Change only that block.
- Getting a repeat count one too many or one too few.
- Count the moves the robot needs on the grid, then check that number against the number in the loop.
- Mixing up turning left and right when the robot faces down.
- Turn the page so the robot points away from you, then decide which way it should turn.
Questions from the worksheet
- Each robot starts facing up and should reach its star. Draw a ring round the bug in each program.
- This robot starts facing down. Which block is the bug? Fix it. Why is this bug easy to make?
- Leo wrote an algorithm for making a cup of squash. Find the bug and write the steps in the right order.
- Ava's robot stops one square before the star. She changes block 2 to turn left. Is that a good fix? What should she do instead?
The answers are on the answers sheet, for grown-ups.
National curriculum in England
This worksheet practises these statements from the Years 3–6 computing programme of study:
- Use sequence, selection, and repetition in programs; work with variables and various forms of input and output
- 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
- Show a buggy program on the board and have pairs write down the block number of the bug before revealing the fix.
- Use the cup of squash algorithm as a quick unplugged starter on debugging before moving to robot programs.
Questions and answers
What is debugging in computing?
Debugging means finding and fixing mistakes, called bugs, in a program. A good method is run it, find it, fix it, test it: see what goes wrong, find the block causing it, change it, then run the program again.
How do you find a bug in a program?
Trace the program one block at a time and look for the first place it does something different from what you wanted. That block is usually the bug, so fix it and test again.
More worksheets from Sequences and Loops: Code a Robot and Squash the Bugs
More Year 3 technology worksheets
One for every chapter of every game, with answers.
