Cambridge International AS & A Level: Computer Science 9608/23 October/November 2020
Cambridge International AS & A Level: Computer Science 9608/23 October/November 2020
Cambridge International AS & A Level: Computer Science 9608/23 October/November 2020
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 2020 series for most
Cambridge IGCSE™, Cambridge International A and AS Level and Cambridge Pre-U 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.
• to express the algorithm in a level of sufficient detail // to split a large task into (smaller) sub-tasks
• so that it can be programmed // so that individual tasks are easier to solve // to make the problem more manageable /
understandable
1(b) Many acceptable answers, must be four different data types together with appropriate values 4
One mark per row
For example:
BOOLEAN FALSE
CHAR '!'
DATE 01/01/01
INTEGER 27
Note: STRING and REAL are excluded as these are given in the question.
1 Set Total to 0
2 Set AGradeCount to 0
3 Input Mark
4 Add Mark to Total
5 If Mark > 75 then increment AGradeCount
6 Repeat from Step 3 for 30 times
7 Output AGradeCount
8 Output Total / 30
Statement Error
2(c) ‘Pseudocode’ solution included here for development and clarification of mark scheme. 6
Programming language example solutions appear in the Appendix.
Index ← 0
Status ← FALSE
WHILE Status <> TRUE
Status ← TopUp()
Index ← Index + 1
ENDWHILE
Mark as follows:
3(a) ‘Pseudocode’ solution included here for development and clarification of mark scheme. 7
Programming language example solutions appear in the Appendix.
PROCEDURE BubbleSort()
DECLARE Temp : INTEGER
DECLARE NoSwaps : BOOLEAN
DECLARE Boundary, J : INTEGER
Boundary ← 4999
REPEAT
NoSwaps ← TRUE
FOR J ← 1 TO Boundary
IF ProdNum[J]> ProdNum[J+1]
THEN
Temp ← ProdNum[J]
ProdNum[J] ← ProdNum[J+1]
ProdNum[J+1] ← Temp
NoSwaps ← FALSE
ENDIF
ENDFOR
Boundary ← Boundary - 1
UNTIL NoSwaps = TRUE
ENDPROCEDURE
RetVal ← -1
Index ← 1
RETURN RetVal
ENDFUNCTION
Mark as follows:
1 Function heading and ending including parameter
2 Declaration of integer for Index
3 Initialisation and increment of Index (implied in FOR loop)
4 Conditional loop // FOR loop with immediate RETURN if SearchString found
5 Comparison of array element with SearchString AND assigning just the first occurrence to RetVal OR setting
the termination condition
6 Return RetVal (correctly in both cases)
• Program doesn’t perform as expected / does not meet the original specification
• Program contains errors / bugs
• Performance / efficiency needs improving
• New hardware has been introduced
Output Explanation
Added ← FALSE
Index ← 1 // first element
REPEAT
IF TagString[Index] = EMPTY
THEN
TagString[Index} ← HashTag
TagCount[Index] ← 1
Added ← TRUE
ELSE
Index ← Index + 1
ENDIF
RETURN Added
ENDFUNCTION
1 Declaration of two local variables: Integer for index & Boolean for return value (unless immediate Return used)
2 Conditional loop through all elements until empty element found OR end of array
3 Test if TagString element is empty in a loop
4 If so then assign HashTag to TagString[] and 1 to TagCount[]
5 Set loop termination
6 Return Boolean (for both cases)
5(b) ‘Pseudocode’ solution included here for development and clarification of mark scheme. 6
Programming language example solutions appear in the Appendix.
TagNum ← 0
Found ← TRUE
REPEAT
StartPos ← GetStart(Message, TagNum + 1)
IF StartPos = -1
THEN
Found ← FALSE
ELSE
TagNum ← TagNum + 1
ENDIF
UNTIL NOT Found
RETURN TagNum
ENDFUNCTION
5(c) ‘Pseudocode’ solution included here for development and clarification of mark scheme. 4
Programming language example solutions appear in the Appendix.
Found ← FALSE
Index ← 1 // first element
REPEAT
IF TagString[Index] = HashTag
THEN
TagCount[Index] ← TagCount[Index] + 1
Found ← TRUE
ELSE
Index ← Index + 1
ENDIF
UNTIL Index > 10000 OR Found = TRUE
RETURN Found
ENDFUNCTION
Max ← −1
IF Count = 1
THEN
OUTPUT "The most popular hashtag is: ", MostPopTag, "It occurs: ", Max," times.”
ELSE
OUTPUT "The maximum hashtag count is: ",Max,__
"The number of hashtags with this count is: ", Count
ENDIF
ENDPROCEDURE
PROCEDURE OutputMostPop()
DECLARE Index : INTEGER
DECLARE MostPopTag : STRING
DECLARE Max : INTEGER //The integer value of the biggest number
DECLARE MaxCount : INTEGER
Max ← -1
5(d) MaxCount ← 0
FOR Index ← 1 To 10000
IF TagCount[Index] = Max
THEN
MaxCount ← MaxCount + 1
ENDIF
ENDFOR
IF MaxCount = 1
THEN
OUTPUT "The most popular hashtag is: ", MostPopTag, ". It occurs: ", Max," times.”
ELSE
OUTPUT "The mamimum value is: ",Max, ". It occurred ", MaxCount, " times."
ENDIF
ENDPROCEDURE
*** End of Mark Scheme – example program code solutions follow ***
Index = 0
Status = FALSE
Do While Status <> TRUE
Status = TopUp()
Index = Index + 1
Loop
Q2 (c): Pascal
Index := 0;
Status := FALSE;
Index = 0
Status = FALSE
while Status <> TRUE:
Status = TopUp()
Index = Index + 1
Sub BubbleSort()
Dim Temp As Integer
Dim NoSwaps As Boolean
Dim Boundary, J As Integer
Boundary = 4998
Do
NoSwaps = TRUE
For J = 0 To Boundary
If ProdNum(J)> ProdNum(J+1)Then
Temp = ProdNum(J)
ProdNum(J) = ProdNum(J+1)
ProdNum(J+1) = Temp
NoSwaps = FALSE
End If
Next
Boundary = Boundary - 1
Loop Until NoSwaps = TRUE
End Sub
Peocedure BubbleSort();
var
Temp: Integer;
NoSwaps : Boolean;
Boundary, J : Integer;
begin
Boundary := 4999;
repeat
NoSwaps := TRUE;
for J := 1 To Boundary do
begin
if ProdNum[J] > ProdNum[J+1] then
begin
Temp := ProdNum[J];
ProdNum[J] := ProdNum[J+1];
ProdNum[J+1] := Temp;
NoSwaps := FALSE;
end;
end;
Boundary := Boundary – 1;
until NoSwaps = TRUE;
end;
def BubbleSort():
# Temp As Integer
# NoSwaps As Boolean
# Boundary, J As Integer
NoSwaps = False
Boundary = 4999
Boundary = Boundary – 1
TagNum = 0
Found = TRUE
Do
StartPos = GetStart(Message, TagNum + 1)
If StartPos = -1 Then
Found = FALSE
Else
TagNum = TagNum + 1
End If
Loop Until No Found
Return TagNum
End Function
begin
TagNum := 0;
Found:= TRUE;
repeat
StartPos := GetStart(Message, TagNum + 1);
if StartPos = -1 then
Found := FALSE
else
TagNum := TagNum + 1;
CountHashtag := TagNum;
end;
TagNum = 0
Found = TRUE
while Found:
StartPos = GetStart(Message, TagNum + 1)
if StartPos == -1:
Found = FALSE
else:
TagNum = TagNum + 1
return TagNum
Found = False
Index = 1 'First element
Do
If TagString(Index) = HashTag Then
TagCount(Index) = TagCount(Index) + 1
Found = True
Else
Index = Index + 1
End If
Loop Until Index > 10000 Or Found = True
Return Found
End Function
begin
Found := FALSE;
Index := 1; //First element
repeat
If TagString[Index] = HashTag then
begin
TagCount[Index] := TagCount[Index] + 1;
Found := TRUE;
end
else
Index := Index + 1;
IncrementHashtag := Found;
end;
Found = FALSE
Index = 0 #First element
Return Found