Question 4(b) 2021 · May-June · Paper 21 · 2 marks
Reveal official mark-scheme answer
Official answer for Question 4
Part (b)
Question 2
Show text version of question
Question 4
Part (b)
Question 4
The following is part of a program written in pseudocode:
DECLARE ThisArray : ARRAY[1:1000] OF STRING DECLARE ArrayResult : INTEGER
PROCEDURE ScanArray(SearchString : STRING)
DECLARE Index, Total : INTEGER DECLARE Error : BOOLEAN
Index 1 Total 0 Error FALSE
WHILE Index <= 1000 AND Error <> TRUE IF LENGTH(ThisArray[Index]) > 5 THEN IF ThisArray[Index] = SearchString THEN Total Total + LENGTH(ThisArray[Index]) ENDIF Index Index + 1 ELSE Error TRUE ENDIF ENDWHILE
ArrayResult INT(Total / (Index - 1))
ENDPROCEDURE
The procedure ScanArray() is amended as follows:
- SearchString is compared with just the first four characters of each array element.
- The total ignores the first five characters of each array element.
- When calculating ArrayResult, prevent any possible division by zero.
Refer to the Appendix on pages 22–23 for the list of built-in pseudocode functions and operators.
Question 11
Part (b)
Context-sensitive prompts are a feature of a typical Integrated Development Environment
(IDE).
Explain the term context‑sensitive prompt.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................
Why this question appears here
72% assigned-topic match · Data types and structures › Data types and records
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 9608_s21_qp_21.pdf
