Worked solution from the Algorithm design and problem-solving Paper 2 Algorithms, Programming and Logic booklet, Part 4 of 8.
Write: format check [1]
Give one value that follows the dd/mm/yyyy style and one that does not, with a reason each.
Normal data: 30/12/1960 [1]
Reason: it is written in the correct dd/mm/yyyy format, so it should be accepted [1]
Abnormal data: 30/Dec/1960 [1]
Reason: the month is not written as two digits, so it should be rejected [1]
A length check counts the characters entered.
The date must have exactly 10 characters (dd/mm/yyyy with two slashes) [1]
If it is too long or too short it is rejected [1]
▶ Whole paper
Video solution of the whole paper · by Paper solver.. Tap the picture to open it on YouTube.
Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.