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 Count ← Count + 1 ENDWHILE | |
| 2ENDWHILE | BThe WHILE loop is closed with NEXT, which belongs to FOR loops. It must end with ENDWHILE. | |
| 3A WHILE loop tests its condition before the body, so if the condition is FALSE at the start the loop never runs | CNumber ← 10 WHILE Number < 5 DO OUTPUT Number ENDWHILE | |
| 4A variable in the condition must be changed inside the loop body so the condition eventually becomes FALSE and the loop ends | DMarks the end of the statements that belong to the WHILE loop and sends control back to test the condition again | |
| 5Count ← 1 WHILE Count <= 5 DO OUTPUT Count ENDWHILE | ECount is never changed inside the loop, so the condition stays TRUE forever and the loop never ends. Add Count ← Count + 1 before ENDWHILE. | |
| 6WHILE Count <= 5 DO Count ← Count + 1 NEXT | FTests the condition first and repeats the loop body only while Count is less than or equal to 5 |
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 ... ENDWHILE — A loop that tests its condition first, then repeats its statements while the condition is TRUE. If it is FALSE at the start, the loop never runs. ENDWHILE marks the end of the loop.WHILE Count < 5 DO
Count ← Count + 1
ENDWHILEWHILE Count < 5 DO
Count ← Count + 1
ENDWHILEWHILE Total < 100 DO
Total ← Total + 10
ENDWHILEWHILE Count < 5 DO
Count ← Count + 1
ENDWHILEWHILE Password <> "abc" DO
INPUT Password
ENDWHILE