Past-paper question · 2018 May-June · Paper 23 · Q2(b)

Question 2(b) 2018 · May-June · Paper 23 · 9 marks

Original past-paper question for 2(B)
Original past-paper question for 2(B)
Original past-paper question for 2(B)
Reveal official mark-scheme answer Official mark-scheme answer for 2(B)

Official answer for Question 2

Part (b)

Question 9

✓
Feature
✓
Answer
✓
A line number containing an example of an
✓
8, 9, 10,12, 17,
✓
integer assignment statement
✓
34, 45
✓
A line number containing the start of a
✓
14, 19, 23
✓
selection structure
✓
A line number containing the end of a
✓
28, 29, 30
✓
selection structure
✓
The upper bound of the Mark array
✓
100
✓
The number of dimensions of the Mark array

Question 1

✓
The name for the type of loop structure used
✓
‘post condition’
✓
A line number containing an unnecessary

Question 10

✓
assignment statement
✓
The number of times that OUTPUT is called
✓
100
✓
The number of local variables

Question 4

Mark scheme 9608_s18_ms_23.pdf →

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 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

Part (b)

Study the function GradeCalc(). Identify the features of the function in the following table.

Feature Answer

A
line number containing an example of an integer assignment statement
A
line number containing the start of a selection structure
A
line number containing the end of a selection structure

The upper bound of the Mark array

The number of dimensions of the Mark array

The name for the type of loop structure used

A
line number containing an unnecessary assignment statement

The number of times OUTPUT is called

The number of local variables

[9]
Topic relevance

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

Keep practising this topic