REPEAT a set number of times

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

REPEAT a set number of times

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which pseudocode makes a robot clap 3 times?
A REPEAT 3 TIMES clap END REPEAT
B REPEAT clap 3 TIMES END REPEAT
2. How many times does 'jump' run? REPEAT 4 TIMES jump END REPEAT
A 1 time
B 4 times
3. Which line shows where a REPEAT loop stops?
A STOP JUMP
B END REPEAT
4. A student wants to draw a square with 4 equal sides. Which number should they choose for REPEAT ___ TIMES (draw a side, turn right)?
A 4
B 2
5. Which loop body is set out correctly?
A REPEAT 2 TIMES step forward turn left END REPEAT
B REPEAT 2 TIMES step forward turn left END REPEAT

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1REPEAT 5 TIMES AEND REPEAT is missing, so there is no sign of where the loop stops. Add END REPEAT after Stamp.
2END REPEAT BREPEAT 2 TIMES Jump END REPEAT Sit down
3To clap 3 times, put the number 3 in the loop and indent the clap step CREPEAT 3 TIMES Clap END REPEAT
4A step written after END REPEAT runs only once, after the loop has finished DThe step inside the loop is not indented, so it is not clear which step gets repeated. Indent Step forward under REPEAT 4 TIMES.
5REPEAT 4 TIMES Step forward END REPEAT EMarks the place where the loop stops and shows the steps inside are finished
6REPEAT 6 TIMES Stamp Sit down FRuns the indented steps under it exactly 5 times, then moves on to the next step

Definitions

REPEAT n TIMES

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
______ 3 TIMES Jump END REPEAT
2.
REPEAT _ TIMES Draw a side and turn END REPEAT
3.
REPEAT 4 TIMES Hop forward __________
4.
REPEAT 6 _____ Roll the dice END REPEAT
5.
REPEAT _ TIMES Knock on the door END REPEAT

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A Get the ball
B REPEAT 4 TIMES
C Bounce the ball
D END LOOP
Question 2
A REPEAT TIMES
B Jump
C END REPEAT
D Sit down
Question 3
A REPEAT 3 TIMES
B Draw a line
C STOP REPEAT
D Draw a circle
Question 4
A LOOP 3 TIMES
B Stomp your feet
C END REPEAT
D Stop
Question 5
A Goal: run 4 laps
B REPEAT 4 TIMES
C Run 4 laps
D END REPEAT

Answer Key

REPEAT a set number of times
Section A: Quick Questions
Q1
A — REPEAT 3 TIMES clap END REPEAT
Q2
B — 4 times
Q3
B — END REPEAT
Q4
A — 4
Q5
A — REPEAT 2 TIMES step forward turn left END REPEAT
Section B: Match the Pairs
Q1
REPEAT 5 TIMES → Runs the indented steps under it exactly 5 times, then moves on to the next step
Q2
END REPEAT → Marks the place where the loop stops and shows the steps inside are finished
Q3
To clap 3 times, put the number 3 in the loop and indent the clap step → REPEAT 3 TIMES Clap END REPEAT
Q4
A step written after END REPEAT runs only once, after the loop has finished → REPEAT 2 TIMES Jump END REPEAT Sit down
Q5
REPEAT 4 TIMES Step forward END REPEAT → The step inside the loop is not indented, so it is not clear which step gets repeated. Indent Step forward under REPEAT 4 TIMES.
Q6
REPEAT 6 TIMES Stamp Sit down → END REPEAT is missing, so there is no sign of where the loop stops. Add END REPEAT after Stamp.
Section C: Definitions
Q1
REPEAT n TIMES — Runs the indented steps under it exactly n times, then moves on to the next step. Use END REPEAT to show where the loop stops. Example: REPEAT 5 TIMES.
Section D: Fill in the Blanks
Q1
REPEAT 3 TIMES Jump END REPEAT
Q2
REPEAT 5 TIMES Draw a side and turn END REPEAT
Q3
REPEAT 4 TIMES Hop forward END REPEAT
Q4
REPEAT 6 TIMES Roll the dice END REPEAT
Q5
REPEAT 3 TIMES Knock on the door END REPEAT
Section E: Spot the Error
Q1
D — A counted loop must finish with END REPEAT. END LOOP is not the right keyword. Line 4 should be END REPEAT.
Q2
A — The loop needs a number to say how many times to repeat. Line 1 should be REPEAT 5 TIMES.
Q3
C — A counted loop must finish with END REPEAT. STOP REPEAT is not the right keyword. Line 3 should be END REPEAT.
Q4
A — A counted loop starts with the word REPEAT, not LOOP. Line 1 should be REPEAT 3 TIMES.
Q5
C — The body should run just one lap each time. Running 4 laps inside a loop that repeats 4 times would give 16 laps. Line 3 should be ' Run one lap'.