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 | |
|---|---|---|
| 1SUBSTRING(Date, 3, 1) = "/" | ALENGTH(Date) = 10 AND SUBSTRING(Date, 3, 1) = "/" AND SUBSTRING(Date, 6, 1) = "/" | |
| 2LENGTH(Date) = 10 | BSUBSTRING(Email, 5, 1) = "@" | |
| 3A format check can test that a date has the right length and a slash in the 3rd and 6th positions | CSUBSTRING needs three arguments: the string, the start position and the number of characters. The length 1 is missing, so it should be SUBSTRING(Date, 3, 1). | |
| 4An email format check can test that the input contains an @ symbol in the expected place | DChecks that the 3rd character of a date is a slash, which is part of a DD/MM/YYYY format check | |
| 5IF SUBSTRING(Date, 3, 1) = "/" THEN OUTPUT "Date is correct" ENDIF | EChecks that a DD/MM/YYYY date has exactly 10 characters, which is one part of a format check | |
| 6IF SUBSTRING(Date, 3) = "/" THEN | FA format check only shows that the pattern is right, not that the date is correct. 99/99/2025 would pass, so the output should say the format is valid. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
format check — A check that input follows a set pattern of characters, such as a date written DD/MM/YYYY. The right pattern does not prove the data is correct, e.g. 99/99/2025 fits the pattern.IF LENGTH(Date) <> 10 THEN
OUTPUT "Wrong format"
ENDIFIF SUBSTRING(Date, 3, 1) <> "/" THEN
OUTPUT "Wrong format"
ENDIFIF SUBSTRING(Date, 6, 1) = "/" THEN
OUTPUT "Second slash found"
ENDIFIF LENGTH(Date) = 10 AND
SUBSTRING(Date, 6, 1) = "/" THENDate ← "99/99/2025"
IF LENGTH(Date) = 10 THEN
OUTPUT "Format check passed"