Six original Cambridge-style questions on file processing in 9618 pseudocode, including writing file-handling code and hashing calculations, with mark-scheme solutions.
Describe the difference between a serial, a sequential and a random file.
The text file Parts.txt holds one part code per line. A code that begins with the letter X is faulty. Write pseudocode for a procedure that reads every line and writes each faulty code to a new file Faulty.txt. It then outputs how many faulty codes were written.
A sequential file holds records with keys 105, 118, 140 and 162. Using the insertion method in this lesson, state the order of records in the new file when a record with key 170 is inserted, and explain which part of the algorithm writes it.
A random file stores records at the address Key MOD 200. (a) Calculate the address for keys 1450 and 2650. (b) State the problem this shows and one way of dealing with it.
A random file Accounts.dat holds records of type AccountRecord, which has fields AccountNo (INTEGER) and Balance (REAL). The record for account number AccNum is at address AccNum MOD 1000. Write pseudocode to add 25.00 to the balance of the account whose number is in AccNum.
A cinema stores seat bookings. The booking office must find and update a single seat instantly, and once a night every booking is printed in seat order. Recommend a file organisation and justify it.
Mark this once you have attempted all six and checked your working. It records a Practiced badge on the topic and adds a one-time bonus. Revealing the solutions alone does not count.