Past paper – A Level Computer Science (old syllabus, to 2021) (9608)
Cambridge International AS & A Level · 9608
Computer Science (old syllabus, to 2021) · Paper 43
Oct/Nov 2020 · 9608/43/O/N/20
Answer on paper, open each mark scheme and give yourself marks, then open the Summary.
Question text
1
A company is implementing a new software system for their latest product.
Developing the software will include the following activities:
Time to complete
Activity
Description
Predecessor
(weeks)
A
Identify requirements
1
–
B
Produce design
3
A
C
Write code
6
B
D
Test modules
4
B
E
Integration testing
2
D
F
Final system black-box testing
2
E
G
Install software
1
F
H
Acceptance testing
2
G
I
Create user documentation
2
G
J
Create training documents
3
G
K
Pilot implementation
4
H
Complete the GANTT chart to correspond with the given table.
A
B
C
D
E
F
G
H
I
J
K
Week
1
2
3
4
5
6
7
8
9
10 11 12 13 14 15 16 17 18 19 20
number
[5]
Question text
2
There are several different types of testing.
(a) Tick (3) one or more boxes in each row to indicate whether each statement applies to
Integration, Acceptance, Alpha or Beta testing.
Statement
Integration
Acceptance
Alpha
Beta
Software is tested in-house by
dedicated testers
Software is tested by the client before
it is signed off
Software is tested by combining
modules that have previously been
tested to check they work as expected
Software is tested using normal,
abnormal and boundary data
Software is tested by releasing it to
selected customers, who test it in
normal circumstances
[4]
(b) Identify one other method of testing.
… [1]
Question text
3
A programmer is creating a program for a puzzle competition.
The programmer has designed the PuzzlePlayer class to store details for each player, including
the player’s score.
The following diagram shows the design for the PuzzlePlayer class.
PuzzlePlayer
PlayerID : STRING // initialised in constructor to "PL12a3"
Name : STRING
// initialised in constructor to ""
Score : INTEGER
// initialised in constructor to 0
Constructor()
//
method used to create an instance of the
//
PuzzlePlayer class and initialise its attributes
GetPlayerID()
//
returns PlayerID
GetName()
//
returns Name
GetScore()
//
returns Score
SetPlayerID()
//
validates the parameter value to make sure it
//
is 6 characters in length and starts with
//
"PL", then sets PlayerID to this value
SetName()
//
sets the Name to the parameter value
SetScore()
//
sets the Score to the parameter value
(a) Write program code for the Constructor() method.
Use the appropriate constructor method for your chosen programming language.
Programming language …
Program code
…
…
…
…
…
…
…
…
…
… [2]
(b) Write program code for GetPlayerID() method.
Programming language …
Program code
…
…
…
…
…
… [2]
(c) The method SetPlayerID() validates the parameter value. It checks that it is 6 characters
in length and that the first two characters are "PL". The method sets PlayerID to the
parameter value. It returns TRUE if the parameter value is valid and FALSE if it is not valid.
The function
Question text
4
A declarative programming language is used to represent the following knowledge base.
01 type(cheddar).
02 type(brie).
03 type(paneer).
04 type(parmesan).
05 country(england).
06 country(france).
07 country(india).
08 country(italy).
09 hard(parmesan).
10 soft(brie).
11 strong_smell(brie).
12 strong_smell(cheddar).
13 origin(brie, france).
These clauses have the following meanings:
Clause
Meaning
02
Brie is a type of cheese
06
France is a country
09
Parmesan is a hard cheese
10
Brie is a soft cheese
12
Cheddar has a strong smell
13
Brie is from France
(a) Camembert is a type of soft cheese from France and has a strong smell.
Write additional clauses to represent this information.
14 …
15 …
16 …
17 …
[4]
(b) Stilton (X) could be from England (Y) and Stilton could be a hard cheese, if Stilton is a type of
cheese, England is a country and Stilton is not a soft cheese.
Write this as a rule.
Cheese_Question(X, Y)
IF …
…
… [4]
Question text
5
There are several sorting algorithms. One type of sorting algorithm is an insertion sort.
(a) Explain how an insertion sort puts a set of data into ascending order.
…
…
…
…
…
…
…
…
…
… [4]
(b) The following algorithm performs a bubble sort. It is currently incomplete.
Complete the algorithm.
NumberOfItems – 2
Counter
REPEAT
FALSE
DataSwapped
0 TO …
FOR CurrentValue
IF DataList[CurrentValue] > DataList[CurrentValue + 1]
THEN
DataList[ … ]
ValueTemp
DataList[CurrentValue + 1]
DataList[CurrentValue]
…
DataList[CurrentValue + 1]
…
DataSwapped
ENDIF
ENDFOR
UNTIL DataSwapped = …
[5]
Question text
6
Consider the following diagram that represents a linked list:
Data
Pointer
A
B
C
D
Ø
The symbol Ø represents a null pointer.
(a) A new node with the data value E is added between the nodes that have the data values B
and C.
Show the state of the linked list after the node with the data value E is added.
[2]
(b) State why the node with the data value D has a null pointer.
…
… [1]
(c) A 1D array, LinkedList, is used to implement the linked list. The array is declared as a
record data type with two fields, Data and Pointer.
The global variable StartPointer stores the index of the first node in the list.
(i)
The following pseudocode algorithm finds a value in a linked list. The algorithm is
incomplete.
The function FindValue(), takes as a parameter, the value to be searched for in the
linked list. The function follows the pointers in the linked list. It either returns -1 if the
value is not found, or it returns the pointer to the value if it is found.
Complete the algorithm.
FUNCTION FindValue(Value : INTEGER) …
DECLARE CurrentPointer : INTEGER
StartPointer
CurrentPointer
WHILE … <> NULL
AND LinkedList[CurrentPointer]. … <> …
LinkedList[ … ].Pointer
CurrentPointer
ENDWHILE
IF LinkedList[CurrentPointer].Data = Value
THEN
RETURN …
ELSE
RETURN -1
ENDIF
ENDFUNCTION
[6]
(ii)
The function DeleteNode() takes the data to be removed from LinkedList as a
parameter.
The function starts at the first node and follows the pointers to check the data in each
node.
If the data is found, it removes the node containing that data, updates the pointer and
returns TRUE. Otherwise, it returns FALSE.
Write pseudocode for DeleteNode().
…
…
…
…
…
…
…
…
…
…
…
…
…
…
Question text
7
The following table shows part of the instruction set for a processor that has one general purpose
register, the Accumulator (ACC), and an Index Register (IX).
Instruction
Explanation
Op code
Operand
LDM
#n
Immediate addressing. Load the number n to ACC.
Direct addressing. Load the contents of the location at the given
LDD
<address>
address to ACC.
Indirect addressing. The address to be used is at the given address.
LDI
<address>
Load the contents of this second address to ACC.
Indexed addressing. Form the address from <address> + the contents
LDX
<address>
of the Index Register. Copy the contents of this calculated address to
ACC.
LDR
#n
Immediate addressing. Load the number n to IX.
STO
<address>
Store the contents of ACC at the given address.
Indexed addressing. Form the address from <address> + the contents
STX
<address>
of the Index Register. Copy the contents of ACC to this calculated
address.
ADD
<address>
Add the contents of the given address to ACC.
INC
<register>
Add 1 to the contents of the register (ACC or IX).
DEC
<register>
Subtract 1 from the contents of the register (ACC or IX).
JMP
<address>
Jump to the given address.
CMP
<address>
Compare the contents of ACC with the contents of <address>.
CMP
#n
Compare the contents of ACC with number n.
Following a compare instruction, jump to <address> if the compare
JPE
<address>
was True.
Following a compare instruction, jump to <address> if the compare
JPN
<address>
was False.
IN
Key in a character and store its ASCII value in ACC.
OUT
Output to the screen the character whose ASCII value is stored in ACC.
END
Return control to the operating system.
The assembly language program in the table on the opposite page allows a username to be input
as a string of up to 8 characters in length.
For strings of less than 8 characters, the user enters the exclamation mark (!) character to
indicate that no more characters will be entered. The exclamation mark is not saved as part of the
username.
The program then outputs each character of the username in the order input.
The program will use consecutive memory locations, starting at the address labelled USERNAME,
storing one character in each location.
The program in the table is incomplete. The comment column contains descriptions for some
program instructions.
Complete the program using the given instruction set.
Instruction
Label
Comment
Op code
Operand
LDR
#0
LDM
#0
// initialise LENGTH to 0
STO
LENGTH
LOOP:
IN
// is character = EXCLAMATION(!)?
// if TRUE, jump to OUTPUT
// store character in USERNAME +
contents of IX
INC
IX
// increment Index Register
// increment LENGTH
// is LENGTH = MAX ?
// if FALSE, jump to LOOP
OUTPUT:
LDR
#0
// initialise COUNT to 0
LDX
USERNAME
OUT
INC
IX
LDD
COUNT
INC
ACC
// increment COUNT
STO
COUNT
// is COUNT = LENGTH ?
JPN
OUTPUT
END
// end program
LENGTH:
EXCLAMATION:
B0010001
MAX:
8
COUNT:
USERNAME:
[8]
Question text
12 ENDFUNCTION
(a) State the line number in the pseudocode algorithm that shows function NumberPattern()
is recursive. Justify your choice.
Line number …
Justification …
…
…
[2]
(b) The function is called as follows:
NumberPattern(1,1,12)
Dry run the algorithm and complete the following trace table. State the final value returned.
Show your working.
Value1
Value2
Temp
EndValue
OUTPUT
RETURN value
Final value returned …
Working
…
…
…
…
…
…
…
[5]
(c) State the purpose of the algorithm.
…
… [1]
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of the University of