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 | |
|---|---|---|
| 1REPEAT INPUT Age UNTIL Age >= 0 AND Age <= 120 | AKeeps asking for input until the value passes a range check between 0 and 120 | |
| 2UNTIL LENGTH(Password) >= 8 | BThere is no error message when the value is rejected, and the variable Age is never declared with DECLARE Age : INTEGER before the loop. | |
| 3A validation algorithm must first declare the variable that will store the input | CDECLARE Score : INTEGER | |
| 4A presence check loop repeats until the input is not empty | DREPEAT INPUT Name UNTIL Name <> "" | |
| 5REPEAT INPUT Mark UNTIL Mark < 0 OR Mark > 100 | ELoop exit condition that repeats until the password passes a length check of at least 8 characters | |
| 6REPEAT OUTPUT "Enter age" INPUT Age UNTIL Age >= 0 AND Age <= 120 | FThe UNTIL condition tests for invalid values, so the loop stops when the mark is wrong. It should be Mark >= 0 AND Mark <= 100. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
validation loop — DECLARE the variable, OUTPUT a prompt, INPUT the value, OUTPUT an error message if it fails the check, and REPEAT ... UNTIL the value is acceptable.DECLARE Age : INTEGER
OUTPUT "Enter your age (1-120)"
INPUT AgeDECLARE Age : INTEGER
OUTPUT "Enter your age (1-120)"
INPUT AgeREPEAT
INPUT Age
UNTIL Age >= 1 AND Age <= 120REPEAT
INPUT Password
UNTIL LENGTH(Password) >= 8IF Name = "" THEN
OUTPUT "Please enter a name"
ENDIF