7.1.6 Outline direct access file organiation.
Teaching Note:
A direct access file can have unordered records. Students should be able to outline how records can be retrieved via a calculation followed by direct access.
Sample Question 1:
A company making car parts keeps a computerised file of records containing the name,
code and price of each item it has for sale. Direct access will be used to access these
records whenever a sale is made.
(a) Suggest why direct access was chosen for this application. [2 marks]
(b) Explain how a hashing algorithm would be used in conjunction with the creation
of this file. [2 marks]
(c) Explain why the hashing algorithm should be carefully chosen. [2 marks]
The hashing algorithm to be used is shown below.
Address = key % 1000
(d) (i) Identify the record address generated for the key field 4231. [1 mark]
(ii) Suggest what would happen if, subsequently, a new record with the key
field 6231 was added to the file. [3 marks]
Sample Question 2:
(f) Suggest an alternative file organization method (to a question starting with sequential file orgnization - HL 2 May 2008, question 3), stating two reasons for your
choice. [4 marks]
JSR Notes: