Computer Science (9618) · Oct/Nov 2024 · Mark scheme 21

Cambridge Computer Science (9618) mark scheme for paper 21, Oct/Nov 2024 — 9618/21/O/N/24, file 9618_w24_ms_21.pdf.

Advertisement
Loading the paper…
Text of this paper

www.dynamicpapers.com

Cambridge International AS & A Level
COMPUTER SCIENCE

9618/21

Paper 2 Fundamental Problem-solving and Programming Skills

October/November 2024

MARK SCHEME
Maximum Mark: 75

Published

This mark scheme is published as an aid to teachers and candidates, to indicate the requirements of the
examination. It shows the basis on which Examiners were instructed to award marks. It does not indicate the
details of the discussions that took place at an Examiners’ meeting before marking began, which would have
considered the acceptability of alternative answers.
Mark schemes should be read in conjunction with the question paper and the Principal Examiner Report for
Teachers.
Cambridge International will not enter into discussions about these mark schemes.
Cambridge International is publishing the mark schemes for the October/November 2024 series for most
Cambridge IGCSE, Cambridge International A and AS Level components, and some Cambridge O Level
components.

This document consists of 13 printed pages.
© Cambridge University Press & Assessment 2024

[Turn over

9618/21

October/November
www.dynamicpapers.com

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

2024

Generic Marking Principles
These general marking principles must be applied by all examiners when marking candidate answers.
They should be applied alongside the specific content of the mark scheme or generic level
descriptions for a question. Each question paper and mark scheme will also comply with these
marking principles.
GENERIC MARKING PRINCIPLE 1:
Marks must be awarded in line with:
•
•
•

the specific content of the mark scheme or the generic level descriptors for the question
the specific skills defined in the mark scheme or in the generic level descriptors for the question
the standard of response required by a candidate as exemplified by the standardisation scripts.

GENERIC MARKING PRINCIPLE 2:
Marks awarded are always whole marks (not half marks, or other fractions).
GENERIC MARKING PRINCIPLE 3:
Marks must be awarded positively:
•
•
•
•
•

marks are awarded for correct/valid answers, as defined in the mark scheme. However, credit
is given for valid answers which go beyond the scope of the syllabus and mark scheme,
referring to your Team Leader as appropriate
marks are awarded when candidates clearly demonstrate what they know and can do
marks are not deducted for errors
marks are not deducted for omissions
answers should only be judged on the quality of spelling, punctuation and grammar when these
features are specifically assessed by the question as indicated by the mark scheme. The
meaning, however, should be unambiguous.

GENERIC MARKING PRINCIPLE 4:
Rules must be applied consistently, e.g. in situations where candidates have not followed
instructions or in the application of generic level descriptors.
GENERIC MARKING PRINCIPLE 5:
Marks should be awarded using the full range of marks defined in the mark scheme for the question
(however; the use of the full mark range may be limited according to the quality of the candidate
responses seen).
GENERIC MARKING PRINCIPLE 6:
Marks awarded are based solely on the requirements as defined in the mark scheme. Marks should
not be awarded with grade thresholds or grade descriptors in mind.

© Cambridge University Press & Assessment 2024

Page 2 of 13

9618/21

October/November
www.dynamicpapers.com

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Mark scheme abbreviations
/
//
underline
max
()

separates alternative words / phrases within a marking point
separates alternative answers within a marking point
actual word given must be used by candidate (grammatical variants accepted)
indicates the maximum number of marks that can be awarded
the word / phrase in brackets is not required, but sets the context

Note: No marks are awarded for using brand names of software packages or hardware.

© Cambridge University Press & Assessment 2024

Page 3 of 13

2024

October/November
www.dynamicpapers.com

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

9618/21

Question
1(a)

Answer
One mark per point:

2024

Marks
2

Error: The calculation of TaxPayable is incorrect
Correction: TaxPayable  (ItemCost * TaxRate) / 100
1(b)(i)

Use constants (to represent the tax rate values)

1

1(b)(ii)

One mark per bullet point (or equivalent to max 3):

3

1
2
3

4
1(c)

Tax rates are entered once only
Avoids / Minimise (input) error(s) / changing the Tax rates accidentally //
avoids different values for tax rates at different points in the program
When required, the constant value (representing a tax rate) is changed
(once) // Easier to maintain / update the program (when the tax rates
change)
Makes the program / code easier to understand

One mark per row:

2

Variable name

1(d)

Data type

HighRate

Boolean

TaxPayable

Real

OTHERWISE

© Cambridge University Press & Assessment 2024

1

Page 4 of 13

October/November
www.dynamicpapers.com

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

9618/21

Question
2

Answer
Example solution:

2024

Marks
6

PROCEDURE Tick()
SS  SS + 1
IF SS = 60 THEN
SS  0
MM  MM + 1
IF MM = 60 THEN
MM  0
HH  HH + 1
IF HH = 24 THEN
HH  0
CALL NewDay()
ENDIF
ENDIF
CALL CheckAlarm()
ENDIF
ENDPROCEDURE
Mark as follows:
1 Increment SS anywhere in the code
2 Call CheckAlarm() when SS is set to zero
3 Test if SS = 60 anywhere in the code …
if so:
4 set SS to 0
5 increment MM
6 When MM is set to 60 set MM to 0 and increment HH
7 When HH is set to 24 set HH to 0 and call NewDay()
Max 6 marks
Question
3(a)

Answer
One mark per emboldened part:
1
2
3
4
5
6
7
8

4

Open the file (Result.txt) in read mode
Loop until EOF(Result.txt) // EOF // end of file
Read a / the / next line (from the file) and store in ThisLine
Assign LineY to LineX
Assign LineZ to LineY
Assign ThisLine to LineZ
After the loop, close the file (Result.txt)
Output LineX, LineY, LineZ

© Cambridge University Press & Assessment 2024

Marks

Page 5 of 13

October/November
www.dynamicpapers.com

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

9618/21

Question
3(b)

Answer
Example answer:

2024

Marks
1

So that the last three lines of the file are output in the correct order
A mark for mentioning one of:
• (Ensuring) the lines are output in correct order
• Ordering the last three lines
• Ordering the lines so they are in the same order as (they occur) in the file
Max 1 marks
3(c)

Two loop solution

4

One mark per point:

2

Loop until given line number (-1) / <parameter> (-1) (lines have been
read)
... if end of file is reached then return FALSE

3
4
5

Loop for three lines // Read three lines // Repeat of 4 and 5 for three lines
Read a line and output it
... if end of file is reached then return FALSE

6

After outputting the (required) lines return TRUE

7

Ordering of lines no longer needed

1

Max 4 marks
Alternative solution
One loop solution mark scheme that reads to given line number + 2
One mark per point
1
2
3
4
5
6
7

Loop until given line number + 2 / <parameter> + 2 (lines have been
read)
OR end of file is reached
Return FALSE if EOF reached
Read a line from the file in the loop
Continue to order the last three lines read in the loop // Steps 4 to 6 stay
the same
(If FALSE has not been returned) output the required three lines (in the
correct order)
… and Return TRUE

Max 4 marks

© Cambridge University Press & Assessment 2024

Page 6 of 13

9618/21

October/November
www.dynamicpapers.com

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
4(a)

Answer
One mark per point:

2024

Marks
2

Type: Run-time error
Cause: A divide by zero operation is attempted // Attempt to convert a nonnumeric string to a number
4(b)

Answers include:

2

Reason:
• This part of the algorithm performs a specific task // if the check or
calculation is changed it is changed only once
• A (similar) subroutine is already available // Library routine is already
available
• The program is simplified / easier to understand / easier to design / code /
test / debug / maintain
Max 1 marks for 'Reason'
Avoided:
• Unnecessary code duplication
• Errors caused by differences where several copies of the check and
calculation exist
Max 1 marks for 'Avoided'

© Cambridge University Press & Assessment 2024

Page 7 of 13

October/November
www.dynamicpapers.com

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

9618/21

Question
4(c)

Answer
Example solution:

RetVal.Done  FALSE
IF IS_NUM(NumStr1) = TRUE AND IS_NUM(NumStr2) = TRUE
THEN
Num1  STR_TO_NUM(NumStr1)
Num2  STR_TO_NUM(NumStr2)
IF Num2 <> 0 THEN
RetVal.Value  (Num1 / Num2)
RetVal.Done  TRUE
ENDIF
ENDIF
RETURN RetVal
ENDFUNCTION
Note that order of parameters is not specified so divisor could be either
parameter.
Mark as follows:
Function heading, parameters, ending
... Correct return type of Result
Local declaration of type Result
Attempt at using IS_NUM() to check both parameters/strings
Attempt at using of STR_TO_NUM() to convert both parameters/strings
Check if the divisor, is non-zero ...
… and if so correct calculation and assignment to Value field
Return variable of type Result having assigned both fields

Max 6 marks

© Cambridge University Press & Assessment 2024

Marks
6

FUNCTION Evaluate(NumStr1, NumStr2 : STRING) RETURNS
Result
DECLARE RetVal : Result
DECLARE Num1, Num2 : REAL

1
2
3
4
5
6
7
8

2024

Page 8 of 13

October/November
www.dynamicpapers.com

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

9618/21

Question

Answer

2024

Marks

5(a)

Name of life
cycle stage

Activity
The walkthrough method is used.

Testing

An algorithm is implemented in a programming language.

Coding

The client is interviewed about problems with the current
system.

Analysis

The program is modified to run on new hardware.

Maintenance

Records and file structures are defined.

Design

5

One mark per row
5(b)(i)

One mark per row
Type of test data

4
Test data value

Expected result

12 (< 23)

FALSE

Abnormal / Boundary / Extreme

23

FALSE

Boundary / Extreme

24

TRUE

Boundary

25

TRUE

Boundary

36

TRUE

Boundary /Extreme

37

TRUE

Abnormal / Boundary / Extreme

38

FALSE

99 (> 38)

FALSE

Abnormal

Abnormal
Max 4 marks
5(b)(ii)

Integration (testing)

Question
6(a)

1
Answer

One mark per point:
1
2
3

2

Fewer lines of code are needed
The program is simpler/ less complex // Program is easier to design /
code / maintain / modify / test / debug
Direct access to days in a month / data (using month number as index) //
Can use index / month to (directly) access days in month / data

Max 2 marks

© Cambridge University Press & Assessment 2024

Marks

Page 9 of 13

October/November
www.dynamicpapers.com

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

9618/21

Question
6(b)

Answer
Example Solution

DD  DAY(ProductionDate)
MM  MONTH(ProductionDate)
YY  YEAR(ProductionDate)
DD  DD + ShelfLife
LastDay  DaysInMonth[MM]
IF DD
MM
DD
IF

> LastDay THEN
 MM + 1
 DD – LastDay
MM = 13 THEN
MM  1
YY  YY + 1
ENDIF
ENDIF
NewDate  SETDATE(DD, MM, YY)
RETURN NewDate
ENDFUNCTION
Mark as follows:

3
4
5
6
7
8
9

Declare three variables of TYPE INTEGER to store DD, MM and YY
Correct use of date functions from Insert to extract three integer values
representing DD, MM and YY and use/assign to a variable
Add parameter ShelfLife to DD and use / assign result to a variable
Extract LastDay from DaysInMonth using MM as Index
Test for new DD after end of month / DaysInMonth[MM]
… and if DD > DaysInMonth[MM]:
MM is incremented by 1 and DD is set to DD –
DaysInMonth[MM]
If MM = 13 / MM > 12 then increment YY and set MM to 1
Use of SETDATE to assign value to NewDate, NewDate must have been
delared as a type DATE
Return date

Max 7 marks

© Cambridge University Press & Assessment 2024

Marks
7

FUNCTION GetDate(ProductionDate : DATE, ShelfLife :
INTEGER) RETURNS DATE
DECLARE NewDate : DATE
DECLARE DD, MM, YY, LastDay : INTEGER

1
2

2024

Page 10 of 13

9618/21

October/November
www.dynamicpapers.com

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question

Answer

7(a)

2024

Marks
5

One mark per point:
1 All module identified in correct hierarchy
2 Parameters to both Sync and Activate and return values
3 Parameters to both Reset and Enable
4 Parameters to Initialise
5 Decision diamond
7(b)

Explanation:

2

Means that Sync repeatedly calls Reset and (then) Enable
One mark for each point:
MP1: reference to iteration
MP2: naming all three modules correctly including correct sequence of calls

© Cambridge University Press & Assessment 2024

Page 11 of 13

9618/21

October/November
www.dynamicpapers.com

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
8(a)

2024

Answer

Marks

Loop example solution

6

FUNCTION CheckMark(Mark : INTEGER) RETURNS BOOLEAN
DECLARE Index, Lower, Upper : INTEGER
FOR Index  1 TO 5
Lower  GradeBoundary[Index] - 2
Upper  GradeBoundary[Index] + 2
IF Mark >= Lower AND Mark <= Upper THEN
RETURN TRUE
ENDIF
NEXT Index
RETURN FALSE
ENDFUNCTION
Mark as follows:
1 Loop through all elements in GradeBoundary array
2 Attempt to calculate range, both Lower and Upper, in a loop
3 Completely correct range calculation in a loop
4 Test if given mark / parameter, is within range in a loop
5 Set variable / immediate RETURN if recheck required in a loop
6 Return Boolean in both cases following a reasonable attempt
Selection example solution
FUNCTION CheckMark(Mark : INTEGER) RETURNS BOOLEAN
CASE OF Mark
GradeBoundary[1] – 2 TO GradeBoundary[1] + 2 :
RETURN
GradeBoundary[2] – 2 TO GradeBoundary[2] + 2 :
RETURN
GradeBoundary[3] – 2 TO GradeBoundary[3] + 2 :
RETURN
GradeBoundary[4] – 2 TO GradeBoundary[4] + 2 :
RETURN
GradeBoundary[5] – 2 TO GradeBoundary[5] + 2 :
RETURN
OTHERWISE : RETURN FALSE
ENDCASE
ENDFUNCTION
Mark as follows:
1 Correct syntax used for selection structure(s)
2 Correct checks for two ranges
3 Correct checks for three ranges
4 Correct checks for four ranges
5 Correct checks for all five ranges
6 Return Boolean in both cases following a reasonable attempt

© Cambridge University Press & Assessment 2024

Page 12 of 13

TRUE
TRUE
TRUE
TRUE
TRUE

9618/21

October/November
www.dynamicpapers.com

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
8(b)

Answer
Example Solution:

2024

Marks
8

PROCEDURE CheckAll(CNum : INTEGER)
DECLARE Index, Count, ThisMark: INTEGER
Count  0
OPENFILE "GRList.txt" FOR WRITE
FOR Index  1 to CNum
ThisMark  Result[Index, 1] // 2D array: mark + ID
IF CheckMark(ThisMark) = TRUE THEN
WRITE "GRList.txt", NUM_TO_STR(Result[Index, 2])
Count  Count + 1
ENDIF
NEXT Index
CLOSEFILE "GRList.txt"
OUTPUT "There are ", Count, " papers to check"
ENDPROCEDURE
Mark as follows:
1 Procedure heading, parameter and ending.
2 Open file in write mode and subsequently close
3 Loop through all CNum candidates
4
Extract candidate mark from Result array in a loop
5
Use of CheckMark() with candidate mark as parameter in a loop
6
Test return value and if TRUE then increment Count in a loop
7
... write ID to file ...
8
... after conversion to a string in a loop
9 Final output of message giving number of papers to check not in a loop
Max 8 marks
8(c)

The file will need to be opened in APPEND mode

© Cambridge University Press & Assessment 2024

Page 13 of 13

1

Advertisement