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

A program is being designed in pseudocode. The program contains the following declaration: DECLARE Data : ARRAY[1:1000] OF STRING A procedure ArrayInitialise() is written to initialise the values in the array: PROCEDURE ArrayInitialise(Label : STRING) DECLARE Index : INTEGER Index ← 1 WHILE Index <= 1000 CASE OF (Index MOD 2) 0 : Data[Index] ← FormatA(Label) Index ← Index + 1 1 : Data[Index] ← FormatB(Label) Index ← Index + 1 ENDCASE ENDWHILE ENDPROCEDURE Functions FormatA() and FormatB() apply fixed format case changes to the parameter string.

  1. (a)The design of the procedure does not use the most appropriate loop construct. Suggest a more appropriate construct that could be used and explain your choice. Construct Explanation[2]
  2. (b)The algorithm calls one of the functions FormatA() and FormatB() each time within the loop. Explain why this is not efficient and suggest a more efficient solution.[4]

Mark scheme

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

  1. [1] (a) Construct: Count-controlled loop
  2. [1] (a) Explanation: the number of iterations is known
  3. [1] (b) The functions will return the same value every time they are called
  4. [1] (b) ... because Label / the parameter value does not change within the loop
  5. [1] (b) Assign FormatA(Label) and FormatB(Label) to two (local) variables before the loop
  6. [1] (b) Use the (new) variables in place of the function calls / in the loop // Replace the references to FormatA() and FormatB() in the CASE clauses with the new variable names

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