File Access (Cambridge (CIE) A Level Computer Science): Revision Note

Exam code: 9618

Robert Hampton

Written by: Robert Hampton

Reviewed by: James Woodhouse

Updated on

What are file access methods?

  • Once a file is organised, a file access method is how records are read from or located in it

  • The access methods available depend on the file organisation used

Which access method works with which organisation?

File organisation

Sequential access

Direct access

Serial

Yes

No

Sequential

Yes

Yes (using an index)

Random

No

Yes (using hashing)

  • Sequential access works on serial and sequential files; direct access works on sequential and random files

Examiner Tips and Tricks

  • This matrix is a common exam trap.

  • Learn it exactly.

File access methods

Sequential access

  • Sequential access reads records one after the other, starting at the physical start of the file, and continues until the record is found or the end of the file is reached

On serial files

  • Records are in chronological order, so every record is checked until the target is found or all records have been checked

On sequential files

  • Records are in order of a key field (or index), and it is the key field that is compared

  • Checking can stop early: as soon as the current record's key is greater than the target key, the target cannot be present

  • Example: reading student results in candidate-number order

Direct access

  • Direct access locates a specific record without reading the records before it

  • The target is found using the key field of the record

On random files

  • A hashing algorithm is applied to the record's key field to calculate the address of the location where the record should be

  • If the record is not at that location (a collision has occurred), a resolution method such as linear probing or an overflow area is used (see Hashing)

  • Example: accessing a bank account record by account number

On sequential files

  • An index of all key fields is kept

  • The index is searched for the address of the file location where the target record is stored, and the record is then read directly

Examiner Tips and Tricks

  • Watch the direction of the pairing: direct access on a sequential file uses an index, but direct access on a random file uses a hashing algorithm. Questions often ask you to explain both in the same part.

  • "Sequential access" and "sequential organisation" are not the same thing. Serial files also use sequential access.

Unlock more, it's free!

Join the 100,000+ Students that ❤️ Save My Exams

the (exam) results speak for themselves:

Build on this topic

Robert Hampton

Author: Robert Hampton

Expertise: Curriculum Expert

Rob has over 16 years' experience teaching Computer Science and ICT at KS3 & GCSE levels. Rob has demonstrated strong leadership as Head of Department since 2012 and previously supported teacher development as a Specialist Leader of Education, empowering departments to excel in Computer Science. Beyond his tech expertise, Robert embraces the virtual world as an avid gamer, conquering digital battlefields when he's not coding.

James Woodhouse

Reviewer: James Woodhouse

Expertise: Portfolio Lead

James graduated from the University of Sunderland with a degree in ICT and Computing education. He has over 14 years of experience both teaching and leading in Computer Science, specialising in teaching GCSE and A-level. James has held various leadership roles, including Head of Computer Science and coordinator positions for Key Stage 3 and Key Stage 4. James has a keen interest in networking security and technologies aimed at preventing security breaches.