System software: operating systems, virtual machines and translation – A Level Computer Science (old syllabus, to 2021) (9608)
28 questions · page 1 of 2 · Clear filters
Question text
5
(a) Flora has written a program that uses the variables a, b, c and d.
Part of the program contains the following calculations:
a
=
2
b
=
5
c
=
7
d
=
a * b – (a + b + c)
(i)
Write the Reverse Polish Notation (RPN) for the expression:
a * b – (a + b + c)
… [2]
(ii)
Show the changing contents of the stack as the value for variable d is calculated from
the RPN expression.
[4]
(b) Convert the following RPN expression back to its original infix form.
d b * b c d + - + a /
…
…
…
…
… [3]
(c) Explain why expressions are evaluated using RPN.
…
…
…
…
…
… [3]
Question text
5
(a) Flora has written a program that uses the variables p, q, r and s.
Part of the program contains the following calculations:
p
=
5
q
=
4
r
=
1
s
=
p * (p - q + r)
(i)
Write the Reverse Polish Notation (RPN) for the expression:
p * (p - q + r)
… [2]
(ii)
Show the changing contents of the stack as the value for s is calculated from the RPN
expression.
[4]
(b) Convert this RPN expression back to its original infix form.
p q * p q r + - + p /
…
…
…
…
… [3]
(c) Syntax analysis is one stage of the compilation of a program.
Identify and describe two other stages of compilation.
Stage 1 …
Description …
…
…
Stage 2 …
Description …
…
…
[4]
Question text
7
A virtual machine is the software emulation of a computer system using another computer system.
Describe two benefits and two limitations of using a virtual machine.
Benefit 1 …
…
…
Benefit 2 …
…
…
Limitation 1 …
…
…
Limitation 2 …
…
…
[4]
Question text
5
Complete these statements about a virtual machine.
A virtual machine is … that emulates a
… computer system.
A virtual machine allows multiple … operating systems to run
on one computer using a … operating system.
[4]
Question text
6
Mahmoud is developing a new application, MyApp, that needs to work with three different
operating systems (OS1, OS2 and OS3).
He has decided to use virtual machine software to test MyApp with these three different operating
systems.
The diagram shows MyApp running on three virtual machines.
MyApp
MyApp
MyApp
OS1
OS2
OS3
Virtual machine software
OS4
Hardware
(a) Describe the roles of the four operating systems (OS1, OS2, OS3 and OS4) shown in the
diagram.
…
…
…
…
… [3]
(b) Describe the role of the virtual machine software in the testing of MyApp.
…
…
…
…
…
… [3]
(c) Explain one benefit and one drawback of this approach to testing MyApp.
Benefit …
…
…
…
Drawback …
…
…
…
[4]
Question text
5
Complete these three statements about computer processors.
A processor with a few simple fixed-length instructions that have a small number of instruction
formats is called a … processor.
A processor with many complex variable-length instructions that has many instruction formats is
called a … processor.
Instruction-level parallelism, applied to the execution of instructions during the fetch-execute cycle,
is called … .
[3]
Question text
6
Duraid writes a short program in a high-level programming language. An interpreter executes the
program.
The following is part of Duraid’s program.
DECLARE P, Q, R, X, Y : INTEGER
CONSTANT M = 10
P
=
4
Q
=
2
R
=
1
X
=
(P + Q) * (P – Q)
Y
=
(M / Q) * (P + Q - R)
(a) Write the Reverse Polish Notation (RPN) for the following expression from Duraid’s program.
(P + Q) * (P – Q)
… [2]
(b) The interpreter is executing Duraid’s program. The expressions are in infix form.
The interpreter converts the infix to RPN.
The RPN expression for Y is:
M Q / P Q + R − *
The interpreter evaluates this RPN expression using a stack.
(i)
Show the changing contents of the stack, as the interpreter evaluates the expression
for Y.
Use the values of the variables and constant given in the program. The first entry has
been done for you.
10
[4]
(ii)
Convert the following RPN expression back to its infix form.
P Q + M * R P − −
…
… [2]
(c) Explain how RPN is used by an interpreter to evaluate expressions.
…
…
…
… [2]
Question text
7
A computer at a remote weather station is performing three tasks:
•
measuring and recording the temperature every 10 seconds
•
measuring and recording the wind speed every 10 seconds
•
sending the previous day’s temperature and wind speed readings to a scientist at another
location via the Internet.
The operating system is managing the multitasking of these tasks.
(a) At one point in time:
•
the temperature measuring and recording task is idle
•
the wind speed is being recorded
•
the task to send the previous day’s temperature and wind speed readings is waiting for
an internet connection.
Identify the process state for each task. Give a reason why each task is in that process state.
Temperature measuring and recording process state …
Reason …
…
…
Wind speed measuring and recording process state …
Reason …
…
…
Sending process state …
Reason …
…
…
[6]
(b) The weather station computer uses an operating system.
Explain how this operating system uses interrupts to schedule the measuring and recording
tasks.
…
…
…
…
…
…
…
… [4]
Question text
2
The following syntax diagrams for a programming language show the syntax of:
•
a condition
•
a variable
•
a number
•
a letter
•
a digit
•
an operator
condition
variable
operator
number
variable
variable
letter
number
digit
digit
letter
a
b
c
digit
operator
1
==
2
>
3
<
4
5
(a) The following conditions are invalid.
Give the reason in each case.
(i)
35 > 24
Reason …
… [1]
(ii)
abc := cba
Reason …
… [1]
(iii)
bc < 49
Reason …
… [1]
(b) Complete the Backus-Naur Form (BNF) for the syntax diagram.
<operator> ::= …
…
<number> ::= …
…
<variable> ::= …
…
<condition> ::= …
…
[6]
Question text
6
(a) An operating system (OS) uses a memory management technique called paging.
Explain what is meant by the following terms.
Page …
…
…
Page frame …
…
…
Page table …
…
…
[3]
(b) Explain why an operating system needs to use scheduling algorithms.
…
…
…
…
…
… [3]
(c) State what is meant by an interrupt.
…
… [1]
(d) For a computer system using multi-programming, the low-level scheduler decides which
process will get next use of the processor.
One algorithm could be a round-robin, which means every process gets use of the processor
in sequence for a fixed amount of time (time-slice).
For a round-robin algorithm, five processes are currently loaded and get the use of the
processor in the sequence:
JOB21 – JOBSS – JOBPT – JOB32 – JOB42, then return to JOB21
Process JOB32 has just completed its time-slice.
The following paragraph describes what happens next. Complete the paragraph by inserting
the missing processes.
Interrupt
received
from
the
low-level
scheduler.
Save
all
register
contents
for
… .
Copy the saved registers for … to the CPU.
The processor will now process … .
[3]
Question text
4
Physical memory is managed using virtual memory and paging.
(a) Describe what is meant by virtual memory.
…
…
…
… [2]
(b) (i)
Explain how paging is used to manage virtual memory.
…
…
…
…
…
…
…
… [4]
(ii)
Give a suitable page replacement algorithm for this process.
… [1]
(iii)
One drawback of using virtual memory is disk thrashing.
Describe what is meant by the term disk thrashing.
…
…
…
… [2]
Question text
7
The following are the first few lines of a source code program written in a high-level language. The
source code program is to be translated by the language compiler.
// program written on 15 June 2019
DECLARE IsFound : Boolean;
DECLARE NoOfChildren : Integer;
DECLARE Count : Integer;
Constant TaxRate = 15;
// start of main program
For Count = 1 to 50
…
…
…
(a) During the lexical analysis stage, the compiler will use a keyword table and a symbol table.
(i)
Identify two types of data in the keyword table.
Type 1 …
Type 2 …
[2]
(ii)
Identify two types of data in the symbol table.
Type 1 …
Type 2 …
[2]
(iii)
Explain how the contents of the keyword and symbol tables are used to translate the
source code program.
…
…
…
… [2]
(iv)
State one additional task completed at the lexical analysis stage that does not involve
the use of a keyword or a symbol table.
…
… [1]
(b) The final stage of compilation can be code optimisation.
Explain why code is optimised.
…
…
…
… [2]
Question text
4
A compiler uses a keyword table and a symbol table. Part of the keyword table is shown.
•
Tokens for keywords are shown in hexadecimal.
•
All of the keyword tokens are in the range 00 – 5F.
Keyword
Token
01
+
02
=
03
<>
04
IF
4A
THEN
4B
ENDIF
4C
ELSE
4D
REPEAT
4E
UNTIL
4F
TO
50
INPUT
51
OUTPUT
52
ENDFOR
53
Entries in the symbol table are allocated tokens. These values start from 60 (hexadecimal).
Study the following piece of pseudocode.
0
Counter
INPUT Password
REPEAT
IF Password <> "Cambridge"
THEN
INPUT Password
ENDIF
Counter + 1
Counter
UNTIL Password = "Cambridge"
OUTPUT Counter
(a) Complete the symbol table to show its contents after the lexical analysis stage.
Token
Symbol
Value
Type
60
Variable
Counter
[3]
(b) The output from the lexical analysis stage is stored in the following table. Each cell stores one
byte of the output.
Complete the output from the lexical analysis using the keyword table and your answer to
part (a).
60 01
[2]
(c) The following table shows assembly language instructions for a processor which has one
general purpose register, the Accumulator (ACC).
Instruction
Explanation
Op code
Operand
Direct addressing. Load the contents of the location at the given
LDD
<address>
address to ACC
Add the contents of the given address to the ACC
ADD
<address>
Store the contents of ACC at the given address
STO
<address>
After the syntax analysis is completed successfully, the compiler generates object code.
The following lines of high level language code are compiled.
X = X + Y
Z = Z + X
The compilation produces the assembly language code as follows:
LDD
236
ADD
237
STO
236
LDD
238
ADD
236
STO
238
(i)
The final stage in the compilation process that follows this code generation stage is code
optimisation.
Rewrite the equivalent code after optimisation.
…
…
…
…
…
… [3]
(ii)
Explain why code optimisation is necessary.
…
…
…
… [2]
Question text
4
(a) Describe the main steps in the evaluation of a Reverse Polish Notation (RPN) expression
using a stack.
…
…
…
…
…
…
…
… [4]
(b) The infix expression 8 * (5 – 2) – 30 / (2 * 3) converts to:
8 5 2 – * 30 2 3 * / –
in Reverse Polish Notation (RPN).
Show the changing contents of the stack as this RPN expression is evaluated.
[4]
Question text
8
(a) A computer process can be in one of three states.
Identify and describe two of these states.
State 1 …
Description …
…
…
State 2 …
Description …
…
…
[6]
(b) One of the main tasks of an operating system is resource management.
Describe how an operating system can maximise the use of resources.
Primary memory …
…
…
…
…
…
Disk …
…
…
…
…
…
[6]
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of the University of