IGCSE 0478/22 May/June 2024 · Question 4(a) · 6 marks
A program needs to make sure the characters input for a product code meet these rules: the product code is six characters in length; the first two characters must be “PD”; the last four characters must be a number in the range 1000 to 9999 inclusive. Identify three validation checks and state how each check would make sure the product code met one of these rules.
Points that gain marks
- A length check, to make sure the product code is 6 characters long.
- A format check, to make sure the first two characters are “PD”.
- A range check, to make sure the last four characters are a number from 1000 to 9999.
In this lab: Level 'Exam: a product code'.