Past-paper question · 2021 May-June · Paper 21 · Q4(b)

Question 4(b) 2021 · May-June · Paper 21 · 2 marks

Original past-paper question for 4(B)
Original past-paper question for 4(B)
Original past-paper question for 4(B)
Reveal official mark-scheme answer Official mark-scheme answer for 4(B)

Official answer for Question 4

Part (b)

✓
One mark for each:

Question 2

✓
•
✓
The IDE displays hints / choice of keywords / available identifiers
✓
•
✓
(Appropriate to) the current cursor position / insertion point
✓
9608/21
✓
Cambridge International AS & A Level – Mark Scheme
✓
May/June 2021
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9608_s21_ms_21.pdf →

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.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................

[2]
Topic relevance

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

Keep practising this topic