Skip to main content
A-LevelComputer ScienceProgramming9618/22 · Oct/Nov 2021 · Q510 Marks

A company has several departments. Each department stores the name, email address and the status of each employee in that department in its own text file. All text files have the same format. Employee details are stored as three separate data strings on three consecutive lines of the file. An example of the first six lines of one of the files is as follows: File line Comment 1 First employee name 2 First email address 3 First employee status 4 Second employee name 5 Second email address 6 Second employee status A procedure MakeNewFile() will: • take three parameters as strings: ◦ an existing file name ◦ a new file name ◦ a search status value • create a new text file using the new file name • write all employee details to the new file where the employee status is not equal to the search status value • count the number of sets of employee details that were in the original file • count the number of sets of employee details that were written to the new file • produce a summary output. An example summary output is as follows: File Marketing contained 54 employee details 52 employee sets of details were written to file NewMarketingList

  1. (a)Write pseudocode for the procedure MakeNewFile().[7]
  2. (b)(i)An alternative format could be used for storing the data. A text file will still be used. Describe the alternative format.[1]
  3. (b)(ii)An alternative format could be used for storing the data. A text file will still be used. State one advantage and one disadvantage of the alternative format. Advantage Disadvantage[2]

Mark scheme

Marking points from the official mark scheme (Oct/Nov 2021). The mark or mark type is shown in brackets.

  1. [1] PROCEDURE MakeNewFile(OldFile, NewFile, Status : STRING) ... ENDPROCEDURE
  2. [1] DECLARE Line1, Line2, Line3 : STRING
  3. [1] DECLARE NumCopied, NumRecs : INTEGER
  4. [1] OPENFILE OldFile FOR READ, OPENFILE NewFile FOR WRITE and subsequently CLOSE both files
  5. [1] WHILE NOT EOF(OldFile) ... ENDWHILE
  6. [1] READFILE OldFile, Line1, READFILE OldFile, Line2, READFILE OldFile, Line3
  7. [1] NumRecs ← NumRecs + 1
  8. [1] IF Line3 <> Status THEN WRITEFILE NewFile, Line1, WRITEFILE NewFile, Line2, WRITEFILE NewFile, Line3
  9. [1] NumCopied ← NumCopied + 1
  10. [1] Final OUTPUT including both counts and file names with suitable text after a loop
  11. [1] Store all three items on one line
  12. [1] Advantage: Fewer file operations required
  13. [1] Disadvantage: Algorithm to combine / extract individual data items is more complex

Write your answer and get it marked

On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.

Sign up free →

About this question

Topic
Programming, A-Level Computer Science (syllabus 9618). Structured question, 10 marks.
Source
A-Level Computer Science, Oct/Nov 2021 Paper 2 Variant 2, question 5.

Questions and mark schemes are from past examination papers and remain the copyright of the exam board. How Oracle Prep builds its content

Related Computer Science questions

© 2026 Oracle Prep