Pickles AcademyStart for free

Debugging a robot program – practice for Years 5–6

Sample questions on Debugging a robot program with the right answer and a worked solution, from easy to hard. In the Pickles Academy app a child gets new questions of the same kind every time, so they can't just learn the answers by heart.

Subject
Computing
Year
Years 5–6
Curriculum area
Algorithms and programming

Question types: Find the wrong command

Rule: Debugging a robot program

Trace the program step by step. The bug is the first command after which the robot goes the wrong way.

Try fixing that command and check that the program then reaches the star.

Example: It should go left twice and up once, the program is ← ↓ ←: command 2 is wrong (↓ instead of ↑).

Watch out: Don’t only look at the end: the very first command may be the wrong one.

Sample questions

  1. Question 1 Easy

    The program should take the robot to the star, but one command is wrong: 1. ← 2. ← 3. ← 4. ↓ 5. ↑. Which one? Each arrow moves the robot one square that way.

    1. A) command 1 (←)
    2. B) command 2 (←)
    3. C) command 3 (←)
    4. D) command 4 (↓)
    5. E) command 5 (↑)
    Show the solution
    Answer: D) command 4 (↓)

    How it works: Command 4 is wrong: it should be ↑, not ↓.

  2. Question 2 Normal

    The program should take the robot to the star, but one command is wrong: 1. → 2. → 3. ↑ 4. → 5. →. Which one? Each arrow moves the robot one square that way.

    1. A) command 1 (→)
    2. B) command 2 (→)
    3. C) command 3 (↑)
    4. D) command 4 (→)
    5. E) command 5 (→)
    Show the solution
    Answer: C) command 3 (↑)

    How it works: Command 3 is wrong: it should be →, not ↑.

  3. Question 3 Hard

    The robot faces the way its arrow points. The program should take the robot to the star, but one command is wrong: 1. ⬆ 2. ↺ 3. ⬆ 4. ⬆ 5. ⬆. Which one? ⬆ = one step forward, ↺ = turn left, ↻ = turn right (on the spot).

    1. A) command 1 (⬆)
    2. B) command 2 (↺)
    3. C) command 3 (⬆)
    4. D) command 4 (⬆)
    5. E) command 5 (⬆)
    Show the solution
    Answer: D) command 4 (⬆)

    How it works: Command 4 is wrong: it should be ↻, not ⬆.

All Computing topics

Keep practising in the app

In a minute, your child has their own avatar and a first task. Free, no ads, data in the EU.

Start for free