Computer Science (AS & A Level) · May / June 2024 · Paper 21 · Question 5
9618
As printed in the paper
The question as text
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
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
5(a)[6]
5(b)(i)[1]
5(b)(ii)[1]
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

