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: 15 typed instead of 51 (range check 0-120 passes) | AIF Age >= 0 AND Age <= 120 THEN OUTPUT "Accepted" ENDIF | |
| 2DOB: 12/04/2008 typed instead of 12/04/2006 (format check passes) | BIF Age1 <> Age2 THEN OUTPUT "Please re-enter" ENDIF | |
| 3Validation checks that data is reasonable and in the right form, not that it is correct | CThe date is in the correct format, so validation accepts it, but it is not the person's real date of birth. | |
| 4Verification is also needed to catch valid but wrong data, for example by entering the data twice and comparing | DValidation only rejects unreasonable data. Typing mistakes that give a reasonable value, such as 15 for 51, get through, so verification is also needed. | |
| 5A range check on age passed, so the age must be correct. | EThe value is valid because it is in the allowed range, but it is still wrong. Validation cannot tell it is the wrong number. | |
| 6Validation is enough because it stops all typing mistakes. | FPassing validation does not prove the data is correct. 15 and 51 both pass a range check of 0 to 120, so a wrong age can still be accepted. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
valid but wrong — Validation only checks data is reasonable and in the right form, so a valid value can still be wrong, e.g. age 15 typed instead of 51. Verification is also needed.Age ← 15 // meant to type 51
Valid ← Age >= 0 AND Age <= 120
OUTPUT Valid // TRUE but still wrongDOB ← "05/11/2008" // typed wrong date
Valid ← LENGTH(DOB) = 10 // length check
OUTPUT Valid // TRUE even if date is wrongDECLARE Age : INTEGER
Age ← 15 // type check passes
OUTPUT Age // but 51 was meantOUTPUT "You entered ", Age
OUTPUT "Is this correct? Y/N"
INPUT ConfirmINPUT Age
INPUT AgeAgain
Matches ← Age = AgeAgain // double entry