Computer Science Topic 1.3 Questions
Computer Science Topic 1.3 Questions
Topic Questions
This document is to help consolidate knowledge and review topics after learning the
content. A time has been given if you want to time yourself you don’t need to and you
should do at your own pace if you wish. The time adds roughly 10 minutes extra just like
the exam. Aim for a mark a minute if doing this timed.
Some Questions may overlap with other topics. If you don’t know the
knowledge for that overlap question or cannot be asked just skip it.
I don’t have OCR ExamBuilder so I cannot do much about overlap questions
(same applies with the mark scheme at the end of the document)
Not all topics can be covered given the timeframe of papers I have used so it is still up to
you to go through the specification and practice content from the other papers.
2017 Questions 6
3 A charitable organisation is trying to make the works of William Shakespeare available to more
people.
(a) The organisation decides to make a copy of Shakespeare’s entire works available as a
downloadable text file from its website. It further decides to compress the file before making it
available to download.
(i) State an advantage to the website’s visitors of the file being compressed.
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [1]
(ii) Explain why the company should use lossless and not lossy compression.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [3]
(b)* The organisation looks at using either run length encoding or dictionary encoding to compress
the file described in part (a).
Discuss the two compression methods and justify which you would recommend. You may
refer to the extract of text below to illustrate your argument.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
© OCR 2017
7
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
(a) The forum stores details of its users in the table called Users. An extract of Users is shown
below.
Describe what is meant by the term ‘primary key’, giving an example from the table above.
...................................................................................................................................................
.............................................................................................................................................. [2]
(b) The user’s password is passed to a function that generates a hash and the result is stored in
passwordHash.
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [1]
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [2]
© OCR 2017
15
(c) Write an SQL statement to get just the passwordHash and locked values of the user
Apollo.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [3]
(d) Sometimes users can have their accounts locked if they behave inappropriately. When this is
the case the locked field is set to 1 rather than 0.
Write an SQL statement that locks the account of the user Hades
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [3]
passwordHash and locked have already been extracted from the database before being
passed to the function. It should return the value true if a user should be allowed access to
a system and false if they aren’t.
Your function should make use of the pre-written function hash() which takes in a string and
returns the hash of that string.
e.g.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
endfunction
[4]
© OCR 2017
18
9 A website contains the following HTML:
<html>
<head>
<title>Boris' Cake Shop</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1>Boris' Cake Shop</h1>
<p id="intro">
Welcome to Boris' cake shop.
<script>
var hour = new Date().getHours();//gets the hour value of the
current time
if(hour>9 && hour<17)
{
document.write("We are currently open.");
}
else
{
document.write("We are closed, come visit us when we are
open (09:00 - 17:00).");
}
</script>
</p>
<div class="customerQuote">
Boris makes the best cupcakes I have ever tasted.
</div>
</body>
</html>
(a) Explain the difference between a HTML id attribute and a HTML class attribute.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [2]
© OCR 2017
19
(b) The html file is linked to the CSS file style.css
The introduction text should be dark red (using the named colour darkRed).
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [6]
(c) The code between the script tags is supposed to display a different message during the
shop’s opening hours of 09:00 and 17:00.
(i) State the name of the language used between the script tags.
...................................................................................................................................... [1]
Some users have reported that there is a bug and the site says the shop is closed when they
log on between 9 and 10 in the morning.
...........................................................................................................................................
...................................................................................................................................... [1]
(iii) Give one disadvantage of this code being run client side rather than server side.
...........................................................................................................................................
...................................................................................................................................... [1]
© OCR 2017 Turn over
2018 Questions 8
3 An airport holds details of flights in a database using the table Flight. An extract of the table is
shown below.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [2]
The airport cancels all its flights to Heathrow on 4th July 2018.
(b) The SQL statement below shows all the data for flights going to Halifax. Rewrite it so it instead
removes all flights to Heathrow on 4th July 2018.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [3]
© OCR 2018
9
(c) Tables often have primary and secondary keys.
(i) State why DestinationCode would not be a suitable primary key for the Flight
table.
...........................................................................................................................................
...................................................................................................................................... [1]
(ii) State why DestinationCode would be a suitable secondary key for the Flight table.
...........................................................................................................................................
...................................................................................................................................... [1]
(i) Describe why the database can be considered to be in First Normal Form.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [2]
(ii) Describe why the database can be considered to be in Second Normal Form.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [2]
(iii) Describe why the database can not be considered to be in Third Normal form.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [2]
Describe one format or method the airport could use to provide the data to the airlines so
they can use it in their own applications.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [2]
© OCR 2018
11
4 The internet can be considered an example of a WAN.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [2]
(b) The internet uses a set of protocols referred to as the TCP/IP stack. The TCP/IP stack
consists of four different layers, each with its own set of protocols.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [2]
(ii) State the name of the four layers of the TCP/IP stack.
1 ........................................................................................................................................
2 ........................................................................................................................................
3 ........................................................................................................................................
4 ........................................................................................................................................
[4]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [2]
I L O V E
C O M P U
T E R S C
I E N C E
T O W R M
E I L O V
P U C O M
R S C T E
E N C E I
T O W R M
The next 5 digits state how many spaces down the columns 0 to 4 should be rotated.
T N C O V
E O C T M
P I W E E
R U L R I
E S C O M
© OCR 2018
19
Part of the pseudocode for the algorithm is written below.
for i = 0 to 4
x = getNextDigitInKey()
shiftRow(i,x)
next i
for i = 0 to 4
x = getNextDigitInKey()
shiftColumn(i,x)
next i
(b) Show the result of running the algorithm on the grid and key below. [2]
KEY: 3 3 3 3 3 1 1 1 1 1
T O P S E
C R E T M
E S S A G
E Y R P L
U O G G Q
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [4]
© OCR 2018
21
(d)* Modern encryption is much stronger than the method described in the first part of this
question.
Discuss the impact of modern encryption on society. You should refer to:
• The importance of asymmetric encryption and how it differs from symmetric encryption.
• Different circumstances in which symmetric and asymmetric encryption may be used.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [9]
For each vehicle that passes by, a letter is entered into the system.
...................................................................................................................................................
.............................................................................................................................................. [1]
(b) The following sequence has been compressed using Run Length Encoding.
3C3M4C
...................................................................................................................................................
.............................................................................................................................................. [2]
(c) Show the result of using Run Length Encoding to compress the sequence:
CCCCOLLLCCCCCMOCCCCC
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [3]
© OCR 2019
5
The survey takers want to find out the longest continuous sequence of cars in any given chunk of
data. For example, in the data
CCMCCCCLLCCC
(d) Write the function longest which takes in a string of characters as an argument and returns
an integer representing the longest continuous sequence of Cs.
[5]
(a) Explain what is meant by referential integrity, giving an example which refers to the database
described above.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [3]
(b) Each review includes a score out of 5. When the score is entered on the website it is checked
in the browser to ensure a number no higher than 5 has been entered. It is then checked
again on the server.
...........................................................................................................................................
...................................................................................................................................... [1]
(ii) Explain why it is important that the review score that the user entered is also checked
server-side.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [2]
(c) Describe what is meant by the term ‘Atomic’ in the context of ACID transactions. You should
refer to the example of a review being added.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [2]
C ......................................................
I ......................................................
D ......................................................
[3]
The database previously stored reviews using the ASCII character set. ASCII uses 1 byte per
character. It is decided to switch to the Unicode UTF-32 character set which uses 4 bytes per
character.
(e) Give an advantage and disadvantage of changing character sets from ASCII to Unicode
UTF-32.
Advantage .................................................................................................................................
...................................................................................................................................................
Disadvantage .............................................................................................................................
...................................................................................................................................................
[2]
© OCR 2019
24
11 A web development company makes its money building websites for other companies.
(a)* The web development company is looking to recruit a programmer to build websites.
Discuss the technologies the programmer would need to know and use and the importance of
each one.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [9]
© OCR 2019
25
(b) Part of a website’s code is shown below.
<head>
<title>Orville's Oranges</title>
<link rel="stylesheet" type="text/css" href="mainStyle.css">
</head>
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [2]
Complete the CSS code that would make any div elements of the class offer have an
orange border.
………………………………………{
border-style: solid;
………………………………………
}
[2]
© OCR 2019
2020 Questions 2
Answer all the questions.
1 A hotel uses a computer system to keep track of room bookings. The hotel staff are able to query
a database to discover which rooms are booked or which rooms are free.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [3]
1 .........................................................................................................................................
...........................................................................................................................................
2 .........................................................................................................................................
...........................................................................................................................................
[2]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [3]
© OCR 2020
3
(c)* The hotel is concerned about the security of its computer network.
Discuss the threats which potentially exist to the hotel’s computer network and how these
threats could be eliminated or reduced.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [9]
© OCR 2020 Turn over
4
(d) The hotel stores data about rooms, customers and bookings in a database. Each customer
can book multiple rooms and each room can be booked multiple times.
[4]
(ii) Define what is meant by the term ‘foreign key’, giving one example of where a foreign
key would be used in the hotel booking database.
Definition ...........................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
Example ............................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
[3]
© OCR 2020
5
(iii) Describe two different ways that hashing could be used in this database.
1 ........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
[4]
(e) Explain what is meant by the term ‘referential integrity’ and how this could potentially be
broken.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [2]
b A linked list requires every node to be checked (until 4 Some candidates may talk about time complexity: linked lists being
the desired record is found). (1) linear/O(n) and hash table being constant/O(1) Accept these as points 1& 2
A linked list will take longer to search (as more nodes (AO1.2 - 2 and 3 & 4 conjoined i.e. full marks.
are added). (1) marks
A hash table enables direct access to the location of
the record. (1) AO2.2 -
A hash table will take the same time to search (as
more nodes are added)/It takes no longer as more 2 marks)
records are added. (1)
3 a i Downloads quicker. (1) 1 Do not accept ‘saves the user space on their device’.
Saves user money by using less bandwidth/ on data
usage. (1)
(Max 1)
(AO1.2) 2017 MS Starts Here
6
H446/01 Mark Scheme June 2017
7
H446/01 Mark Scheme June 2017
b Mark Band 3–High Level (9-12 marks) AO1.1 Points may include but aren’t limited to:
The candidate demonstrates a thorough knowledge and (2) AO1 Knowledge and Understanding
understanding of dictionary and run length encoding for
compression. The material is generally accurate and AO1.2 Run length encoding relies on consecutive pieces of data/characters being
detailed. the same.
(2)
The candidate is able to apply their knowledge and Each set of consecutive symbols can be represented by the symbol and its
AO2.1 number of occurrences
understanding directly and consistently to the context
provided. Evidence/examples will be explicitly relevant to e.g. AAAABBBBBCCC could be represented as 4A5B3C (or A4B5C3 or
(3)
the explanation. any sensible RLE encoding)
AO3.3
The candidate is able to weigh up both forms of In dictionary encoding frequently occurring pieces of data/groups of
compression and justify dictionary encoding being the (5) characters are replaced by symbols/tokens/smaller groups of
better choice. characters/indexes.
There is a well-developed line of reasoning which is clear A dictionary is then used to say which symbols/tokens/characters/indexes
and logically structured. The information presented is 12 match which groups of characters.
relevant and substantiated. When decompressed the dictionary is used to replace the tokens with the
original text.
Mark Band 2-Mid Level (5-8 marks)
The candidate demonstrates reasonable knowledge and AO2.1 Application
understanding of dictionary and run length encoding for
Run Length Encoding is very unsuitable for the example text
compression; the material is generally accurate but at
There are very few consecutive repeating symbols in the text.
times underdeveloped.
only instances being ll and ee
The candidate is able to apply their knowledge and these still require 2 characters to represent them 2l and 2e
understanding directly to the context provided although
Dictionary encoding is well suited.
one or two opportunities are missed. Evidence/examples
There are lots of repeating groups of characters
are for the most part implicitly relevant to the explanation.
For example ‘call’ ‘name’ ‘[SPACE]we’ ‘Romeo’
The candidate makes a reasonable attempt to come to a We could for example have:
conclusion as to which form of compression is better What's in53? that which2 15 rose
8
H446/01 Mark Scheme June 2017
Applying it to the example the resulting text would be the same size as the
original/worse than the original (if we use 1s to represent every individual
instance of a character).
Dictionary encoding works well. We can already see benefit on small piece
of text. Would fare substantially better on full works.
9
H446/01 Mark Scheme June 2017
ii 11010100 1
(AO1.2)
c Shift Right (1) 2 Allow one mark for correct number of places but wrong direction.
d Binary point: shifted four places gives: 6 Correct answer with clear binary subtraction/2’s complement addition
01001.0 (1) calculation gives full marks.
Binary point shifted two places gives: (AO1.2)
010.010 (1)
13
H446/01 Mark Scheme June 2017
AO2.1
1 mark)
c SELECT passwordHash, locked (1) 3 Do not award first mark for SELECT *
FROM Users (1)
(AO 3.2)
WHERE username=’Apollo’ (1)
d UPDATE Users (1) 3 Allow other updating method e.g. a DELETE statement followed by an
SET locked=1(1) INSERT statement, for full marks e.g.
(AO 3.2)
WHERE username=’Hades’ (1)
DELETE FROM Users
WHERE username = ‘Hades’ (1 mark)
14
H446/01 Mark Scheme June 2017
Candidates may have taken a different approach – any solution that fulfils
Returns false if account is locked (1)
the criteria on the left should get them marks.
Returns false if password is incorrect (1)
8 Mark Band 3–High Level (7-9 marks) AO1.1 Points may include but aren’t limited to:
The candidate demonstrates a thorough
knowledge and understanding issues around (2) AO1 Knowledge and Understanding
computers and the workforce and Artificial
Intelligence. The material is generally accurate AO1.2 Artificial Intelligence (AI) is the study of computers displaying intelligent
and detailed.
behaviour (usually characterised by decision making).
(2)
The candidate is able to apply their knowledge
Ignore and understanding directly and consistently to
the context provided. Evidence/examples will be
AO2.1
AI techniques include neural networks, evolutionary computation, Bayesian
networks etc.
explicitly relevant to the explanation. (2)
Computers are well suited to certain jobs and as AI techniques improve the
The candidate provides a thorough discussion AO3.3 range of jobs they can do is likely to increase.
which is well balanced. Evaluative comments are
consistently relevant and well-considered. (3) AO2.1 Application
15
H446/01 Mark Scheme June 2017
AO3.3 Evaluation
font-family:Arial(;) (1 mark) (AO3.1) .customerQuote must have . and opening and closing { } for 3rd mark.
}
.customerQuote{ (1 mark)
#intro must have # and opening and closing { } for 4th mark
background-color: #E8C3E1(;) (1 mark)
}
Must match case sensitivity, except for ‘Arial’ and ‘darkRed’ and
#intro{ (1 mark) colour code
17
H446/01 Mark Scheme June 2017
(AO1.1)
ii - Change line if(hour>9 && hour<17) … 1 Accept Change ‘greater than’ to ‘great than or equal to’ or similar
… To
if(hour>8 && hour<17) (1 Mark) (AO3.3)
or
… if(hour>=9 && hour<17) (1 Mark)
(Max 4)
18
2018 Mark Scheme
H446/01 Mark Scheme June 2018
- Added AND DepartureDate=4/7/18 Do not give first mark if asterisk is kept (i.e. DELETE *)
(1 Mark per -, Max 3) The Departure Date condition could be placed before
the Destination Name.
17
H446/01 Mark Scheme June 2018
18
H446/01 Mark Scheme June 2018
19
H446/01 Mark Scheme June 2018
S A G E S
R P L E Y
G G Q U O
G G Q U O
P S E T O
E T M C R
S A G E S
R P L E Y
28
H446/01 Mark Scheme June 2018
And..
procedure shiftRow(rowNumber, places)
for i=1 to places
temp1=grid[rowNumber, 4]
temp2=0
for j =0 to 4
temp2=grid[rowNumber,j]
grid[rowNumber,j]=temp1
temp1=temp2
next j
next i
end procedure
Note: within solutions, allow for columns to be referenced first
eg grid[i,rowNumber]
29
H446/01 Mark Scheme June 2018
30
2019 Mark Scheme
H446/01 Mark Scheme June 2019
− CCC AO1.2
− ... followed by MMMCCCC
(1 per -, max 2)
H446/01 Mark Scheme June 2019
− 4C1O AO1.2
− Followed by 3L5C
− Followed by 1M1O5C
d − Correct function name and parameter 5 E.g.
AND the function returns a value. function longest(sequence)
− Use of a loop to correctly iterate AO3.2 currentRun = 0
through the sequence biggestRun = 0
− Adds one to a running total when a C is for i = 0 To sequence.length - 1
encountered if sequence.substring(i, 1) == "C" then
− -when character changes from a C if currentRun = currentRun + 1
running total is > maximum, overwrites else
maximum… if currentRun > biggestRun then
− …correctly reset running total biggestRun = currentRun
end if
1 mark per -, max 5 currentRun = 0
endif
next i
return biggestRun
endfunction
3 a Input Output 3
1 1
2 4 AO3.3 Ignore Q3
3 9
1 per row, max 3
b Squares a number / multiplies a number by 1
itself AO3.3
c − The value 16 is copied to the MAR 2
− The contents of the of the ACC (i.e. 9)
are copied to the MDR AO2.2
− The value 9 is copied to location
16/count
1 per -, max 2
H446/01 Mark Scheme June 2019
d − Consistency 3
− Isolation AO1.1
− Durability
(1 mark per -, max 3)
e Advantage 2
− More characters can be represented AO1.2
− may include foreign alphabets
− may include emojis
Disadvantage
− Reviews take up more storage (4 times
their previous storage size).
OR
0 marks
No attempt to answer the question or
response is not worthy of credit.
H446/01 Mark Scheme June 2019
ii e.g. 2
• only one point of failure
• easier to manage users/access AO1.1
• Easier to backup
• Easier to keep data secure.
• Technicians can more easily remotely install /
monitor.