Skip to main content
A-LevelComputer ScienceProgramming9618/23 · May/June 2024 · Q27 Marks

A program uses a global 1D array of type string and a text file. An algorithm that forms part of the program is expressed as follows: • copy the first line from the file into the first element of the array • copy the second line from the file into the second element of the array • continue until all lines in the file have been copied into the array. Stepwise refinement is applied to the algorithm. Outline five steps for this algorithm that could be used to produce pseudocode. Assume there are more elements in the array than lines in the file. Do not use pseudocode statements in your answer.

  1. (a)Outline five steps for this algorithm that could be used to produce pseudocode. Assume there are more elements in the array than lines in the file. Do not use pseudocode statements in your answer. Step 1 Step 2 Step 3 Step 4 Step 5[5]
  2. (b)Sequence is one programming construct. Identify one other programming construct that will be required when the algorithm from part (a) is converted into pseudocode and explain its use. Construct Use[2]

Mark scheme

Marking points from the official mark scheme (May/June 2024). The mark or mark type is shown in brackets.

  1. [1] (a) Open the file (in read mode and subsequently close)
  2. [1] (a) Initialise an index variable (to 1 // 0)
  3. [1] (a) Repeat (the next three steps) until the end of file is reached
  4. [1] (a) Read a line from the file (into a string variable)
  5. [1] (a) Store the line / variable in the array at the index
  6. [1] (a) Increment the index in a loop
  7. [1] (b) Construct: a conditional loop
  8. [1] (b) Use: To keep repeating until the end of the file is reached
  9. [1] (b) ALTERNATIVE: Construct: a selection statement
  10. [1] (b) Use: To test / check the value returned by the EOF () function

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, 7 marks.
Source
A-Level Computer Science, May/June 2024 Paper 2 Variant 3, question 2.

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