Question 2(c)(i) 2018 · May-June · Paper 23 · 2 marks
Reveal official mark-scheme answer

Official answer for Question 2
Part (c)
(i)
Question 2
- Mistake: function header specifies return of an INTEGER but line 37
- Correction: RETURN DGradeCount (as per code pseudocode
- Mistake: Statement on line 32 uses ‘&’ operator which concatenates
- Correction: Convert n to a STRING before concatenating
Question 9
- Mar k Scheme
Question 18
Show text version of question
Question 2
Part (c)
(i)
Question 2
The following is a function design in pseudocode.
Line numbers are given for reference only.
01 FUNCTION GradeCalc(Mark : ARRAY[] OF INTEGER) RETURNS INTEGER 02 03 DECLARE DGradeCount : INTEGER 04 DECLARE n : INTEGER 05 DECLARE Grade : STRING 06 DECLARE ThisMark : INTEGER 07 08 DGradeCount 0 // initialise variables 09 n 1 10 ThisMark 1 11 REPEAT 12 ThisMark Mark[n] // get next mark from Mark array
Question 13
14 IF ThisMark > 74 15 THEN 16 Grade "Distinction" 17 DGradeCount DGradeCount + 1 // one more Distinction 18 ELSE 19 IF ThisMark > 59 20 THEN 21 Grade "Merit" 22 ELSE 23 IF ThisMark > 39 24 THEN 25 Grade "Pass" 26 ELSE 27 Grade "Fail" 28 ENDIF 29 ENDIF 30 ENDIF
Question 31
32 OUTPUT "Grade for Student " & n & " is " & Grade
Question 33
34 n n + 1 35 UNTIL n = 101 // no more elements in the array
Question 36
37 RETURN Grade // return the number of Distinction grades
Question 38
39 ENDFUNCTION
Question 40
41 DECLARE Mark : ARRAY[1:100] OF INTEGER 42 DECLARE DistinctionGrades : INTEGER
Question 43
44 CALL GetMarks(Mark[]) // fill the array with student marks 45 DistinctionGrades GradeCalc(Mark[])
Question 5
(i)
There is a mistake in the pseudocode that would produce a data type mismatch error if a
programmer were to write similar program code.
Describe this mistake and how it may be corrected.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
Question 6
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_s18_qp_23.pdf
