Question 2(c)(ii) 2018 · May-June · Paper 23 · 4 marks
Reveal official mark-scheme answer
Official answer for Question 2
Part (c)
(ii)
Question 4
Question 1
Question 2
Question 3
Question 4
Show text version of question
Question 2
Part (c)
(ii)
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
(ii)
Lines 14 to 30 of the pseudocode on page 4 could be written using a CASE structure.
Write the equivalent CASE structure in pseudocode.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[4]
Question 7
Why this question appears here
99% 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
