Past paper – A Level Computer Science (old syllabus, to 2021) (9608)

Cambridge International AS & A Level · 9608

Computer Science (old syllabus, to 2021) · Paper 22

May/June 2020 · 9608/22/M/J/20

Questions6
Marks75
TypeWritten

Answer on paper, open each mark scheme and give yourself marks, then open the Summary.

0 / 0Answer a question to start your score.
Saved 0
Advertisement
1
9608/22/M/J/20 · Question 1May/June 2020Paper 2210 marks
Loading question…
Question text

1
(a) Selection and repetition are basic constructs of an algorithm.
Name and describe one other construct.
Name …
Description …
…
…
[3]
(b) Program coding is a transferable skill.
Explain the term transferable skill.
…
…
…
… [2]
(c) Count-controlled and post-condition are two types of loop.
Describe the characteristics of each of these types of loop.
Count-controlled …
…
…
Post-condition …
…
…
[2]
(d) Name three features provided by an Integrated Development Environment (IDE) that assist
in the coding and initial error detection stages of the program development cycle.
1 …
2 …
3 …
[3]

2
9608/22/M/J/20 · Question 2May/June 2020Paper 2211 marks
Loading question…
Question text

2
(a) A structure chart is often produced as part of a modular program design. The chart shows the
hierarchy of modules and the sequence of execution.
Give two other features the structure chart can show.
Feature 1 …
…
Feature 2 …
…
[2]
(b) Six program modules implement part of an online shopping program. The following table
gives the modules and a brief description of each module:
Module
Description
Allows the user to choose a delivery slot, select items to be added to
Shop()
the basket and finally check out
ChooseSlot()
Allows the user to select a delivery time. Returns a delivery slot number
FillBasket()
Allows the user to select items and add them to the basket
Completes the order by allowing the user to pay for the items. Returns
Checkout()
a Boolean value to indicate whether or not payment was successful
Search()
Allows the user to search for a specific item. Returns an item reference
Adds an item to the basket. Takes an item reference and a quantity as
Add()
parameters
(i)
The online shopping program has been split into sub-tasks as part of the design process.
Explain the advantages of decomposing the program into modules. Your explanation
should refer to the scenario and modules described in part (b).
…
…
…
…
…
… [3]
(ii)
Complete the structure chart for the six modules described in part (b).
Shop()
[6]

3
9608/22/M/J/20 · Question 3May/June 2020Paper 227 marks
Loading question…
Question text

3
A navigation program includes a function, CheckCourse(). This function is called with a real
value, Course, and returns an integer value.
The identifier table and the program flowchart for the function are shown as follows:
Identifier
Type
Description
Course
REAL
The value passed to CheckCourse()
Adjust
INTEGER
The value returned by CheckCourse()
Check
INTEGER
A local variable
A function that is passed a REAL value representing the
Deviate()
FUNCTION
course and returns a REAL value representing the current
deviation
Alert()
PROCEDURE
A procedure that generates a warning
START
Set Check to integer
value of
Deviate(Course)
Set Adjust to 255
CASE OF
Check
–20 to –1
Set Adjust to 10
OTHERWISE
0
Set Adjust to 0
Alert()
1 to 20
Set Adjust to –10
RETURN Adjust
END
Write pseudocode to implement the function CheckCourse(). The pseudocode must follow the
algorithm represented by the flowchart. Declare any local variables used.
Refer to the Appendix on page 19 for a list of built-in pseudocode functions and operators.
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…

Advertisement
4
9608/22/M/J/20 · Question 4May/June 2020Paper 227 marks
Loading question…
Question text

4
(a) Mustafa has developed the following pseudocode to generate ten random integers in the
range 1 to 100.
DECLARE Random : ARRAY [1:10] OF INTEGER
DECLARE Count, RNum : INTEGER
1 TO 10
FOR Count
INT(RAND(100)) + 1
Rnum
RNum
Random[Count]
ENDFOR
Refer to the Appendix on page 19 for a list of built-in pseudocode functions and operators.
Rewrite the pseudocode so that there are no duplicated numbers in the list of random
numbers.
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
… [6]
(b) The changes made to the pseudocode in part (a) were as a result of changes to the program
requirement.
Give the term used to describe changes made for this reason.
…

5
9608/22/M/J/20 · Question 5May/June 2020Paper 2219 marks
Loading question…
Question text

5
A global 1D array, Contact, of type STRING is used to store a list of names and email addresses.
There are 1000 elements in the array. Each element stores one data item. The format of each
data item is as follows:
<Name>':'<EmailAddress>
Name and EmailAddress are both variable-length strings.
For example:
"Sharma Himal:[email protected]"
A function, GetName(), is part of the program that processes the array. A data item string will be
passed to the function as a parameter. The function will return the Name part. Validation is not
necessary.
(a) Use structured English to describe the algorithm for the function GetName().
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
… [7]
(b) (i)
The array is to be sorted using an efficient bubble sort algorithm. An efficient bubble sort
reduces the number of unnecessary comparisons between elements.
Describe how this could be achieved.
…
…
…
…
…

6
9608/22/M/J/20 · Question 6May/June 2020Paper 2221 marks
Loading question…
Question text

6
A company hires out rowing boats on a lake. The company has 17 boats numbered from 1 to 17.
Boats may be hired between 9:00 and 18:00, with a maximum hire duration of 90 minutes.
The company is developing a program to help manage and record the boat hire process.
The programmer has decided to store all values relating to hire time as strings. The program will
use a 24-hour clock format. For example:
Time (in words)
String value
"09:00"
Nine o’clock in the morning
"10:05"
Five minutes past ten o’clock in the morning
"14:50"
Ten minutes before three o’clock in the afternoon
The programmer has defined the first module as follows:
Module
Description
•
Takes two parameters:
StartTime: a STRING value representing a time as described
AddTime()
Duration: an INTEGER value representing a duration in minutes
•
Adds the duration to the time to give a new time
•
Returns the new time as a STRING
(a) (i)
Write pseudocode for the module AddTime(). Assume both input parameters are valid.
Refer to the Appendix on page 19 for a built-in list of pseudocode functions and
operators.
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…

Advertisement