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 | |
|---|---|---|
| 1UNTIL Mark >= 0 AND Mark <= 100 | ARepeats the loop until the mark is in the valid range of 0 to 100 inclusive | |
| 2OUTPUT "Invalid mark, try again" | BREPEAT INPUT Mark UNTIL Mark >= 0 AND Mark <= 100 | |
| 3REPEAT is suitable for validation because the prompt must run at least once before the check | CThe UNTIL line is indented and sits like it is inside the loop body, and the error message is missing. UNTIL should line up with REPEAT, with the OUTPUT message placed before it inside the loop. | |
| 4An OR condition can be used to detect invalid data, so the error message appears when the mark is out of range | DOR makes the condition true for every number, so the loop ends on any input and invalid marks are accepted. It should use AND. | |
| 5REPEAT INPUT Mark UNTIL Mark >= 0 OR Mark <= 100 | EIF Mark < 0 OR Mark > 100 THEN OUTPUT "Invalid mark" ENDIF | |
| 6REPEAT INPUT Mark UNTIL Mark >= 0 AND Mark <= 100 | FShows an error message inside the loop when the value fails the range check |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
UNTIL Mark >= 0 AND Mark <= 100 — Ends a REPEAT loop only when Mark is valid (0 to 100). Input is asked again until it passes this range check, so the program only continues with valid data.REPEAT
INPUT Mark
UNTIL Mark >= 0 AND Mark <= 100REPEAT
INPUT Mark
UNTIL Mark >= 0 AND Mark <= 100REPEAT
INPUT Mark
UNTIL Mark >= 0 AND Mark <= 100REPEAT
INPUT Mark
UNTIL NOT (Mark < 0 OR Mark > 100)REPEAT
INPUT Mark
UNTIL Mark >= 0 AND Mark <= 100