Past-paper question · 2018 October-November · Paper 23 · Q4(d)(i)

Question 4(d)(i) 2018 · October-November · Paper 23 · 3 marks

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

Official answer for Question 4

Part (d)

(i)

✓
Pseudocode solution included here for development and clarification of mark

Question 3

✓
scheme.
✓
Programming language solutions appear at the end of this mark scheme.
✓
DECLARE i : INTEGER
✓
FOR i ← 1 to 200
✓
IF CharArray[i] >= '0' AND CharArray[i]<= '9'
✓
THEN
✓
CharArray[i] ← '*'
✓
ENDIF
✓
ENDFOR
✓
1 mark for each of the following:
✓
•
✓
looping through 200 elements
✓
•
✓
selection statement
✓
•
✓
assignment of ‘*’

Mark scheme 9608_w18_ms_23.pdf →

Show text version of question

Question 4

Part (d)

(i)

Question 4

Part of a program written in pseudocode is shown.

010 DECLARE ThisArray : ARRAY [1:100, 1:10] OF STRING 011 DECLARE LastElement : INTEGER

… 100 FUNCTION Update(NewData : STRING) RETURNS INTEGER 101 DECLARE ArrayIndex : INTEGER 102 DECLARE Found : BOOLEAN 103 104 ArrayIndex 1 105 Found FALSE 106 107 WHILE ArrayIndex <= LastElement AND Found = FALSE 108 IF ThisArray[ArrayIndex, 1] > NewData 109 THEN 110 Found TRUE 111 ELSE 112 ArrayIndex ArrayIndex + 1 113 ENDIF 114 ENDWHILE 115 116 IF Found = TRUE 117 THEN 118 CALL Insert(ArrayIndex, NewData) 119 ELSE 120 ArrayIndex 0 121 ENDIF 122 123 RETURN ArrayIndex 124 ENDFUNCTION

(i)

CharArray is a 1D array of type CHAR. It contains 200 elements.

Write program code to change all the numeric characters ('0' to '9') in CharArray to '*'.

Programming language .....................................................................................................

Program code

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

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

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

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

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

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

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

.......................................................................................................................................[3]

Topic relevance

Why this question appears here

91% 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_w18_qp_23.pdf

Keep practising this topic