June 2016 QP - Paper 2 OCR Computer Science AS-level
June 2016 QP - Paper 2 OCR Computer Science AS-level
Do not use:
• a calculator
* H 0 4 6 0 2 *
First name
Last name
Centre Candidate
number number
INSTRUCTIONS
• Use black ink.
• Complete the boxes above with your name, centre number and candidate number.
• Answer all the questions.
• Write your answer to each question in the space provided.
• If additional space is required, you should use the lined page(s) at the end of this
booklet. The question number(s) must be clearly shown.
• Do not write in the barcodes.
INFORMATION
• The total mark for this paper is 70.
• The marks for each question are shown in brackets [ ].
• Quality of extended responses will be assessed in questions marked with an
asterisk (*).
• This document consists of 16 pages.
Construct 1: ......................................................................................................................................
Example: ..........................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
Construct 2: ......................................................................................................................................
Example: ..........................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
Construct 3: ......................................................................................................................................
Example: ..........................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
[6]
© OCR 2016
3
2* A software company is going to write a policy on its use of variables when writing programs. The
policy will cover the use of local and global variables and variable naming rules and conventions.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
3 (a) A software development company is planning to produce a bespoke monitoring system for a
factory which produces hazardous chemicals. One testing strategy is whitebox testing.
State the name of three other testing strategies that the company could use.
1 ................................................................................................................................................
2 ................................................................................................................................................
3 ........................................................................................................................................... [3]
© OCR 2016
5
(b) The company decide to use whitebox testing. Justify why whitebox testing is used in this
case.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [3]
(c) A temperature control system monitors and regulates temperature by switching a heater
on or off. The temperature sensor of the system provides a reading accurate to 3 decimal
places (e.g. 87.489). There are two warning lights, amber and red. The system controls the
temperature and warning lights as follows:
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
[4]
© OCR 2016
7
(b) A programmer has been tasked with writing a function that uses a binary search to return
a Boolean value. The function should return true if the target integer is found in a list of
integers. Using pseudocode, write an algorithm for the function.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
[8]
(i) Give the reason why the target integer 8 is not found.
...........................................................................................................................................
...................................................................................................................................... [1]
(ii) Identify and describe an alternative search algorithm that could be used.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [3]
© OCR 2016
9
(d) A stack, in shared memory, is being used to pass a single variable length ASCII string
between two sub-systems. The string is placed in the stack one character at a time in reverse
order with the last byte holding the number of characters pushed i.e the text “SILVER” would
be held in the stack as:
6 Top
S
I
L
V
E
R
Use pseudocode to write a procedure that will take a text string passed to it and push it to the
stack in the format defined above. You may assume any given input will fit in the stack.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [6]
© OCR 2016 Turn over
10
5 A car racing team uses a car simulator to test their drivers in a range of cars on different race
tracks.
(a) The car simulator uses an abstraction of the real car and race track. Identify two ways in
which the simulator could use abstraction.
1 ................................................................................................................................................
...................................................................................................................................................
2 ................................................................................................................................................
.............................................................................................................................................. [2]
(b) Identify three inputs that will be required to configure the initial conditions for running the
simulation.
1 ................................................................................................................................................
2 ................................................................................................................................................
3 ........................................................................................................................................... [3]
© OCR 2016
11
6 (a) A programmer is going to design a procedure that will prompt for and receive two values,
A and B. The procedure will then compare them. The procedure will also write a suitable
message to a file on disk depending on whether:
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [5]
name = "Sam"
addMessage(name)
print(name)
procedure addMessage(inText:byVal)
inText = "Hello " + inText
endprocedure
Explain why this program outputs Sam rather than Hello Sam.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [2]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [6]
© OCR 2016
13
7 Given the following pseudocode:
d = 5
print(d)
(d) Give one potential value of b if the output value of a=42, c=44
and d=14. ..........................
[4]
© OCR 2016
14
ADDITIONAL ANSWER SPACE
If additional space is required, you should use the following lined page(s). The question number(s)
must be clearly shown in the margin(s).
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
© OCR 2016
15
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
© OCR 2016
16
© OCR 2016