Skip to content
Menu

Year 2 (ages 6–7, Grade 1 in the US) · Computing · Programming a floor robot · Lesson 3

Debugging programs

Finding and fixing bugs in floor-robot programs by running, watching, changing one step and testing again.

Exam boards: this lesson matches the AQA and Pearson Edexcel GCSE computing courses. Check which course your school follows.

Whiteboard video lesson: Debugging programs

13-minute video lesson

Teaching, worked examples and 20 practice questions solved step by step.

Watch free for a month

What your child will learn

  • Know what a bug is
  • Find the wrong step
  • Fix a program
  • Test again

The method

  1. Run it and watch.
  2. Find the first wrong step.
  3. Fix just that step.
  4. Test it again.

Key words: bug, debug, test, program, predict, robot.

Worked examples

Worked examples from the lesson, with every step.

Question 1

Goal: A1 to A4. Program: forward 2. Fix it.

  1. Step 1: one too few? count

Answer: forward 3

Question 2

Goal: A1 to D1. Program: turn right, forward 2. Fix it.

  1. Step 1: count squares

Answer: turn right, forward 3

Question 3

Goal: B1 to B5. Program: forward 5. Fix it.

  1. Step 1: count squares

Answer: forward 4