A function TestNum() will take a six-digit string as a parameter. The function will test whether the string meets certain conditions and will return an integer value as follows: Return value | Condition | Example -------------|----------------------------------------------|---------- 1 | The last three digits are the same but non-zero. | "253444" 2 | The last three digits are zero. | "253000" 3 | The first three and last three digits are the same. | "410410" The function will return the highest possible value for the given string. If the string does not meet any of the conditions, zero is returned.
- Write pseudocode for function TestNum(). Assume that the parameter is valid.[6]
Mark scheme
Marking points from the official mark scheme (Oct/Nov 2023). The mark or mark type is shown in brackets.
- 6 MP1 Function heading and ending including parameter and return type
- 6 MP2 Test for Condition 1
- 6 MP3 Test for Condition 2
- 6 MP4 Test for Condition 3
- 6 MP5 Return the highest value if more than one condition is satisfied
- 6 MP6 Return zero if no condition matched
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 →