Question 4(d) 2018 · October-November · Paper 22 · 3 marks
Reveal official mark-scheme answer
Official answer for Question 4
Part (d)
Question 3
Show text version of question
Question 4
Part (d)
Question 4
Part of a program written in pseudocode is shown.
010 DECLARE NextArrayElement : INTEGER
…
100 FUNCTION ScanFile(SearchString: STRING) RETURNS INTEGER 101 102 DECLARE FileData : STRING 103 DECLARE FileLine : INTEGER 104 105 NextArrayElement 1 106 FileLine 1 107 FileData ReadFileLine("DataFile.txt", FileLine) 108 109 WHILE FileData <> "" 110 IF LEFT(FileData, 7) = SearchString 111 THEN 112 ResultArray[NextArrayElement] FileData 113 NextArrayElement NextArrayElement + 1 114 ENDIF 115 FileLine FileLine + 1 116 FileData ReadFileLine("DataFile.txt", FileLine) 117 ENDWHILE 118 119 CALL ScanCompleted() 120 RETURN FileLine 121 122 ENDFUNCTION
Part (d)
ResultArray is a 1D array of type STRING. It contains 100 elements.
Write program code to declare ResultArray and set all elements to the value "NO DATA".
Programming language .............................................................................................................
Program code
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
Question 13
Question 5 begins on the next page.
Question 14
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_22.pdf
