EXAM QUESTIONS · A LEVEL 9618

System Software (A2) Exam-Style Questions with Answers (A Level 9618)

Original exam-style questions on process management and scheduling, interrupts, memory management with paging and segmentation, virtual memory and disk thrashing, the stages of compilation, BNF and Reverse Polish notation for Cambridge AS & A Level Computer Science 9618 (Paper 3). There are 26 marks in total. Try each question on paper first, then press Show answer to see the mark scheme. Answers that can be calculated mark themselves.

Question 1[4 marks]

Describe the three states of a process and one transition between them.

Show answer
  • Running: the process is being executed by the processor. [1]
  • Ready: the process is waiting for the processor to become available. [1]
  • Blocked: the process is waiting for an event, e.g. input/output to finish. [1]
  • Transition, e.g. running → ready when its time slice ends; running → blocked when it requests I/O; blocked → ready when the I/O finishes; ready → running when the scheduler gives it the processor. [1]
Question 2[4 marks]

Describe the round robin and shortest job first scheduling algorithms.

Show answer
  • Round robin: each process gets a fixed time slice in turn [1]; if it has not finished, it goes to the back of the ready queue. [1]
  • Shortest job first: the process with the shortest expected run time is chosen next [1]; this gives a low average waiting time, but long processes may wait a long time (starvation). [1]
Question 3[4 marks]

Compare paging and segmentation.

Show answer

Any four from:

  • Paging divides memory and processes into fixed-size blocks (pages and frames).
  • Segmentation divides a process into variable-size blocks based on its logical parts, e.g. a function or data area.
  • Paging is a physical division; segmentation is a logical division.
  • A page table maps pages to frames; a segment table stores segment numbers and lengths.
  • Paging can cause internal fragmentation; segmentation can cause external fragmentation.
Question 4[3 marks]

Explain what disk thrashing is and why it happens.

Show answer
  • Pages are swapped between RAM and virtual memory (secondary storage) so often [1] that the processor spends more time swapping than executing instructions. [1]
  • It happens when there is too little RAM for the processes being run, so pages that were just moved out are needed again almost straight away. [1]
Question 5[4 marks]

Describe what happens in each stage of compilation.

  1. Lexical analysis [1]
  2. Syntax analysis [1]
  3. Code generation [1]
  4. Optimisation [1]
Show answer
  1. Removes white space and comments, and converts the source code into tokens; builds the symbol table. [1]
  2. Checks that the tokens follow the grammar rules of the language, e.g. using BNF; produces a parse tree and reports syntax errors. [1]
  3. Produces object/machine code from the parsed program. [1]
  4. Changes the code so it runs faster or uses less memory, e.g. removing redundant instructions. [1]
Question 6[2 marks]

Evaluate the Reverse Polish expression 3 4 + 2 *.

Show answer

14 [2]

Push 3, push 4; + pops both and pushes 7; push 2; * pops 7 and 2 and pushes 14.

Question 7[2 marks]

Convert the infix expression (a + b) * (c − d) to Reverse Polish notation.

Show answer

a b + c d − *

1 mark for a b + and c d −, 1 mark for * at the end. [2]

Question 8[3 marks]

A language defines a digit and an integer using BNF:

<digit> ::= 0|1|2|3|4|5|6|7|8|9
<integer> ::= <digit> | <digit><integer>

Explain why 507 is a valid integer and why −3 is not.

Show answer
  • 507: 5 is a digit followed by an integer 07, where 0 is a digit followed by the integer 7 (a single digit) – the recursive rule allows any number of digits. [2]
  • −3 is not valid because “−” is not defined as a digit, and no rule allows a sign. [1]

Frequently asked questions

What is Reverse Polish notation?

A way of writing expressions where each operator comes after its operands, e.g. 3 4 + instead of 3 + 4. It needs no brackets and can be evaluated using a stack.

Are these past paper questions?

No. These are original exam-style questions written by a Computer Science teacher in the Cambridge style.

Revise the topic: 9618 system software (A2) notes · 9618 flashcards · All exam-style questions