Question 2(a)(ii) 2018 · May-June · Paper 21 · 1 mark
Reveal official mark-scheme answer
Official answer for Question 2
Part (a)
(ii)
Question 1
Show text version of question
Question 2
Part (a)
(ii)
Question 2
The following is a function design in pseudocode.
Line numbers are given for reference only.
01 FUNCTION StringClean(InString : STRING) RETURNS STRING 02 03 DECLARE NextChar : CHAR 04 DECLARE OutString : STRING 05 DECLARE Counter : INTEGER 06 DECLARE MyString : STRING 07 08 OutString "" 09 10 FOR Counter 1 TO LENGTH(InString)
Question 11
12 NextChar MID(InString,Counter,1) 13 NextChar LCASE(NextChar)
Question 14
15 IF (NextChar >= 'a') AND (NextChar <= 'z')
Question 16
17 THEN
Question 18
19 OutString OutString & NextChar
Question 20
21 ENDIF
Question 22
23 ENDFOR
Question 24
25 RETURN OutString
Question 26
27 ENDFUNCTION
(ii)
State one feature that could be added to make the pseudocode easier to understand.
.......................................................................................................................................[1]
Question 5
Why this question appears here
82% 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_s18_qp_21.pdf
