Computer Science (AS & A Level) · May / June 2025 · Paper 22 · Question 7
9618
As printed in the paper
The question as text
A program is being developed to implement a customer loyalty scheme for a coffee shop. Each customer has a unique customer ID starting at 10001 with this value increasing by one each time a new customer joins the loyalty scheme. For example, the third customer who joins the loyalty scheme is given the customer ID 10003 The loyalty scheme is limited to 1000 customers. A customer is awarded a loyalty point every time they buy a coffee. The programmer has decided to use a global 2D array Loyalty of type INTEGER. The array Loyalty is made up of 1000 rows and 2 columns. Each row relates to one customer; column 1 contains the unique customer ID and column 2 contains the number of customer loyalty points. Rows in the array Loyalty that are not currently being used have the value of Column 1 set to 99999 The array is sorted in ascending order by customer ID. The programmer has defined a program module: Module Description FindCustomer() • called with parameter of type INTEGER representing a customer ID • searches the Loyalty array for this customer ID • the search will stop as soon as the customer ID is found • the search should efficiently deal with the situation when the customer ID is not stored in the Loyalty array • if the customer ID is found, return an integer value representing the loyalty points, otherwise return -1
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
7(a)[8]
7(b)[7]
7(c)(i)[1]
7(c)(ii)[2]
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

