Past-paper question · 2024 May-June · Paper 21 · Q5(a)

Question 5(a) 2024 · May-June · Paper 21 · 18 marks

Original past-paper question for 5(A)
Original past-paper question for 5(A)
Reveal official mark-scheme answer Official mark-scheme answer for 5(A)

Official answer for Question 5

Part (a)

Question 6

✓
One mark per zone.

Mark scheme 9618_s24_ms_21.pdf →

Show text version of question

Question 5

Part (a)

Question 5

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

Question 11

Part (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]
Topic relevance

Why this question appears here

71% assigned-topic match · Software development › Program testing and maintenance

Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.

Permanent source page: Educate A Change · From 9618_s24_qp_21.pdf

Keep practising this topic