Pickles AcademyStart for free

Repeat loops – practice for Years 4–6

Sample questions on Repeat loops 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 4–6
Curriculum area
Algorithms and programming

Question types: How many times to repeat?

Rule: Repeat loops

repeat n [commands] runs the commands in the brackets n times in a row.

How many repeats? Length of the whole program ÷ length of the repeated part.

Example: ↑ ↓ ← ↑ ↓ ← ↑ ↓ ←: 9 commands, [↑ ↓ ←] has 3, so repeat 3 times

Watch out: A loop inside a loop multiplies: repeat 3 [repeat 2 [→] ] is 6 steps right, not 5.

Sample questions

  1. Question 1 Easy

    We want to write the program ↑ ↑ ↑ ↑ ↑ ↑ ↑ in a shorter way: repeat ?× [↑]. Which number goes in place of the question mark?

    Show the solution
    Answer: 7

    How it works: [↑] comes 7 times in a row: repeat 7× [↑].

  2. Question 2 Normal

    We want to write the program ↓ ← ↓ ← ↓ ← ↓ ← in a shorter way: repeat ?× [↓ ←]. Which number goes in place of the question mark?

    Show the solution
    Answer: 4

    How it works: [↓ ←] comes 4 times in a row: repeat 4× [↓ ←].

  3. Question 3 Hard

    How many squares does the robot move in all with the program repeat 2× [ repeat 4× [↑] repeat 3× [↓] ]? Each arrow is one square.

    Show the solution
    Answer: 14

    How it works: One run of the outer loop moves 4 + 3 = 7 squares, so 2 × 7 = 14 in all.

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