Computer Science Topic 1.2 Questions
Computer Science Topic 1.2 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 20
10 A software development team is writing a word game.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [4]
Players are given 10 random letters and asked to find the largest word they can make from those
letters. Each letter can only be used once. The length of the word determines the number of points
awarded. e.g. a word with 6 letters would mean 6 points are awarded.
The function validateAnswer takes in the randomLetters as an array of letters and the
player’s answer as a string. It then checks if the word the player has entered only contains letters
from the 10 random letters with each letter being used only once. (At this stage the program
doesn’t check if the answer provided is an actual word.) It then returns a score, out of 10, for a
valid word or 0 for an invalid word.
Example
OPXCMURETN
Whereas
And
The word RETURN returns 0 (there is only one R in the random letters).
© OCR 2017
21
(b) Complete the function validateAnswer
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
endFunction
[6]
(c) Code is to be added to check if the word is an actual English word. All English words are
stored in a binary search tree.
Give one advantage of storing the words in a binary search tree over an array.
.............................................................................................................................................. [1]
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
[2]
© OCR 2017
23
(ii)* The program is compiled. Explain the process of compilation including how code from
the library becomes part of the finished program, justifying why each stage is necessary.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [9]
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [3]
(iv)* Discuss the differences between assembly code and high-level languages. You should
refer to:
• the advantages and disadvantages of writing programs in assembly code rather
than a high-level language
• when each approach might be used
• why the coffee machine was programmed in assembly code.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
© OCR 2018
...................................................................................................................................... [9]
5
2 A software company decides to build an operating system for OCR smart watches.
(i) List three functions, other than memory management, of an operating system.
1 ........................................................................................................................................
2 ........................................................................................................................................
3 ........................................................................................................................................
[3]
Part of a computer’s memory is represented below (Fig. 2). The operating system divides the
memory into equally sized chunks.
Fig. 2
(ii) State the name of the type of memory management used in Fig. 2.
...................................................................................................................................... [1]
(iii) The operating system needs to load program C into memory but there is not enough
space. Describe how the operating system would use virtual memory to load program C.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [3]
Features
The new OCR Smart Watch:
1. Uses the CB2 RISC processor for long battery life
2. Stores up to 20hrs of music
3. Tracks fitness
Download The Factsheet
(i) Write the HTML to produce the extract from the webpage above. You can assume it will
be placed within the <body> tags of a pre-existing page. You do not need to specify the
font.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [5]
© OCR 2018
7
(ii) Explain what happens when a search engine indexes the page. You do not need to
discuss ranking.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [3]
(iii) Explain why using a RISC processor rather than a CISC processor is likely to result in
increased battery life.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [3]
(a) Explain why the self-driving system will use a real-time operating system.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [3]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [2]
...................................................................................................................................................
.............................................................................................................................................. [1]
In order to keep up to date with the latest virus threats, the company is continually updating their
software.
The programmers use an Extreme Programming approach when developing the updates.
(c) Explain what is meant by Extreme Programming and why it is a suitable approach in this
case.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [4]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [3]
When running the anti-virus software, an operating system uses a scheduling algorithm to
determine an allocation of CPU time to the anti-virus software.
(e) Explain why a First Come First Served scheduling algorithm would not be suitable in this
situation.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [2]
In the late 1990s the CIH virus hit headlines because it was able to overwrite and destroy the
contents of a computer’s BIOS.
(f) Describe what the effect would be of a computer having its BIOS overwritten.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [2]
© OCR 2019
19
8 A simple program is shown below.
count = 0
while (count*num)<=100
count=count+1
endwhile
Fig. 8.1
(a) State the output of the program when the number 30 is entered.
...................................................................................................................................................
.............................................................................................................................................. [1]
(b) State the most suitable data type of the variable count
...................................................................................................................................................
.............................................................................................................................................. [1]
(c) State the data type of the result of the expression (count*num)<=100
...................................................................................................................................................
.............................................................................................................................................. [1]
...................................................................................................................................................
.............................................................................................................................................. [1]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [2]
(f) Referring to examples in the code in Fig. 8.1, explain what happens in Lexical Analysis.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [3]
(g) State the name of the stage of compilation that directly follows Lexical Analysis.
...................................................................................................................................................
.............................................................................................................................................. [1]
© OCR 2019
2020 Questions 19
..........................................................................................................................................................
..........................................................................................................................................................
Ignore This 12
..........................................................................................................................................................
Marker Start Below
..........................................................................................................................................................
..........................................................................................................................................................
................................................................................................................................................... [12]
9 (a) Imogen buys a desktop computer. It comes with an operating system installed.
(i) Describe two ways that an operating system could manage physical memory.
1 ........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
[4]
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [2]
(iii) Describe how virtual memory allows a user to run programs when physical memory is
full.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [2]
© OCR 2020 Turn over
20
Operating systems make use of device drivers.
(b) Define what is meant by the term ‘device driver’, giving one example of a device driver that a
home user would need.
Definition ...................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Example ....................................................................................................................................
...................................................................................................................................................
[3]
(c) Give two examples of utility software, explaining the purpose of both.
1 ................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
2 ................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
[4]
© OCR 2020
21
(d) Imogen installs a compiler for a high-level programming language onto her computer and
makes use of an open source IDE (Integrated Development Environment).
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [2]
(ii) Give one benefit to Imogen of using an open source IDE rather than a closed source
IDE.
...........................................................................................................................................
...................................................................................................................................... [1]
(i) Explain what is meant by a library, giving one example of when one may be used.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [3]
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [2]
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [2]
(iv) Explain how linkers are used during the compilation process.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [3]
© OCR 2020
2017 Mark Scheme
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 1)
(Max 4)
18
H446/01 Mark Scheme June 2017
randomLetters[j]=”!”
else
return 0
endif
i=i+1
endwhile
return answer.length
c - BS Tree can be searched quicker than an array. 1 Accept O(log n) search time rather than O(n)
(AO1.2)
19
H446/01 Mark Scheme June 2017
(Max 2)
dii - Mark Band 3–High Level (7-9 marks) AO1.1 Points may include but are not limited to:
The candidate demonstrates a thorough
knowledge and understanding of how source (2) AO1 Knowledge and Understanding
code is compiled and library code incorporated.
The material is generally accurate and detailed. AO1.2 The compiler is effectively a group of programs.
The candidate is able to apply their knowledge (2) The stages of compilation are: lexical analysis, syntax analysis, code
and understanding directly and consistently to the
generation and optimisation.
context provided. Evidence/examples will be AO2.1
explicitly relevant to the explanation.
A linker is then used to combine the object code with the library code to
(2)
The candidate provides a thorough discussion make the final executable.
which is well balanced. Evaluative comments are AO3.3
consistently relevant and well-considered. AO2.1 Application
(3)
There is a well-developed line of reasoning which Source code is input into a compiler program.
is clear and logically structured. The information 9
presented is relevant and substantiated. The first stage is lexical analysis in which..
Mark Band 2-Mid Level (4-6 marks) Comments and whitespace are removed
The candidate demonstrates reasonable
knowledge and understanding of how source Variables, and subroutines stored in symbol table
code is compiled and library code incorporated;
the material is generally accurate but at times Which also holds data such as scope and data type
underdeveloped.
Code is converted to a series of tokens
The candidate is able to apply their knowledge
and understanding directly to the context The series of tokens and symbol table is passed onto the next stage, syntax
20
H446/01 Mark Scheme June 2017
The candidate provides a sound discussion, the This is often accomplished by placing the tokens into a (abstract syntax)
majority of which is focused. Evaluative tree.
comments are for the most part appropriate,
although one or two opportunities for Where it breaks the rules of the language errors are generated.
development are missed.
If no rules are broken then it’s passed on to the next stage…
There is a line of reasoning presented with some
structure. The information presented is in the ..Which is code generation.
most part relevant and supported by some
evidence. Here the object code (accept machine code) is created.
Mark Band 1-Low Level (1-3 marks) (i.e. the binary that is executed by the processor)
The candidate demonstrates a basic knowledge
of how source code is compiled and/or library This code may be inefficient..
code incorporated; the material is basic and
contains some inaccuracies. The candidate .. it may contain unnecessary instructions or groups of instructions that can
makes a limited attempt to apply acquired
be replaced by simpler ones.
knowledge and understanding to the context
provided.
Code from the library is likely already compiled.
The candidate provides a limited discussion
And may well have been written in a different language to the main
which is narrow in focus. Judgments if made are
weak and unsubstantiated. The information is program.
basic and communicated in an
unstructured way. The information is supported The main program source code will have contained lines importing the
by limited evidence and the relationship to the library code.
evidence may not be clear.
A program called a linker can incorporate the code from the library with the
0 marks main program…
No attempt to answer the question or response is …into a single executable file.
not worthy of credit. An alternative approach is for the main executable to link to the compiled
library code (i.e. dynamic linking).
AO3.3 Evaluation
Lexical analysis is necessary to put the code into a format which can be
21
H446/01 Mark Scheme June 2017
Code generation is necessary to turn the code into a format that the
processor can understand (i.e. binary machine code).
The code optimisation whilst not necessary, does ensure the code runs
quicker or using less memory.
2017 MS Stops Here Linking is necessary to ensure the library code is incorporated into the final
program.
11 a - 3
(AO1,1)
22
2018 Mark Scheme
H446/01 Mark Scheme June 2018
12
H446/01 Mark Scheme June 2018
The candidate is able to apply their knowledge and As high level code is more intuitive and easier to read it
understanding directly to the context provided although is easier to follow, debug and build as part of a team. It
one or two opportunities are missed. can also be written in a much shorter time frame.
Evidence/examples are for the most part implicitly The high level code can be recompiled for different
relevant to the explanation. architectures.
High level languages come in a variety of paradigms so
The candidate provides a sound discussion, the programmers can choose according to the
majority of which is focused. Evaluative comments are problem/their preference.
for the most part appropriate, although one or two
opportunities for development are missed. AO3
Assembly language is best suited to situations such as:
13
H446/01 Mark Scheme June 2018
0 marks
No attempt to answer the question or
response is not worthy of credit.
14
H446/01 Mark Scheme June 2018
ii Paging 1
(AO1.1)
iii - Operating system uses area of secondary storage 3
as virtual memory. (AO2.1)
- Move unused pages/parts (of program A and/or
B) into virtual memory
- Load program C into (physical) memory.
(1 Mark per -, Max 3)
15
H446/01 Mark Scheme June 2018
16
H446/01 Mark Scheme June 2018
24
2019 Mark Scheme
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