System software: operating systems, virtual machines and translation – A Level Computer Science (old syllabus, to 2021) (9608)

19 questions · page 1 of 2 · Clear filters

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
1
9608/31/O/N/21 · Question 5Oct/Nov 2021Paper 3112 marks
Loading question…
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]

2
9608/32/O/N/21 · Question 5Oct/Nov 2021Paper 3213 marks
Loading question…
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]

3
9608/32/O/N/21 · Question 7Oct/Nov 2021Paper 324 marks
Loading question…
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]

Advertisement
4
9608/31/O/N/20 · Question 5Oct/Nov 2020Paper 314 marks
Loading question…
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]

5
9608/32/O/N/20 · Question 6Oct/Nov 2020Paper 3210 marks
Loading question…
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]

6
9608/31/O/N/19 · Question 2Oct/Nov 2019Paper 319 marks
Loading question…
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]

7
9608/31/O/N/19 · Question 6Oct/Nov 2019Paper 3110 marks
Loading question…
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]

8
9608/32/O/N/19 · Question 4Oct/Nov 2019Paper 329 marks
Loading question…
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]

Advertisement
9
9608/32/O/N/19 · Question 7Oct/Nov 2019Paper 329 marks
Loading question…
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]

10
9608/31/O/N/18 · Question 5Oct/Nov 2018Paper 3111 marks
Loading question…
Question text

5
A computer process can be in one of three states: running, ready or blocked.
(a) Explain how the processes are affected when the following events take place.
(i)
The running process needs to read a file from a disk.
…
…
…
… [2]
(ii)
The running process uses up its time slice.
…
…
…
… [2]
(b) (i)
State the conditions that are necessary for a process to move from the ready to the
running state.
…
…
…
… [2]
(ii)
State the conditions that are necessary for a process to move from the blocked to the
ready state.
…
…
…
… [2]
(c) Give three reasons why process scheduling is needed.
1 …
…
2 …
…
3 …
…
[3]

11
9608/31/O/N/18 · Question 6Oct/Nov 2018Paper 3113 marks
Loading question…
Question text

6
The compilation process has a number of stages. The first stage is lexical analysis.
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
IF
4A
THEN
4B
ENDIF
4C
ELSE
4D
FOR
4E
STEP
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 code.
1
Start
INPUT Number
// Output values in a loop
Start TO 12
FOR Counter
OUTPUT Number * Counter
ENDFOR
(a) Complete the symbol table to show its contents after the lexical analysis stage.
Token
Symbol
Value
Type
Variable
Start
60
Constant
1
61
[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 stage. Use the keyword table and your answer
to part (a).
60
01
[2]
(c) The output of the lexical analysis stage is the input to the syntax analysis stage.
Identify two tasks in syntax analysis.
1 …
…
2 …
…
[2]
(d) The final stage of compilation is optimisation.
(i)
Code optimisation produces code that minimises the amount of memory used.
Give one additional reason why code optimisation is performed.
…
… [1]
(ii)
A student uses the compiler to compile some different code.
After the syntax analysis stage is complete, the compiler generates object code.
The following lines of code are compiled.
A + B
X
A + B + C
Y
A + B + C + D
Z
The compilation produces the following assembly language code.
LDD
236
//
loads value A to accumulator
ADD
237
//
adds value B to accumulator
STO
512
//
stores accumulator in X
LDD
236
//
loads value A to accumulator
ADD
237
//
adds value B to accumulator
ADD
238
//
adds value C to accumulator
STO
513
//
stores accumulator in Y
LDD
236
//
loads value A to accumulator
ADD
237
//
adds value B to accumulator
ADD
238
//
adds value C to accumulator
ADD
239
//
adds value D to accumulator
STO
514
//
stores accumulator in Z
Rewrite the assembly language code after it has been optimised.
…
…
…
…
…
…
…

12
9608/32/O/N/18 · Question 4Oct/Nov 2018Paper 3215 marks
Loading question…
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
IF
4A
THEN
4B
ENDIF
4C
ELSE
4D
FOR
4E
STEP
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 code.
INPUT Number1
INPUT Number2
INPUT Answer
IF Answer = Number1 + Number2
THEN
OUTPUT 10
ELSE
OUTPUT 0
ENDIF
(a) Complete the symbol table to show its contents after the lexical analysis stage.
Token
Symbol
Value
Type
Variable
Number1
60
Variable
Number2
61
[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. Use the keyword table and your answer to
part (a).
51
60
[2]
(c) A student uses the compiler to compile some different code.
After the syntax analysis is complete, the compiler generates object code.
The following line of code is compiled:
A + B + C − D
X
The compilation produces the following assembly language code.
LDD
236
//
loads value A into accumulator
ADD
237
//
adds value B to accumulator
ADD
238
//
adds value C to accumulator
STO
540
//
stores accumulator in temporary location
LDD
540
//
loads value from temporary location into accumulator
SUB
239
//
subtracts value D from accumulator
STO
235
//
stores accumulator in X
(i)
Identify the final stage in the compilation process that follows this code generation stage.
… [1]
(ii)
Rewrite the equivalent code following the final stage.
…
…
…
…
…
…
…
… [3]
(iii)
State two benefits of the process that is carried out in the final stage.
Benefit 1 …
…
Benefit 2 …
…
[2]
(d) An interpreter is executing a program. The program uses the variables a, b, c and d.
The program contains an expression that is written in infix form. The interpreter converts the
infix expression to RPN.
The RPN expression is:
b a c + * d + 2 −
The interpreter evaluates this RPN expression using a stack.
The current values are:
a = 1
b = 2
c = 2
d = 3
Show the changing contents of the stack as the interpreter evaluates

13
9608/31/O/N/17 · Question 3Oct/Nov 2017Paper 3113 marks
Loading question…
Question text

3
The following syntax diagrams for a particular programming language show the syntax of:
an assignment statement
•
a variable
•
an unsigned integer
•
a letter
•
an operator
•
a digit.
•
Assignment statement
Unsigned
Variable
Operator
Variable
:=
integer
Variable
Digit
Letter
Digit
1
Unsigned integer
2
Digit
3
4
Letter
Operator
5
A
+
6
B
–
C
*
7
^
8
9
0
(a) The following assignment statements are invalid.
Give the reason in each case.
(i)
C2 = C3 + 123
Reason: …
… [1]
(ii)
A3 := B1 – B2
Reason: …
… [1]
(iii)
A32 := A2 * 7
Reason: …
… [1]
(b) Complete the Backus-Naur Form (BNF) for the syntax diagrams shown.
<digit> has been done for you.
<assignment_statement> ::=
…
<variable> ::=
…
<unsigned_integer> ::=
…
<digit> ::= 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0
<letter> ::=
…
<operator> ::=
…
[6]
(c) The definition of <variable> is changed to allow:
one or two letters and
•
zero, one or two digits.
•
Draw an updated version of the syntax diagram for <variable>.
Variable
Letter
[2]
(d) The definition of <assignment_statement> is altered so that its syntax has
<unsigned_integer> replaced by <real>.
A real is defined to be:
at least one digit before a decimal point
•
a decimal point
•
at least one digit after a decimal point.
•
Give the BNF for the revised <assignment_statement> and <real>.
<assignment_statement> ::= …
…
<real> ::= …
…
[2]

Advertisement
14
9608/32/O/N/17 · Question 3Oct/Nov 2017Paper 3210 marks
Loading question…
Question text

3
(a) This diagram shows how applications P, Q and a software development environment can be
run on a virtual machine system.
Software
Application P
Application Q
development
environment
… A … operating
… A … operating system 1
system 2
Virtual machine software / virtual machine monitor
… B … operating system
Hardware
(i)
State the operating systems labelled A and B in the diagram.
A …
B …
[2]
(ii)
Application P is executing and requests data from a file.
Describe what happens after … A … operating system 1 has received the data request
from the application.
…
…
…
…
…
… [3]
(b) A software development company uses virtual machines to produce software.
(i)
State one benefit to the company.
…
… [1]
(ii)
Explain two limitations of this approach.
Limitation 1 …
…
…
…
Limitation 2 …
…
…
…
[4]

15
9608/32/O/N/17 · Question 4Oct/Nov 2017Paper 3217 marks
Loading question…
Question text

4
The following syntax diagrams for a particular programming language show the syntax of:
•
an unsigned number
•
an unsigned integer
•
a digit.
Unsigned number
Digit
Unsigned
Unsigned
.
1
integer
integer
2
3
Unsigned integer
4
Digit
5
6
7
8
9
0
(a) (i)
Explain why 32 is a valid unsigned integer.
…
…
…
… [2]
(ii)
Explain why 32.5 is a valid unsigned number.
…
…
…
… [2]
(b) Complete the Backus-Naur Form (BNF) for the syntax diagrams shown.
<unsigned_number> ::= …
…
<unsigned_integer> ::= …
…
<digit> ::= …
…
[5]
The format of an unsigned number is amended to include numbers with possible exponents.
If an unsigned number has an exponent, then the exponent part:
•
will start with an ‘E’
•
be followed by an optional ‘+’ or ‘−’ sign
•
and be completed by an unsigned integer.
Examples of unsigned numbers with exponents include: 3E2, 3E+3, 3E−32, 3.45E−2
(c) (i)
Redraw the syntax diagram for unsigned number to include numbers that might have
exponents.
[4]
(ii)
Use your syntax diagram from part (c)(i) to write the BNF for an unsigned number to
include numbers with exponents.
<unsigned_number> ::= …
…
…
…
…
…
…
…

Advertisement