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 must be an INTEGER | AA type check: the input must be a number that can have a decimal part, so text is rejected | |
| 2Price must be a REAL number | BA type check: the input must be a whole number, so letters like "ten" are rejected | |
| 3A type check rejects letters when a whole number is expected, such as an age | CThe input must be of type INTEGER | |
| 4In the exam, a type check is described in words, linked to a data type | DA STRING can hold letters, so it will not enforce whole numbers. The type check should require an INTEGER. | |
| 5Type check: Age must be between 0 and 120 | EThis describes a range check, not a type check. A type check tests the data type, for example that Age is an INTEGER. | |
| 6Age is stored as STRING so a type check will make sure it is a whole number | FIF Age is not an INTEGER THEN OUTPUT "Enter a whole number" |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
type check — A validation check that tests an input is the expected data type, such as a whole number (INTEGER) for an age, and rejects letters or other wrong types.// Type check: expects a whole number
DECLARE Age : INTEGERDECLARE Age : INTEGER
DECLARE Name : STRINGDECLARE Age : INTEGER
INPUT AgeDECLARE Age : INTEGER
OUTPUT "Enter your age"
INPUT Age// Type check: Age must be INTEGER
DECLARE Age : INTEGER