Skip to main content
A-LevelComputer ScienceProgramming9618/21 · May/June 2024 · Q58 Marks

A global 1D array of strings contains three elements which are assigned values as shown: Data[1] ← "aaaaaa" Data[2] ← "bbbbbb" Data[3] ← "cccccc" Procedure Process() manipulates the values in the array. The procedure is written in pseudocode as follows: PROCEDURE Process (Format : STRING) DECLARE Count, Index, L : INTEGER DECLARE Result : STRING DECLARE C : CHAR Result ← "****" FOR Count ← 1 TO LENGTH(Format) STEP 2 C ← MID(Format, Count, 1) L ← STR_TO_NUM(MID(Format, Count + 1, 1)) Index ← (Count + 1) DIV 2 CASE OF C 'X' : Result ← TO_UPPER(Data[Index]) 'Y' : Result ← TO_LOWER(Data[Index]) 'Z' : Result ← "**" & Data[Index] ENDCASE Data[Index] ← LEFT(Result, L) NEXT Count ENDPROCEDURE

  1. (a)Complete the trace table by dry running the procedure when it is called as follows: CALL Process("X3Y2W4") Count C L Index Result Data[1] Data[2] Data[3][6]
  2. (b)(i)The procedure is to be modified. If variable c is assigned a value other than 'x', 'Y' or 'Z', then procedure Error() is called and passed the value of variable c as a parameter. This modification can be implemented by adding a single line of pseudocode. (i) Write the single line of pseudocode.[1]
  3. (b)(ii)(ii) State where this new line should be placed.[1]

Mark scheme

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

  1. [6] One mark per zone.
  2. [1] OTHERWISE : CALL Error(C)
  3. [1] After the 'z' clause in the CASE construct // before the ENDCASE

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