A Level Computer Science Practice Paper - Set 2: Time Allowed: 2 Hours 30 Minutes
A Level Computer Science Practice Paper - Set 2: Time Allowed: 2 Hours 30 Minutes
Do not use:
• a calculator
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. Additional paper may be
used if required but you must clearly show your candidate number, centre number and
question number(s).
• Do not write in the barcodes.
INFORMATION
• The total mark for this paper is 140.
• 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 32 pages.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [2]
(ii) Explain how an operating system may overcome the problem of physical memory being
full.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [4]
...........................................................................................................................................
...................................................................................................................................... [1]
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [5]
(a) State the name of a sensor or input device the phone might use when playing Mobile Treasure
Hunt and explain why it might be used.
Use: ...........................................................................................................................................
.............................................................................................................................................. [2]
class Treasure
private value
private weight
private name
endclass
private locked
endclass
Fig. 2.1
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [3]
(c) Describe what is meant by the term ‘inheritance’, referring to the code in Fig. 2.1.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [3]
Methods: ....................................................................................................................................
...................................................................................................................................................
Attributes: ..................................................................................................................................
.............................................................................................................................................. [2]
0 LDA &7
1 ADD #4
2 OUT
3 HLT
4 6
5 2
6 10
7 15
8 16
9 17
Fig. 3.1
In this variant of LMC the symbols & and # are used to denote different modes of addressing.
(a) Given that the output is 17, state the addressing mode represented by each symbol.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [2]
(c) Explain how pipelining would help a CPU execute the code in Fig. 3.1 more quickly.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [3]
times=
{
"StopA":["06:55", "07:25", "07:55", "08:55", "09:55", "11:55", "14:00",
"15:00", "15:30", "16:00"]
"StopB":["06:40", "07:40", "08:40", "09:20", "09:40", "14:00", "15:00",
"16:00", "16:30"]
…
…
}
.............................................................................................................................................. [1]
(b) Write a function called timeValue that given a time stored in a string, returns the equivalent
integer (using thousands and hundreds for the hours and tens and units for the minutes).
The given string should be assumed to represent the time in the 24-hour clock in the format
HH:MM
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [3]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
endfunction [5]
Fig. 5.1
(a) State why the table in Fig. 5.1 is not in Third Normal Form.
...................................................................................................................................................
.............................................................................................................................................. [1]
(b) Explain how the database could be put into Third Normal Form.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [3]
Discuss how the bank can ensure the accuracy of its data and the importance of doing so.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [9]
(a) Show the effect of applying XOR on Text and Key, by completing the last row of the table
below.
Text O C R
Value 0 1 0 0 1 1 1 1 0 1 0 0 0 0 1 1 0 1 0 1 0 0 1 0
Key A B C
Value 0 1 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 1
XOR
[2]
(b) Show the effect of applying XOR on your answer to part (a) and Key, by completing the first
and last rows of the table below.
(a)
Key A B C
Value 0 1 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 1
XOR
[2]
(c) Explain whether the type of encryption described above is symmetric or asymmetric.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [2]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [4]
Harrier
Greyhound Rottweiler
Fig. 7.1
(a) The breeds Doberman and Dalmatian are added to the tree in that order. Add them to Fig. 7.1.
[2]
(b) Explain how you would determine if the breed Pug is in the binary search tree.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [3]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [3]
The program allows for a breed name to be entered, and depending on whether the breed is
in the tree or not, displays either:
or
Complete the program below. Credit will be given for readability of code.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [6]
<p>
<form action="checkUser.php">
Username:<br>
<input type="text" name="username">
<br>
Password:<br>
<input type="password" name="password">
<br><br>
<input type="submit" value="Submit">
</form>
The page is linked to a style sheet. The message Unauthorised access to this system
will be prosecuted is red with a monospace font. (Note this is the only text on the page that
has this formatting)
(a) Write the segment of CSS code that would appear on the style sheet to make the message
appear in the way described.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [3]
(b) Explain the meaning of the HTML line <input type="text" name="username">
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [2]
Discuss the difference between server and client side processing with respect to webpages.
You should refer to the advantages, drawbacks and best uses of both approaches.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [9]
01 username = valueFromForm("username")
02 password = valueFromForm("password")
03 statement = "SELECT passwordHash FROM users WHERE name = '"
+ username + "'"
04 hashInDB = RunSQL(statement, siteDatabase)
05 if hashInDB == hash(password) then
06 //TO ADD: Generate success webpage
07 else
08 //TO ADD: Store IP address of user in database.
09 endif
Fig. 8.1
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [5]
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [2]
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [2]
State what the value of statement would be after line 03 of the code in Fig. 8 .1 is run.
...........................................................................................................................................
...................................................................................................................................... [1]
(ii) State what the value of hashInDB would be after line 04 of the code in Fig. 8.1 is run.
...........................................................................................................................................
...................................................................................................................................... [1]
(g) In SQL the character ; denotes the next statement and the characters -- denote a comment.
The username DenverJ34’; DROP TABLE users; -- is entered into the form.
(i) State what the value of statement would be after line 03 is run.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [1]
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [2]
(iii) State the name of a law the user has broken by entering the username
DenverJ34’; DROP TABLE users; --
...........................................................................................................................................
...................................................................................................................................... [1]
00 01 11 10
00 1 1 0 1
CD 01 0 0 0 0
11 0 0 1 0
10 1 1 1 0
Fig. 9.1
(a) State the Boolean expression represented by the Karnaugh map in Fig. 9.1, in its smallest form.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [4]
(i) ¬ ¬A
...........................................................................................................................................
...................................................................................................................................... [1]
...........................................................................................................................................
...................................................................................................................................... [1]
...........................................................................................................................................
...................................................................................................................................... [1]
A B Q
0 0 1
0 1 1
1 0 1
1 1 0
A
Q
B
Fig. 10.1
(a) Draw a set of gates equivalent to a NAND gate, but built only of AND, OR and NOT gates.
[2]
D Q
Clock
Q
Fig. 10.2
...................................................................................................................................................
.............................................................................................................................................. [1]
clock
[3]
(i) Binary
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [1]
(ii) Denary
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [1]
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [1]
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [1]
00011010 0010
...................................................................................................................................... [1]
...........................................................................................................................................
...................................................................................................................................... [1]
(d) Two floating point numbers are shown below in the same format as used for part (a). Calculate
the answer of the second number subtracted from the first. You must show your working and
ensure your answer is normalised.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [5]
Discuss the different approaches that can be taken to provide increasingly larger amounts of
computing power and the types of problem they are suited to.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
................................................................................................................................................... [12]
Copyright Information
OCR is committed to seeking permission to reproduce all third-party content that it uses in its 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.