Sample QP - Paper 2 OCR Computer Science GCSE
Sample QP - Paper 2 OCR Computer Science GCSE
Date – Morning/Afternoon
Time allowed: 1 hour 30 minutes
en
im
* 0 0 0 0 0 0 *
First name
ec
Last name
Centre Candidate
number number
Sp
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, use the lined page(s) at the end of this
booklet. The question number(s) must be clearly shown.
• Do not write in the bar codes.
INFORMATION
• The total mark for this paper is 80.
• The marks for each question are shown in brackets [ ].
• This document consists of 16 pages.
1 Kofi uses his computer to record an audio file of himself playing his guitar.
(a) Outline what happens when the computer converts the music into a file.
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
[2]
(b) Kofi increases the sample rate his computer is using to record his guitar.
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
en
im
……………………………………………………………………………………………………………
[4]
ec
(c) Kofi is e-mailing his recording to a record label. He uses lossy compression to produce the
music file.
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
[4]
………………………………………………………………………………………………………………..
[1]
(b) Convert the decimal number 191 into an 8 bit binary number.
………………………………………………………………………………………………………………..
[1]
(c) Convert the hexadecimal number 3E into a decimal number. You must show your working.
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
en [2]
im
ec
Sp
(d) There is a subroutine, HEX(), that takes a denary number between 10 and 15 and returns the
corresponding hexadecimal number. E.g. HEX(10) would return ”A”, HEX(15) would return
“F”.
Write an algorithm, using the subroutine HEX(), to convert any whole decimal number
between 0 and 255 into a 2 digit hexadecimal number.
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
……………………………………………………………………………………………………………….. en
im
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
ec
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
Sp
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
[4]
(e) (i) Add together the following two 8 bit binary numbers. Express your response in an 8 bit
binary form.
01101010
10010110
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
[2]
en
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
[1]
im
3 (a) Complete a 2 place right shift on the binary number 11001011.
………………………………………………………………………………………………………………..
ec
………………………………………………………………………………………………………………..
[1]
Sp
(b) Explain the effect of performing a 2 place right shift on the binary number 11001011.
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
[2]
(c) Complete the truth table below for the Boolean statement P = NOT (A AND B).
A B P
FALSE FALSE TRUE
FALSE TRUE
TRUE FALSE
TRUE TRUE FALSE
[2]
4 Johnny is writing a program to create usernames. The first process he has developed is shown in
the flowchart in Fig. 1.
Fig. 1
Start
INPUT
firstName
INPUT
surname
en
name = LEFT(firstName, 3)
im
username = name +
LEFT(surname, 2)
ec
OUTPUT
username
Sp
Stop
For example, using the process in Fig. 1, Tom Ward’s user name would be TomWa.
(a) State, using the process in Fig. 1, the username for Rebecca Ellis.
………………………………………………………………………………………………………………..
[1]
(b) Johnny has updated the process used to create usernames as follows:
• If the person is male, then their username is the last 3 letters of their surname and
the first 2 letters of their first name.
• If the person is female, then their username is the first 3 letters of their first name
and the first 2 letters of their surname.
What would be the username for a male called Fred Biscuit using the updated process?
………………………………………………………………………………………………………………..
[1]
Write an algorithm for Johnny to output a username using the updated process.
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
en
im
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
ec
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
Sp
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
[6]
(a) State why the computer needs to translate the code before it is executed.
………………………………………………………………………………………………………………..
[1]
(b) Harry can use either a complier or an interpreter to translate the code.
Describe two differences between how a complier and an interpreter would translate Harry’s
computer game.
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
en
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
im
………………………………………………………………………………………………………………..
[4]
ec
6 Heath is researching how long, to the nearest minute, each student in his class spends playing
computer games in one week (Monday to Friday). He is storing the data in a 2D array.
Fig. 2
Students
0 1 2 3
Days of the
0 60 30 45 0
1 180 60 0 60
week
2 200 30 0 20
3 60 10 15 15
4 100 35 30 45
For example, student 1, on Monday (day 0), played 30 minutes of computer games.
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
[2]
(b) (i) Identify a data type that could be used to store the number of minutes in this array.
………………………………………………………………………………………………………………..
[1]
………………………………………………………………………………………………………………..
[1]
(c) Heath wants to output the number of minutes student 3 played computer games on
Wednesday (day 2). He writes the code:
print (hoursPlayed[3,2])
(i) Write the code to output the number of minutes student 0 played computer games on
Wednesday.
………………………………………………………………………………………………………………..
……………………………………………………………………………………………………………….. en
im
[1]
(ii) State the output if Heath runs the code:
print (hoursPlayed[2,1])
ec
………………………………………………………………………………………………………………..
[1]
Sp
………………………………………………………………………………………………………………..
[1]
(iv) Write an algorithm to output the total number of minutes student 0 played computer
games from Monday (day 0) to Friday (day 4).
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
[3]
© OCR 2015 J276/02
PMT
10
(d) Heath has the day of the week stored as a number e.g. 0 = Monday, 1 = Tuesday.
Write a sub-program that takes the number as a parameter and returns the day of the week
as a string.
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
en
im
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
ec
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
Sp
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
[5]
11
(e) Heath needs to work out the average number of minutes spent playing computer games each
day for the class, which contains 30 students. Write an algorithm to output the average
number of minutes the whole class spends playing computer games each day.
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
en
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
im
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
ec
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
Sp
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
[6]
© OCR 2015 J276/02 Turn over
PMT
12
7 Willow has created a hangman program that uses a file to store the words the program can select
from. A sample of this data is shown in Fig. 3.
Fig. 3
(a) Show the stages of a bubble sort when applied to data shown in Fig. 3.
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
en
im
………………………………………………………………………………………………………………..
[4]
Fig. 4
Sp
Show the stages of a binary search to find the word ‘zebra’ when applied to the data shown in
Fig. 4.
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
[4]
© OCR 2015 J276/02
PMT
13
8 The area of a circle is calculated using the formula π × r2 , where π is equal to 3.142 and r is the
radius.
Finn has written a program to allow a user to enter the radius of a circle as a whole number,
between 1 and 30, and output the area of the circle.
01 int radius = 0
02 real area = 0.0
03 input radius
04 if radius < 1 OR radius > 30 then
05 print (‘Sorry, that radius is invalid’)
06 else
07 area = 3.142 * (radius ^ 2)
08 print (area)
09 end if
(a) Explain, using examples from the program, two ways Finn can improve the maintainability of
the program.
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
en
im
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
ec
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
Sp
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
……………………………………………………………………………………………………………….
[6]
14
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
[2]
(c) (i) Identify one item in the program that could have been written as a constant.
………………………………………………………………………………………………………………..
[1]
(ii) Give one reason why you have identified this item as a constant.
………………………………………………………………………………………………………………..
[1]
en
(d) Finn uses an IDE (Integrated Development Environment) to write his programs. Identify two
features of an IDE that Finn might use.
im
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
[2]
ec
Sp
15
BLANK PAGE
en
im
ec
Sp
16
en
im
ec
Sp
Copyright Information:
OCR is committed to seeking permission to reproduce all third-party content that it uses in the assessment materials. OCR has attempted to
identify and contact all copyright holders whose work is used in this paper. To avoid the issue of disclosure of answer-related information to
candidates, all copyright acknowledgements are reproduced in the OCR Copyright Acknowledgements booklet. This is produced for each
series of examinations and is freely available to download from our public website (www.ocr.org.uk) after the live examination series.
If OCR has unwittingly failed to correctly acknowledge or clear any third-party content in this assessment material, OCR will be happy to correct
its mistake at the earliest possible opportunity.
For queries or further information please contact the Copyright Team, First Floor, 9 Hills Road, Cambridge CB2 1GE.
OCR is part of the Cambridge Assessment Group; Cambridge Assessment is the brand name of University of Cambridge Local Examinations
Syndicate (UCLES), which is itself a department of the University of Cambridge.