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 | |
|---|---|---|
| 1Age: range check (0 to 120) | ARecalculate the check digit and compare it | |
| 2Name: presence check | BLENGTH(PIN) = 4 AND PIN is all digits | |
| 3A PIN must be exactly 4 digits, so a length check and a type check are both needed | CA postcode is a pattern of letters and digits, so it needs a format check, not a range check. | |
| 4An ISBN or barcode can be checked for typing errors using its last digit, so a check digit is chosen | DA presence check only tests that something was entered, so 500 would still pass. Use a range check for age. | |
| 5Postcode field: use a range check (1 to 9999) | EAge is a number that must sit between a lowest and highest sensible value, so a range check is the best choice. | |
| 6Age field: use a presence check to make sure age is sensible | FA name must not be left empty, so a presence check is chosen to make sure something has been entered. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
validation check — A test matched to the field: range for age, length and type for PIN, presence for name, format for dates or postcodes, check digit for ISBN. Always justify the choice.// Age must be between 0 and 120
IF Age >= 0 AND Age <= 120 THEN
OUTPUT "Age accepted"// PIN must have exactly 4 digits
IF LENGTH(PIN) <> 4 THEN
OUTPUT "PIN must be 4 characters"INPUT Name
IF LENGTH(Name) = 0 THEN
OUTPUT "Name is required"// Date of birth needs a format check// ISBN: validate using a check digit