Skip to content

9618 · 13.2

File organisation and access — practice questions

Practice and worked examples for 9618 File organisation and access. Short previews only — attempt the full question in MarkScheme against the official scheme.

Worked example 1

A sequential file on a magnetic tape stores 20,000 employee records. The system takes 0.8 ms to read a single record. Calculate the time taken, in seconds, to access the 15,000th record. State one assumption you have made.

Show solution outline

To access the 15,000th record sequentially, the system must read all records from the beginning up to that point.

Working:

  1. Number of records to read = 15,000
  2. Time per record = 0.8 ms
  3. Total time in milliseconds = 15,000 records * 0.8 ms/record = 12,000 ms
  4. Convert to seconds: 12,000 ms / 1000 = 12 seconds

Answer: 12 seconds.

Assumption: The time to read each record is constant and there are no other delays (e.g., from tape acceleration/deceleration or system interrupts).

Worked example 2

A random access file is used to store 1000 patient records, indexed from 0 to 999. The hashing algorithm used is Address=PatientIDMOD1000Address = PatientID MOD 1000.

(a) Calculate the storage address for a patient with ID 45821. (b) A new patient with ID 77821 needs to be added. Calculate their address and identify the problem that arises.

Show solution outline

(a) Address for Patient ID 45821:

  1. Apply the hashing algorithm: Address=45821MOD1000Address = 45821 MOD 1000
  2. The result of the MOD operator is the remainder after division. The remainder of 45821 divided by 1000 is 821.
  3. Address = 821

(b) Address for Patient ID 77821 and the problem:

  1. Apply the hashing algorithm: Address=77821MOD1000Address = 77821 MOD 1000
  2. The remainder of 77821 divided by 1000 is also 821.
  3. Address = 821

Problem: Both Patient IDs (45821 and 77821) hash to the same storage address (821). This is known as a collision or a synonym. The system cannot store two different records in the same physical location. A collision handling technique, such as placing the second record in an overflow area and creating a pointer to it, would be required.