Question 4(b)(iii) 2017 · May-June · Paper 33 · 4 marks
Reveal official mark-scheme answer
Official answer for Question 4
Part (b)
(iii)
Question 4
Show text version of question
Question 4
Part (b)
(iii)
Question 4
A bank has 95 000 customers. Each customer has a unique ID.
When a customer uses an Automated Teller Machine (ATM) to obtain cash, their current balance is checked. The balance is stored in a file which has the following fields:
- the customer ID (6-digit number in the range 100000 to 999999)
- an encrypted PIN
- the current balance
The file can store a maximum of 100 000 records. An algorithm for inserting a new record in this file uses the following hash function:
RecordKey CustomerID MOD 100000
where RecordKey is the record position in the file.
(iii)
A procedure is written to insert a new record into the file.
Complete the algorithm for this procedure.
PROCEDURE InsertRecord(CustomerID : INTEGER) RecordKey CustomerID MOD 100000 Success FALSE // Find position for new record and insert it REPEAT IF record at position RecordKey is ……………………… THEN Insert new record at position RecordKey Success TRUE ELSE IF RecordKey = ……………………… THEN RecordKey ……………………… ELSE RecordKey ……………………… + 1 ENDIF ENDIF UNTIL Success = TRUE ENDPROCEDURE
Why this question appears here
82% assigned-topic match · Programming › Constructs
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9608_s17_qp_33.pdf
