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(Password) >= 8 | ALENGTH(Username) <= 12 | |
| 2LENGTH(PIN) = 4 | BChecks that the password has at least 8 characters (a minimum length check) | |
| 3A length check can set a maximum length, so a username must not be longer than 12 characters | CThe function name is written in the wrong case. Keywords and functions must be in capital letters, so it should be LENGTH(PIN). | |
| 4A length check can set both a minimum and a maximum, so a username must be 6 to 12 characters | D= tests for exactly 8 characters, so longer passwords are wrongly rejected. A minimum length needs >= 8. | |
| 5IF Length(PIN) = 4 THEN | ELENGTH(Username) >= 6 AND LENGTH(Username) <= 12 | |
| 6IF LENGTH(Password) = 8 THEN | FChecks that the PIN has exactly 4 characters (an exact length check) |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
LENGTH(Password) >= 8 — A length check tests the number of characters in an input is the required length or within a limit, using LENGTH, e.g. a password of at least 8 characters or a PIN of exactly 4.IF LENGTH(Password) >= 8 THENIF LENGTH(PIN) = 4 THENIF LENGTH(Password) >= 8 THENIF LENGTH(Username) <= 12 THENREPEAT
INPUT PIN
UNTIL LENGTH(PIN) = 4