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 Attempts < 3 AND Correct = FALSE DO | AWHILE NOT Found AND Index <= 10 DO | |
| 2WHILE NOT Found AND Index <= 10 DO | BKeep looping only while the student has had fewer than 3 attempts and has not yet got the answer right. | |
| 3The loop stops as soon as either part of an AND condition becomes FALSE, so a password game ends after 3 tries or a correct guess. | CCorrect = TRUE is the wrong test. The loop would stop at once because Correct starts as FALSE. It should be Correct = FALSE so the loop continues until the answer is right. | |
| 4A search loop should continue only while the item is still not found and there are still places left to check. | DFound starts as FALSE, so the condition is FALSE straight away and the loop never runs. It should be NOT Found so the search continues until the item is found. | |
| 5WHILE Attempts < 3 AND Correct = TRUE DO | EKeep searching while the item has not been found and the index has not gone past 10. | |
| 6WHILE Found AND Index <= 10 DO | FWHILE Attempts < 3 AND Correct = FALSE DO |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
WHILE Attempts < 3 AND Correct = FALSE DO — The loop repeats only while BOTH tests are TRUE. As soon as either test becomes FALSE, the whole condition is FALSE and the loop stops.WHILE Attempts < 3 AND Correct = FALSE DOWHILE NOT Found AND Index <= 10 DOWHILE Attempts < 3 AND Correct = FALSE DOWHILE NOT Found AND Index <= 10 DO
Index ← Index + 1
ENDWHILEWHILE Attempts < 3 AND Correct = FALSE DO
Attempts ← Attempts + 1
ENDWHILE