Question 2(b) 2018 · May-June · Paper 21 · 9 marks
Reveal official mark-scheme answer

Official answer for Question 2
Part (b)
Question 9
Question 10
Question 23
Question 15
Question 3
Question 4
Question 5
Question 9
- Mar k Scheme
Question 18
Show text version of question
Question 2
Part (b)
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
Part (b)
Study the function StringClean(). Identify the features of the function in the following
table.
Feature Answer
The number of parameters of the MID function
The Boolean operator used
The number of local variables The number of function calls from within StringClean() resulting from the call: NewString StringClean("Me") The number of a line containing an unnecessary statement
Question 6
Why this question appears here
71% assigned-topic match · Programming › Structured programming
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
