Cambridge International AS & A Level: Computer Science 9608/22 October/November 2021
Cambridge International AS & A Level: Computer Science 9608/22 October/November 2021
Cambridge International AS & A Level: Computer Science 9608/22 October/November 2021
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 2021 series for most
Cambridge IGCSE™, Cambridge International A and AS Level components and some Cambridge O Level
components.
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.
• 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.
Marks awarded are always whole marks (not half marks, or other fractions).
• 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.
Rules must be applied consistently, e.g. in situations where candidates have not followed
instructions or in the application of generic level descriptors.
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).
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.
Description of Evaluates
Pseudocode expression
expression to
Evaluates to TRUE if
STRING_TO_NUM(DayOfMonth)
DayOFMonth is within <= 7 FALSE
the first seven days of // DayOfMonth <= "7"
the month
Concatenates the
MID(Firstname,2,2) &
second and third
RIGHT(Lastname, 3)
letters of Firstname
// MID(Firstname,2,2) & "eason"
and concatenate with MID(Lastname,
the last three letters LENGTH(Lastname)-3, 3)
of Lastname
Evaluates to TRUE if
DOB contains eight LENGTH(DOB) = 8 TRUE
characters
Evaluates to TRUE if
IsMember AND Points >= 10
the customer is a
member and has IsMember = TRUE AND
TRUE
enough points for a Points >= 10
free slice of cake
• CASE statement has correct structure (all key words and format)
• Correct assignment/identification of all 3 file types in case statement
• Assignment/return of "Unknown" as default
• Return FileType instead of FileExt // Correct return value for all file
types and Unknown
FileExt ← RIGHT(Filename, 3)
CASE OF FileExt
'rtf' : FileType ← "Rich text format"
'csv' : FileType ← "Comma separated values"
'txt' : FileType ← "Text"
OTHERWISE : FileType ← "Unknown"
ENDCASE
RETURN FileType
ENDFUNCTION
1 mark for how the skills are used in program development e.g.
• use current knowledge of a familiar programming language in a new
language
e.g.
PROCEDURE InitialiseArray()
FOR Index ← 1 TO 20
Flower[Index] ← -1
ENDFOR
ENDPROCEDURE
FOR X ← 0 TO 19
WHILE NOT(Flower[New] = -1)
New ← INT(RAND(20)+1)
Flower[Previous] ← New
ENDWHILE
ENDFOR
ENDPROCEDURE
Example 2:
PROCEDURE RandomPath()
Current ← 10
Counter ← 1
IF Flower[Next] = -1
THEN
Flower[Current] ← Next
Current ← Next
Counter ← Counter + 1
ENDIF
ENDWHILE
ENDPROCEDURE
LatestDate ← "01/01/1500"
FOR Index ← 0 TO 19999
IF LEFT(GeoCodeLog[Index], 7)
THEN
AccessCount ← AccessCount + 1
DateAccess ← (RIGHT(GeoCodeLog[Index],
10)).TODATE
IF DateAccess > LatestDate
THEN
LatestDate ← DateAccess
ENDIF
ENDIF
ENDFOR
RETURN NUM_TO_STRING(AccessCount) & " " &
DATE_TO_STRING(LatestDate)
ENDFUNCTION
6(a) Example 2:
FUNCTION SearchLog(SearchGeoCode : STRING) RETURNS STRING
Index ← 1
AccessCount ← 0
LogGeoCode ← ""
LastDate ← ""
RETURN CountDateLine
ENDFUNCTION
DataIndex ← 1
ShortCode ← ""
TempCode ← ""
6(b) ENDIF
ENDFOR
CLOSEFILE FILENAME
ENDPROCEDURE
Example 2:
PROCEDURE ExtractArrays()
DataIndex ← 1
ShortCode ← ""
CLOSEFILE FILENAME
ENDPROCEDURE
Sub RandomPath()
' alternative solution
Dim Index, Current, NextFlower As Integer
Dim AllFlowersVisited As Boolean
Dim RandomFlower As New Random
Current = 10
AllFlowersVisited = False
If Flower(NextFlower) = 0 Then
If Flower(Current) = 0 Then
Flower(Current) = NextFlower
End If
Current = NextFlower
End If
AllFlowersVisited = True
For Index = 1 To 20
If Flower(Index) = 0 Then
AllFlowersVisited = False
End If
Next
Loop
End Sub
Q4 (b): Pascal
procedure RandomPath();
// alternative solution
var
Index, Current, Next: integer;
AllFlowersVisited : boolean;
begin
Current := 10;
AllFlowersVisited := False;
if (Flower[Next] = 0) then
begin
if (Flower[Current] = 0) then Flower[Current] := Next;
Current := Next;
end;
AllFlowersVisited := True;
for Index := 1 to 20 do
begin
if Flower[Index] = 0 then
AllFlowersVisited := False;
end;
end;
end;
Q4 (b): Python
def RandomPath():
# alternative solution
#DECLARE Index : INTEGER
#DECLARE Current : INTEGER
#DECLARE Next : INTEGER
#DECLARE AllFlowersVisited : BOOLEAN
Sub ExtractArrays()
Dim DataIndex As Integer
Dim ShortCode, CountAndDate, LocationLine, CountHashDate As String
Dim Sr As StreamWriter = New StreamWriter("Locations")
DataIndex = 1
ShortCode = ""
CountHashDate = ""
Q6 (b): Pascal
procedure ExtractArrays();
var
DataIndex: integer;
ShortCode, CountAndDate, LocationLine, CountHashDate: string;
Locations: textfile;
const
HASH = '#';
begin
DataIndex := 1;
ShortCode := '';
assign(Locations,'M:\Locations');
rewrite(Locations);
Q6 (b): Python
def ExtractArrays():
#DECLARE DataIndex : INTEGER
#DECLARE ShortCode, CountAndDate, LocationLine, CountHashDate : STRING
HASH = "#"
FILENAME = "Locations"
DataIndex = 1
ShortCode = ""
filehandle.close()