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 | |
|---|---|---|
| 1LENGTH(Code) = 6 AND Code <> "" | ACombines two range limits so the value must be at or above 11 and at or below 16 | |
| 2Age >= 11 AND Age <= 16 | BCombines a length check and a presence check, so the input must pass both | |
| 3Show a separate error message for each check by testing the checks one at a time | CIF Name = "" THEN OUTPUT "Enter a name" ELSE IF LENGTH(Name) > 10 THEN OUTPUT "Too long" ENDIF ENDIF | |
| 4All checks must be passed, so the valid condition joins them with AND | DOR is used instead of AND, so almost every number passes the range check, because any number is either at least 11 or at most 16. | |
| 5IF Age >= 11 OR Age <= 16 THEN | EThe THEN keyword is missing after the combined condition, so the IF statement is not written correctly. | |
| 6IF Code <> "" AND LENGTH(Code) = 6 OUTPUT "OK" | FIF Mark >= 0 AND Mark <= 100 AND Mark = INT(Mark) THEN |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
AND — Joins several validation checks into one condition, so the input must pass every check. Examples: presence and length together, or range and type together.IF Name <> "" AND LENGTH(Name) <= 20 THENIF IS_NUM(Age) AND Age >= 12 THENIF LENGTH(Code) <> 5 THEN
OUTPUT "Code must be 5 characters"
ENDIFREPEAT
INPUT Age
UNTIL Age >= 12 AND Age <= 18WHILE Age < 12 OR Age > 18 DO
INPUT Age
ENDWHILE