Computer Science (9618) · May/June 2023 · Mark scheme 23

Cambridge Computer Science (9618) mark scheme for paper 23, May/June 2023 — 9618/23/M/J/23, file 9618_s23_ms_23.pdf.

Advertisement
Loading the paper…
Text of this paper

Cambridge International AS & A Level
COMPUTER SCIENCE

9618/23

Paper 2 Fundamental Problem-solving and Programming Skills

May/June 2023

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 May/June 2023 series for most
Cambridge IGCSE, Cambridge International A and AS Level and Cambridge Pre-U components, and some
Cambridge O Level components.

This document consists of 10 printed pages.
© UCLES 2023

[Turn over

9618/23

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

May/June 2023

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

© UCLES 2023

Page 2 of 10

9618/23

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question

Answer

Marks

1(a)

2
PCount

The name of the variable used as an array index

100

The number of elements in the array

1(c)
1(d)

One mark per point:

2

The (second dimension/index of the) array is declared from 1 to 50 but
the loop runs from 0 to 49

Line number: 10 / 100 / 101 / 102

Integer

1

One mark for each of rows 2 - 5

4

Pseudocode statement

Input

INPUT MyChoice

Process

Output

OUTPUT FirstName & LastName
WRITEFILE OutputFile, TextLine
READFILE MyFile, TextLine


Result  SQRT(NextNum)

Question
2(a)

Answer
One mark for each underlined part
IF DAYINDEX(MyDOB)

2(b)(i)

MP1
MP2

2(b)(ii)

MP1
MP2

© UCLES 2023

3

Answer
The dimension of the array

1(b)

May/June 2023

= 5

Marks
2

THEN

Value for month is between 1 and 12 (inclusive)
Value of year is <= 2002
Reference to month and day
Clear description for a check that the day number matches with a
relevant month
(Either day matches with month // month matches with day)

Page 3 of 10

2

2

9618/23

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
3(a)(i)

May/June 2023

Answer
6

Marks
1

3(a)(ii)

4

One mark for:
MP1 Values 'BBB' and 'AAA'
MP2 Values 'XXX' to 'PPP' (unchanged)
MP3 Both pointers and labelled22
MP4 Values of both variables
3(b)(i)

So that the data may be recovered / restored (the next time the program is
run)
// the data is permanently saved / data is not lost when the program
terminates

1

3(b)(ii)

Max 5 marks
MP1
Open the text file in WRITE mode
MP2
Check there is a value on the stack
MP3
POP value ….
MP4
Write value to the text file
MP5
Repeat from Step 2 // loop referencing the stack items

5

Alternative solution: Not using POP primitive
MP1
MP2
MP3
MP4
MP5
MP6

© UCLES 2023

Open the text file in WRITE mode
Check there is a value on the stack
Read value from ToS location
Write the value to the text file – Must some attempt at ‘the value’
NOT ‘all the values’
Decrement ToS
Repeat from step 2 // loop referencing the stack items

Page 4 of 10

9618/23

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

May/June 2023

Question

Answer

4

FUNCTION MakeString(Count : INTEGER, AChar : CHAR)
RETURNS STRING
DECLARE MyString : STRING
DECLARE Index : INTEGER

Marks
6

IF Count < 1 THEN
MyString  "ERROR"
ELSE
MyString  ""
FOR Index  1 TO Count
MyString  MyString & AChar
NEXT Index
ENDIF
RETURN MyString
ENDFUNCTION
MP1
MP2
MP3
MP4
MP5
MP6

Function heading and end including parameters and return type
Declaration of locals Index and MyString
Test for Count < 1 and if true, assign "ERROR" to MyString /
Immediate RETURN
Loop for Count iterations
Use of concatenate – must have been initialised in a loop
Return STRING (correctly in both cases)

Question
5(a)

Answer

Marks
3

Max 3 marks
Additional Information:
MP1
The (program/source) code/specification
MP2
test plan // inputs/test data and expected outputs
Explanation:
MP3
The structure / design / algorithm of the program of the program
needs to be known
MP4
…. so that all paths through the program can be tested

5(b)

© UCLES 2023

Perfective

1

Page 5 of 10

9618/23

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
6(a)

May/June 2023

Answer

Marks
7

Max 7 marks
PROCEDURE
DECLARE
DECLARE
DECLARE

Select(Start, End : INTEGER)
ThisNum, Total: INTEGER
ThisString : STRING
Char1, Char2 : CHAR

FOR ThisNum  Start+1 TO End-1
ThisString  NUM_TO_STR(ThisNum)
Char1  RIGHT(ThisString, 1)
Char2  LEFT(RIGHT(ThisString, 2), 1)
Total  STR_TO_NUM(Char1) + STR_TO_NUM(Char2)
IF Total = 6 THEN
OUTPUT ThisString
ENDIF
NEXT ThisNum
ENDPROCEDURE
MP1
MP2
MP3
MP4
MP5
MP6
MP7
MP8

6(b)

Procedure heading and ending
(Count-controlled) Loop
…. with correct range from Start+1 to End-1
Convert ThisNum (loop counter) to a string
Extract the last two/first/second ’character digit(s)’ required in a
loop
Extract the second individual ‘character digit’ required in a loop
Calculate the sum of the last two digits
If sum = 6 then OUTPUT the number (either string or integer) in a
loop
4

Max 4 marks
MP1
MP2

The function will take two integer parameters - the number and the
(required) total
… and return a Boolean

OR:
CheckNum(Number,Total : INTEGER)
MP1

RETURNS BOOLEAN
MP2

Two marks for the advantages:
MP3
MP4
MP5

Question
7(a)(i)

© UCLES 2023

CheckNum()can be called repeatedly as and when required
CheckNum()is designed and tested once (then used repeatedly)
Any subsequent change to CheckNum() needs to be made once
only // is easier to maintain/modify

Answer

To filter out information (that is not necessary to solve the problem) //
to include only essential information
Page 6 of 10

Marks
1

9618/23

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
7(a)(ii)

May/June 2023

Answer
Required:
Student :
Loan:
Book:

Marks
2

Student name / email (address)
Return/Issue date
Book title

Not Required:
Student:
Home address / DoB / tutor / subject choices
Book:
Library location / category / author / book title
7(a)(iii)

2

Max 2 marks
Examples could include:


7(b)

Clear the loan // indicate that the book has been returned // update loan
history
Take the student off 'block' // allow the student to borrow further books
Send acknowledgement to the student when book is returned

MP1
MP2
MP3
MP4

© UCLES 2023

3

Max 3 marks

All modules correctly labelled and interconnected.
Correct parameters and return type to Module-X and Reset
Correct parameters and return type to Module-Y and Replace
Correct parameters and return type to Overlay and Module-Y

Page 7 of 10

9618/23

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

May/June 2023

Question

Answer

8(a)

FUNCTION ChangeSupp(Code1, Code2 : STRING) RETURNS
INTEGER
DECLARE Count : INTEGER
DECLARE ThisLine, ThisCode : STRING
OPENFILE "Stock.txt" FOR READ
OPENFILE "NewStock.txt" FOR WRITE
Count  0
WHILE NOT EOF("Stock.txt")
READFILE("Stock.txt ", ThisLine) // brackets
optional
ThisCode  MID(ThisLine, 5, 3)
IF ThisCode = Code1 THEN
ThisLine  LEFT(ThisLine, 4) & Code2
& RIGHT(ThisLine,
LENGTH(ThisLine) - 7)
Count  Count + 1
ENDIF
WRITEFILE("NewStock.txt", ThisLine) // brackets
optional
ENDWHILE
CLOSEFILE "NewStock.txt"
CLOSEFILE "Stock.txt"
RETURN Count
ENDFUNCTION
MP1
MP2
MP3
MP4
MP5
MP6
MP7
MP8

© UCLES 2023

Open both files, in correct modes, and subsequently close
Conditional loop until EOF(“Stock.txt”)
Read a line from Stock.txt AND extract ThisCode in a loop
Test ThisCode = Code1 AND if true, increment Count (must
have been Initialised)in a loop
Update ThisLine using substring functions and '&' in a loop
completely correct update of ThisLine in a loop
Write ThisLine to NewStock.txt in a loop
Return count after loop

Page 8 of 10

Marks
8

9618/23

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

May/June 2023

Question

Answer

8(b)

PROCEDURE Report_1(Supp : STRING)
DECLARE Count : INTEGER
DECLARE ThisItemNum, ThisDesc, ThisLine, ThisCode :
STRING

Marks
6

Count  0
OPENFILE "Stock.txt" FOR READ
OUTPUT
OUTPUT
OUTPUT
OUTPUT

"Report for Supplier:" & Supp
""
//Blank line as per example
"Item
Description"
""
//Blank line as per example

WHILE NOT EOF("Stock.txt")
READFILE("Stock.txt", ThisLine)
ThisCode  Mid(ThisLine, 5, 3)
IF ThisCode = Supp THEN
ThisItemNum  LEFT(ThisLine, 4)
ThisDesc  RIGHT(ThisLine, LENGTH(ThisLine) - 7)
OUTPUT ThisItem & "
" & ThisDesc
Count  Count + 1
ENDIF
ENDWHILE
CLOSEFILE "Stock.txt"
OUTPUT "" //Blank line as per example
OUTPUT "Number of items listed: ", Count
ENDPROCEDURE
MP1
MP2
MP3
MP4
MP5
MP6
8(c)(i)

2

Max 2 marks
MP1
MP2
MP3

© UCLES 2023

Output report header (blank lines optional) – Must contain the
parameter code
Conditional loop until EOF("Stock.txt")
Read a line from Stock.txt AND extract SupplierCode
in a loop
Test if SupplierCode = Supp then increment count (must
have been Initialised)
Extract AND output item and description in a loop
Output the final line with count

Must ‘calculate’ the count before any item + description output /
after the file is read once
Lines to be output have to be stored …
The file has to be read twice

Page 9 of 10

9618/23

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
8(c)(ii)

Answer
One mark per point:
MP1
MP2
MP3
MP4

© UCLES 2023

May/June 2023

Marks
3

Loop through the file calculating the count
Save ‘selected’ items in an array
(After all lines have been read), output the header lines / count
Loop through the array to output each array element

Page 10 of 10

Advertisement