Question 3 2019 · October-November · Paper 21 · 7 marks
Reveal official mark-scheme answer
Official answer for Question 3
Question 7
Question 3
Question 20
Show text version of question
Question 3
The following is a function design in pseudocode.
Line numbers are given for reference only.
10 FUNCTION Check(InString : STRING) RETURNS BOOLEAN
Question 11
12 DECLARE NumDots : INTEGER 13 DECLARE Index : INTEGER 14 DECLARE NumOthers : INTEGER
Question 15
16 NumDots 0 17 NumOthers 0 18 Index 1
Question 19
20 WHILE NumDots < 3 AND Index <= LENGTH(InString)
Question 21
22 IF MID(InString, Index, 1) = '.' 23 THEN 24 NumDots NumDots + 1 25 ELSE 26 NumOthers NumOthers + 1 27 ENDIF 28 Index Index + 1
Question 29
30 ENDWHILE
Question 31
32 IF NumDots = NumOthers 33 THEN 34 RETURN TRUE 35 ELSE 36 RETURN FALSE 37 ENDIF
Question 38
39 ENDFUNCTION
Question 7
Study the pseudocode. Identify the relevant features in the following table.
Refer to the Appendix on pages 16–17 for the list of built-in functions and operators.
Feature Answer
The number of the line containing a variable being incremented
The range of line numbers containing a pre-condition loop
The number of initialisation statements
The number of the line containing a logical operator
The range of line numbers containing a selection statement
The name of a built-in function
The name of a parameter
Question 8
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_w19_qp_21.pdf
