Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1WHILE Number > 9 DO | AThe loop is closed with NEXT, which belongs to a FOR loop, instead of ENDWHILE | |
| 2ENDWHILE | BNothing in the body changes Number, so the condition stays TRUE and the loop never ends (an infinite loop) | |
| 3A WHILE loop tests its condition first, so if the condition starts FALSE the body runs zero times | CCloses the WHILE loop and sends control back to test the condition again | |
| 4Something inside the body must change the condition, or the loop never ends | DTests the condition before each pass and runs the loop body only while Number is greater than 9 | |
| 5WHILE Number > 9 DO Count ← Count + 1 ENDWHILE | ENumber ← 5 WHILE Number > 9 DO OUTPUT Number ENDWHILE | |
| 6WHILE Number > 9 DO Number ← Number DIV 10 NEXT | FWHILE Number > 9 DO Number ← Number DIV 10 ENDWHILE |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
WHILE ... DO ... ENDWHILE — A loop that tests its condition before each pass and repeats its statements while the condition is TRUE. It may run zero times, and the body must change the condition.WHILE Number > 9 DO
Number ← Number DIV 10
ENDWHILEWHILE Count < 5 DO
Count ← Count + 1
ENDWHILEWHILE Number > 9 DO
Number ← Number DIV 10
ENDWHILEWHILE Count < 5 DO
OUTPUT Count
Count ← Count + 1WHILE Lives > 0 DO
Lives ← Lives - 1
ENDWHILE