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.
- (a)Identify three validation checks and state how each check would make sure the product code met one of these rules.[6]
- (b)(i)Write the pseudocode to make sure that the product code is six characters in length.[2]
- (b)(ii)Write the pseudocode to make sure that the first two characters of the product code are "PD".[2]
Mark scheme
Marking points from the official mark scheme (May/June 2024). The mark or mark type is shown in brackets.
- One mark per mark point
- MP1 length check ...
- MP2 ... to ensure the product code entered is 6 characters in length
- MP3 format check ...
- MP4 ... to ensure the first two characters of the product code entered are "PD"
- MP5 range check ...
- MP6 ... to ensure that the value of the last four figures of the product code entered is between 1000 and 9999
- One mark for correct use of LENGTH operation, one mark for appropriate test
- Example:
- REPEAT
- INPUT Product
- UNTIL LENGTH(Product) = 6
- One mark for correct use of SUBSTRING operation, one mark for appropriate test
- Example:
- REPEAT
- INPUT Product
- UNTIL SUBSTRING(Product, 1, 2) = "PD"
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →