Past-paper question · 2018 October-November · Paper 21 · Q4(a)(ii)

Question 4(a)(ii) 2018 · October-November · Paper 21 · 4 marks

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

Official answer for Question 4

Part (a)

(ii)

Question 1

mark for each mark point:

Question 4

✓
•
✓
Loop / repeat / iterate through array ResultArray one element at a time
✓
•
✓
extract a string from row / column 1 of the array
✓
•
✓
compare the string with SearchString
✓
•
✓
if they match, call SaveToFile() and increment NumberFound

Mark scheme 9608_w18_ms_21.pdf →

Show text version of question

Question 4

Part (a)

(ii)

Question 4

Part of a program written in pseudocode is shown.

01 DECLARE NumElements : INTEGER

…

10 FUNCTION ScanArray(SearchString : STRING) RETURNS INTEGER

Question 11

12 DECLARE ArrayIndex : INTEGER 13 DECLARE ArrayString : STRING 14 DECLARE NumberFound : INTEGER

Question 15

16 ArrayIndex 0 17 NumberFound 0

Question 18

19 FOR ArrayIndex 1 TO NumElements 20 ArrayString ResultArray[ArrayIndex, 1] 21 IF ArrayString = SearchString 22 THEN 23 CALL SaveToFile(ArrayString) 24 NumberFound NumberFound + 1 25 ENDIF 26 ENDFOR

Question 27

28 RETURN NumberFound

Question 29

30 ENDFUNCTION

(ii)

Describe in detail the purpose of lines 19 to 26 in the function ScanArray().

Do not use pseudocode in your answer.

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

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

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

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

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

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

.......................................................................................................................................[4]

Question 11

Topic relevance

Why this question appears here

82% assigned-topic match · Programming › Constructs

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_w18_qp_21.pdf

Keep practising this topic