Repeat-Until loop

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

Repeat-Until loop

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Does a REPEAT-UNTIL loop's body always run at least once?
A True
B False
2. Which keyword introduces the condition checked after each repetition?
A UNTIL
B WHILE
3. Does a REPEAT-UNTIL loop check its condition before or after the loop body runs?
A Before
B After
4. Does a REPEAT-UNTIL loop stop once its UNTIL condition becomes true?
A True
B False
5. Is REPEAT-UNTIL a pre-test or post-test loop?
A Pre-test
B Post-test

Match the Pairs

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

Left columnRight column
1REPEAT DISPLAY count count ← count + 1 UNTIL count > 5 AREPEAT-UNTIL loop
2UNTIL count > 5 BThe loop should close with UNTIL and its condition, not END UNTIL
3A loop guaranteed to run its body at least once CChecks a condition after the loop body has run
4The keyword that marks the start of the loop body DAssignment should use ←, not =
5count ← 0 REPEAT DISPLAY count count ← count + 1 END UNTIL count = 3 EA loop that runs its body at least once before checking a condition
6n ← 1 REPEAT DISPLAY n n = n + 1 UNTIL n > 5 FREPEAT

Definitions

REPEAT ... UNTIL condition

Fill in the Blanks

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

1.
______ DISPLAY count
2.
REPEAT DISPLAY count _____ count > 5
3.
UNTIL count _ 5
4.
A REPEAT-UNTIL loop is a ____-test loop
5.
REPEAT-UNTIL loops always run at least ____

Spot the Error

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

Question 1
A count ← 1
B REPEAT
C DISPLAY count
D count ← count + 1
E END UNTIL count > 5
Question 2
A x ← 10
B REPEAT
C PRINT x
D x ← x - 1
E UNTIL x = 0
Question 3
A total ← 0
B REPEAT
C total ← total + 10
D WHILE total < 100
Question 4
A n ← 1
B REPEAT
C DISPLAY n
D n = n + 1
E UNTIL n > 5
Question 5
A count ← 0
B REPEAT
C DISPLAY count
D count ← count + 1
E UNTIL count = 3

Answer Key

Repeat-Until loop
Section A: Quick Questions
Q1
A — True
Q2
A — UNTIL
Q3
B — After
Q4
A — True
Q5
B — Post-test
Section B: Match the Pairs
Q1
REPEAT DISPLAY count count ← count + 1 UNTIL count > 5 → A loop that runs its body at least once before checking a condition
Q2
UNTIL count > 5 → Checks a condition after the loop body has run
Q3
A loop guaranteed to run its body at least once → REPEAT-UNTIL loop
Q4
The keyword that marks the start of the loop body → REPEAT
Q5
count ← 0 REPEAT DISPLAY count count ← count + 1 END UNTIL count = 3 → The loop should close with UNTIL and its condition, not END UNTIL
Q6
n ← 1 REPEAT DISPLAY n n = n + 1 UNTIL n > 5 → Assignment should use ←, not =
Section C: Definitions
Q1
REPEAT ... UNTIL condition — A loop that repeats its instructions and checks the condition after each repetition, so the body always runs at least once
Section D: Fill in the Blanks
Q1
REPEAT DISPLAY count
Q2
REPEAT DISPLAY count UNTIL count > 5
Q3
UNTIL count > 5
Q4
A REPEAT-UNTIL loop is a post-test loop
Q5
REPEAT-UNTIL loops always run at least once
Section E: Spot the Error
Q1
E — A REPEAT-UNTIL loop closes with UNTIL followed by the condition, not END UNTIL.
Q2
C — VCAA pseudocode uses DISPLAY to output a value, not PRINT.
Q3
D — A REPEAT loop must close with UNTIL and its condition, not WHILE.
Q4
D — Assignment in pseudocode uses ←, not =.
Q5
F — There is no incorrect line here — all lines follow correct REPEAT-UNTIL syntax.