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 Count < 5 DO | AWHILE Count < 5 DO OUTPUT Count Count ← Count + 1 ENDWHILE | |
| 2ENDWHILE | BTests the condition before each repeat and runs the loop body only while Count < 5 is TRUE | |
| 3The body of a WHILE loop may run zero times because the condition is tested first | CMarks the end of the loop body, then the program jumps back to test the WHILE condition again | |
| 4The variable in the condition must be updated inside the loop so the condition can become FALSE | DThe keyword DO is missing from the WHILE line. It should be WHILE Count < 5 DO. | |
| 5Count ← 1 WHILE Count <= 5 DO OUTPUT Count ENDWHILE | ECount is never changed inside the loop, so Count <= 5 stays TRUE forever and the loop is infinite. Add Count ← Count + 1 in the body. | |
| 6WHILE Count < 5 Count ← Count + 1 ENDWHILE | FCount ← 10 WHILE Count < 5 DO OUTPUT Count ENDWHILE |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
WHILE condition DO — A loop that tests the condition first and repeats its body while it is TRUE. The body may run zero times, and it must change the variable or the loop never ends.WHILE Count < 5 DO
Count ← Count + 1
ENDWHILEWHILE Count < 5 DO
Count ← Count + 1
ENDWHILEWHILE Count < 3 DO
Count ← Count + 1
ENDWHILEWHILE Num > 0 DO
Num ← Num - 1
ENDWHILEWHILE Num > 0 DO
Num ← Num - 1
ENDWHILE