KEMBAR78
9618 Computer Science | PDF | Computing | Computer Science
0% found this document useful (0 votes)
128 views136 pages

9618 Computer Science

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
128 views136 pages

9618 Computer Science

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 136

Cambridge International AS & A Level

* 4 7 5 7 0 1 8 5 5 9 *

COMPUTER SCIENCE 9618/32


Paper 3 Advanced Theory May/June 2021

1 hour 30 minutes

You must answer on the question paper.

No additional materials are needed.

INSTRUCTIONS
● Answer all questions.
● Use a black or dark blue pen.
● Write your name, centre number and candidate number in the boxes at the top of the page.
● Write your answer to each question in the space provided.
● Do not use an erasable pen or correction fluid.
● Do not write on any bar codes.
● You may use an HB pencil for any diagrams, graphs or rough working.
● Calculators must not be used in this paper.

INFORMATION
● The total mark for this paper is 75.
● The number of marks for each question or part question is shown in brackets [ ].
● No marks will be awarded for using brand names of software packages or hardware.

This document has 12 pages.

DC (LK/CB) 205788/1
© UCLES 2021 [Turn over
2

1 Real numbers are stored in a computer system using floating-point representation with:

• 10 bits for the mantissa


• 6 bits for the exponent
• Two’s complement form for both the mantissa and the exponent.

(a) Calculate the normalised floating-point representation of –7.25 in this system.


Show your working.

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]

(b) Calculate the denary value of the given binary floating-point number.
Show your working.

Mantissa Exponent

1 0 1 1 0 0 0 1 1 1 0 0 0 1 1 1

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Answer ......................................................................................................................................
[3]

© UCLES 2021 9618/32/M/J/21


3

(c) The given binary floating-point number is not normalised.

Normalise the floating-point number. Show your working.

Mantissa Exponent

0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]

(d) The denary number 513 cannot be stored accurately as a normalised floating-point number in
this computer system.

(i) Explain the reason for this.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [3]

(ii) Describe an alteration to the way floating-point numbers are stored to enable this number
to be stored accurately using the same total number of bits.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [2]

© UCLES 2021 9618/32/M/J/21 [Turn over


4

2 (a) Describe the purpose of a user-defined data type.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Define, using pseudocode, the following enumerated data types:

(i) SchoolDay to hold data about the days students are usually in school.

...........................................................................................................................................

..................................................................................................................................... [1]

(ii) WeekEnd to hold data about the days that are not school days.

...........................................................................................................................................

..................................................................................................................................... [1]

(c) Define, using pseudocode, the composite data type ClubMeet. This will hold data about club
members that includes:

• first name and last name


• the two days they attend:
○ one on a school day
○ one not on a school day.

Use the enumerated types you created in part (b).

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

© UCLES 2021 9618/32/M/J/21


5

3 (a) Draw one line to connect each Operating System (OS) term to the most appropriate
description about it.

OS term Description

Using secondary storage to simulate


additional main memory
Multi-tasking

Managing the processes running on


the CPU
Paging

Managing the execution of many programs


that appear to run at the same time

Interrupt handling

Locating non-contiguous blocks of data and


relocating them

Scheduling
Transferring control to another routine when
a service is required

Virtual memory
Reading/writing same-size blocks of data
from/to secondary storage when required

[5]

(b) Explain how an interpreter executes a program without producing a complete translated
version of it.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

© UCLES 2021 9618/32/M/J/21 [Turn over


6

4 (a) (i) Explain why Reverse Polish Notation (RPN) is used to carry out the evaluation of
expressions.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [2]

(ii) Identify, with reasons, a data structure that could be used to evaluate an expression
in RPN.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [2]

(b) Write the infix expression in RPN.

(a – b) * (a + c) / 7

...................................................................................................................................................

............................................................................................................................................. [1]

(c) Write the RPN expression as an infix expression.

a b / 4 * a b + -

...................................................................................................................................................

............................................................................................................................................. [1]

(d) Evaluate the RPN expression:

a b + c d / /

where a = 17, b = 3, c = 48 and d = 12.

Show your working.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2021 9618/32/M/J/21


7

5 (a) Calculate the shortest distance between the base and each of the other towns in the diagram
using Dijkstra’s algorithm.

Show your working and write your answers in the table provided.

Base
4
5

Town 1 2
1 Town 2
8

Town 3

7 3 Town 6
1

5
6
Town 4 Town 5

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Answers

Town 1 Town 2 Town 3 Town 4 Town 5 Town 6

[5]

© UCLES 2021 9618/32/M/J/21 [Turn over


8

(b) Explain the use of graphs to aid Artificial Intelligence (AI).

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

6 Give two benefits and two drawbacks of packet switching.

Benefit 1 ...........................................................................................................................................

..........................................................................................................................................................

Benefit 2 ...........................................................................................................................................

..........................................................................................................................................................

Drawback 1 ......................................................................................................................................

..........................................................................................................................................................

Drawback 2 ......................................................................................................................................

..........................................................................................................................................................
[4]

© UCLES 2021 9618/32/M/J/21


9

7 The diagram shows a logic circuit.

A P
Y
B

C R

Z
Q

(a) Complete the truth table for the given logic circuit. Show your working.

Inputs Working space Outputs


A B C P Q R Y Z
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
[3]
(b) State the name of the logic circuit.

............................................................................................................................................. [1]

(c) Write the Boolean expressions for the two outputs Y and Z in the truth table as
sum-of-products and state the purpose of each output.

Y = ............................................................................................................................................

Purpose ....................................................................................................................................

Z = ............................................................................................................................................

Purpose ....................................................................................................................................
[4]

© UCLES 2021 9618/32/M/J/21 [Turn over


10

8 (a) State two factors that may affect the performance of a sorting algorithm.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) The given algorithm is a simple bubble sort that arranges a set of scores stored in a one-
dimensional array into descending order, and orders the corresponding students’ names
stored into a two-dimensional array in the same order as the scores. All the arrays are indexed
from 1.

The contents of both arrays after sorting are shown.

Name
Score
1 2
1 98 1 Smithfield Tom
2 97 2 Johnson Jane

… …

248 5 248 Peters Jade


249 3 249 Allen John

YearSize 249 ←
Flag ←
TRUE
WHILE Flag = TRUE
Flag FALSE←
FOR Student ←
1 TO YearSize - 1
IF Score[Student] < Score[Student + 1] THEN
Temp1 ←
Score[Student]
Temp2 ←
Name[Student,1]
Temp3 ←
Name[Student,2]
Score[Student] Score[Student + 1] ←
Name[Student,1] Name[Student + 1,1] ←
Name[Student,2] Name[Student + 1,2] ←
Score[Student + 1] Temp1 ←
Name[Student + 1,1] Temp2 ←
Name[Student + 1,2] Temp3 ←
Flag TRUE ←
ENDIF
NEXT Student
ENDWHILE

© UCLES 2021 9618/32/M/J/21


11

Write an algorithm, using pseudocode, that will perform the same task using an insertion sort.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [6]

© UCLES 2021 9618/32/M/J/21 [Turn over


12

9 (a) Describe what is meant by an imperative (procedural) programming language.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Describe what is meant by a declarative programming language.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(c) Identify the programming paradigm for each of these program code examples.

Program code example Programming paradigm


male(john).
female(ethel).
parent(john, ethel).
FOR Counter = 1 TO 20
X = X * Counter
NEXT Counter
Start: LDD Counter
INC ACC
STO Counter
public class Vehicle
{
private speed;
public Vehicle()
{
speed = 0;
}
}
[4]

Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the
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
Cambridge Local Examinations Syndicate (UCLES), which itself is a department of the University of Cambridge.

© UCLES 2021 9618/32/M/J/21


Cambridge International AS & A Level
* 7 9 2 0 7 5 1 8 6 5 *

COMPUTER SCIENCE 9618/32


Paper 3 Advanced Theory October/November 2021

1 hour 30 minutes

You must answer on the question paper.

No additional materials are needed.

INSTRUCTIONS
● Answer all questions.
● Use a black or dark blue pen.
● Write your name, centre number and candidate number in the boxes at the top of the page.
● Write your answer to each question in the space provided.
● Do not use an erasable pen or correction fluid.
● Do not write on any bar codes.
● You may use an HB pencil for any diagrams, graphs or rough working.
● Calculators must not be used in this paper.

INFORMATION
● The total mark for this paper is 75.
● The number of marks for each question or part question is shown in brackets [ ].
● No marks will be awarded for using brand names of software packages or hardware.

This document has 16 pages. Any blank pages are indicated.

DC (RW/SW) 206388/2
© UCLES 2021 [Turn over
2

1 (a) Numbers are stored in a computer using floating-point representation with:

• 12 bits for the mantissa


• 4 bits for the exponent
• two’s complement form for both the mantissa and exponent.

(i) Write the normalised floating-point representation of the following unsigned binary
number using this system.

1011100.011001
Working .............................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

Mantissa Exponent

[2]

(ii) State the consequence of storing the binary number in part (a)(i) as a floating-point
number in this system. Justify your answer.

Consequence ....................................................................................................................

...........................................................................................................................................

Justification .......................................................................................................................

...........................................................................................................................................

...........................................................................................................................................
[2]

(b) Explain the reason why binary numbers are stored in normalised form.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]
© UCLES 2021 9618/32/O/N/21
3

2 Draw one line from each programming paradigm to its most appropriate description.

Programming paradigm Description

Programs using the instruction set of a


processor

Declarative
Programs based on events such as user
actions or sensor outputs

Imperative
Programs using the concepts of class,
inheritance, encapsulation and
polymorphism
Low-level

Programs with an explicit sequence of


commands that update the program state,
Object-oriented with or without procedure calls

Programs that specify the desired result


rather than how to get to it

[4]

3 Enumerated and pointer are two non-composite data types.

(a) Write pseudocode to create an enumerated type called Parts to include these parts sold in
a computer shop:

Monitor, CPU, SSD, HDD, LaserPrinter, Keyboard, Mouse

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Write pseudocode to create a pointer type called SelectParts that will reference the
memory location in which the current part name is stored.

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2021 9618/32/O/N/21 [Turn over


4

4 The following syntax diagrams for a particular programming language show the syntax of:

• a digit
• a capital letter
• a character.

digit capital letter


0 A

1 E

2 I

3 O

4 U

5 character
$

6
%

7
&

8
*

9
#

(a) Write the Backus-Naur Form (BNF) notation of the syntax diagram for character.

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2021 9618/32/O/N/21


5

(b) A password must begin with a character and be followed by one or more digits or capital
letters.

(i) State an example of a valid password.

..................................................................................................................................... [1]

(ii) A valid password is represented by the syntax diagram:

password
character digit

capital letter

Write the BNF notation of the syntax diagram for password.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [4]

© UCLES 2021 9618/32/O/N/21 [Turn over


6

5 (a) Compare sequential and serial methods of file organisation.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

(b) State the most suitable method of file access when a record is referenced by a unique
address on a disk-type storage medium.

............................................................................................................................................. [1]

(c) State the most suitable method of file access when a bank stores its data records in ascending
order of account number.

............................................................................................................................................. [1]

© UCLES 2021 9618/32/O/N/21


7

6 (a) Explain how packet switching is used to transfer messages across the internet.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [5]

(b) Outline the function of a router in packet switching.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

© UCLES 2021 9618/32/O/N/21 [Turn over


8

7 (a) Write the Boolean expression that corresponds to the given truth table as a sum-of-products.

INPUT OUTPUT

A B C D Z

0 0 0 0 0

0 0 0 1 0

0 0 1 0 0

0 0 1 1 0

0 1 0 0 0

0 1 0 1 0

0 1 1 0 0

0 1 1 1 0

1 0 0 0 0

1 0 0 1 1

1 0 1 0 0

1 0 1 1 1

1 1 0 0 1

1 1 0 1 1

1 1 1 0 1

1 1 1 1 1

Z = ............................................................................................................................................

............................................................................................................................................. [3]

© UCLES 2021 9618/32/O/N/21


9

(b) (i) Complete the Karnaugh map (K-map) for the given truth table.

AB

CD 00 01 11 10

00

01

11

10

[2]

(ii) Draw loop(s) around appropriate group(s) of 1s in the K-map to produce an optimal
sum-of-products. [2]

(iii) Write the Boolean expression from your answer to part b(ii) as a simplified
sum-of-products.

Z = .....................................................................................................................................

..................................................................................................................................... [2]

(iv) Write the simplified Boolean expression for your answer to part b(iii).

Z = .....................................................................................................................................

..................................................................................................................................... [1]

© UCLES 2021 9618/32/O/N/21 [Turn over


10

8 (a) Describe the purpose of the Secure Sockets Layer (SSL) and Transport Layer Security (TLS)
protocols.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Explain how SSL/TLS protocols are used when a client-server communication is initiated.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

© UCLES 2021 9618/32/O/N/21


11

9 (a) The diagram shown represents an artificial neural network.

Output
Layer
Input
Layer
Hidden Hidden
Layer 1 Hidden Layer 3
Layer 2

(i) State the reason for having multiple hidden layers in an artificial neural network.

...........................................................................................................................................

..................................................................................................................................... [1]

(ii) Explain how artificial neural networks enable machine learning.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [4]

© UCLES 2021 9618/32/O/N/21 [Turn over


12

(b) Find the shortest path between the Home and School nodes using the A* algorithm.
Show your working in the table provided.

The first two rows in the table have been completed.

14

h = 10 Home 9
g=1 4
A 5 C
3
7
B 6
2
6
D 6
3
7
F
1
2
3
E
3 5
School

Node Cost from Home node (g) Heuristic (h) Total (f = g + h)

Home 0 14 14

A 1 10 11

Final path
[5]

© UCLES 2021 9618/32/O/N/21


13

10 (a) State three essential features of recursion.

1 ................................................................................................................................................

...................................................................................................................................................

2 ................................................................................................................................................

...................................................................................................................................................

3 ................................................................................................................................................

...................................................................................................................................................
[3]

(b) Explain the reasons why a stack is a suitable Abstract Data Type (ADT) to implement
recursion.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

(c) Identify two ADTs other than a stack.

1 ................................................................................................................................................

2 ................................................................................................................................................
[2]

© UCLES 2021 9618/32/O/N/21 [Turn over


14

(d) The function StackFull() checks whether a stack is full.

The function uses the variable TopOfStack to represent the pointer to the most recent
position used on the stack, and the variable Max to represent the maximum size of the stack.
Assume TopOfStack and Max are global variables.

FUNCTION StackFull() RETURNS BOOLEAN


IF TopOfStack = Max THEN
RETURN TRUE
ELSE
RETURN FALSE
ENDIF
ENDFUNCTION

An algorithm AddInteger is required to add a new integer data element to a stack.

The stack is implemented as an array ArrayStack.

The function AddInteger() calls StackFull() and returns an appropriate message.

Complete the pseudocode for the function AddInteger().

FUNCTION AddInteger(NewInteger : INTEGER) RETURNS STRING

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

ENDFUNCTION
[5]

© UCLES 2021 9618/32/O/N/21


15

BLANK PAGE

© UCLES 2021 9618/32/O/N/21


16

BLANK PAGE

Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the
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
Cambridge Local Examinations Syndicate (UCLES), which itself is a department of the University of Cambridge.

© UCLES 2021 9618/32/O/N/21


Cambridge International AS & A Level
* 9 7 4 0 2 6 7 5 7 0 *

COMPUTER SCIENCE 9618/32


Paper 3 Advanced Theory October/November 2022

1 hour 30 minutes

You must answer on the question paper.

No additional materials are needed.

INSTRUCTIONS
● Answer all questions.
● Use a black or dark blue pen.
● Write your name, centre number and candidate number in the boxes at the top of the page.
● Write your answer to each question in the space provided.
● Do not use an erasable pen or correction fluid.
● Do not write on any bar codes.
● You may use an HB pencil for any diagrams, graphs or rough working.
● Calculators must not be used in this paper.

INFORMATION
● The total mark for this paper is 75.
● The number of marks for each question or part question is shown in brackets [ ].
● No marks will be awarded for using brand names of software packages or hardware.

This document has 12 pages. Any blank pages are indicated.

DC (RW/CGW) 302516/4
© UCLES 2022 [Turn over
2

1 Normalised floating-point numbers are stored in a computer system using two’s complement for
both the mantissa and the exponent with:

• 11 bits for the mantissa


• 5 bits for the exponent.

(a) Write the largest positive two’s complement binary number that can be stored in this system.

Mantissa Exponent

[1]

(b) Calculate the denary value of the given binary floating-point number.
Show your working.

Mantissa Exponent

1 0 1 1 0 0 1 0 0 1 1 0 1 0 0 1

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Answer ......................................................................................................................................
[3]

(c) State when underflow occurs in a binary floating-point system.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2022 9618/32/O/N/22


3

2 Lexical analysis and syntax analysis are stages in the compilation of a program.

(a) Identify two other stages that take place during the compilation of a program.

1 ................................................................................................................................................

...................................................................................................................................................

2 ................................................................................................................................................

...................................................................................................................................................
[2]

(b) Outline the purpose of syntax analysis.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

3 (a) Explain why a protocol is used in communication between computers.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) The TCP/IP protocol implementation can be viewed as a stack.

Complete the diagram for the TCP/IP protocol stack.

Transport

Link
[2]

(c) Describe the purpose of the IMAP protocol.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]
© UCLES 2022 9618/32/O/N/22 [Turn over
4

4 A program to manage regular flight details at an airport requires some user-defined data types.

(a) Write pseudocode statements to declare the enumerated data type Aircraft to hold data
about the types of aircraft used for a flight.

These types of aircraft are: C300, C350, D242, E757, X380.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Write pseudocode statements to declare the composite data type Flight to hold data about
flights to a specific destination. These include:

• flight number, which could be any combination of letters and numbers


• destination
• date of departure
• type of aircraft used.

Use the enumerated data type you created in part (a).

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

(c) (i) Write the pseudocode statement to set up a variable for one record of the composite
data type Flight.

...........................................................................................................................................

..................................................................................................................................... [1]

© UCLES 2022 9618/32/O/N/22


5

(ii) Write pseudocode to store the details of the following flight in the variable you set up in
part (c)(i).

Field Data
flight number XA782
destination Cambridge
date of departure 12/12/2022
type of aircraft used C350

Use the field names you created in part (b).

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [3]

5 Describe what is meant by a virtual machine.


Include in your answer two benefits and two drawbacks of using a virtual machine.

Description .......................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

Benefit 1 ...........................................................................................................................................

..........................................................................................................................................................

Benefit 2 ...........................................................................................................................................

..........................................................................................................................................................

Drawback 1 ......................................................................................................................................

..........................................................................................................................................................

Drawback 2 ......................................................................................................................................

..........................................................................................................................................................
[6]

© UCLES 2022 9618/32/O/N/22 [Turn over


6

6 (a) State two differences between symmetric and asymmetric encryption.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Explain the process by which an organisation may acquire its digital certificate.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

7 Supervised and unsupervised learning are two categories of machine learning.

Describe supervised learning and unsupervised learning.

Supervised learning .........................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

Unsupervised learning .....................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................
[4]

© UCLES 2022 9618/32/O/N/22


7

8 (a) Draw a logic circuit for an SR flip-flop and label the inputs.

.................

.................

[4]

(b) State the purpose of a flip-flop.

...................................................................................................................................................

............................................................................................................................................. [1]

(c) Simplify the following expression using Boolean algebra, including De Morgan’s laws.
Show your working.

(A.B).(A.C).(B.D)

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Answer ......................................................................................................................................
[3]

© UCLES 2022 9618/32/O/N/22 [Turn over


8

9 (a) Explain the need for scheduling in process management.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

(b) Describe these scheduling routines and identify a benefit for each one.

Shortest job first ........................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Round robin ..............................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

First come first served ..............................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[6]

© UCLES 2022 9618/32/O/N/22


9

10 (a) Define these Object-Oriented Programming (OOP) terms:

Encapsulation ...........................................................................................................................

...................................................................................................................................................

Getter ........................................................................................................................................

...................................................................................................................................................

Setter ........................................................................................................................................

...................................................................................................................................................
[3]

(b) A school has a program written using OOP to maintain its staff and student records.

The object SubstituteTeacher allows the details of the school’s substitute teachers to be
stored. This includes their full name, telephone number and whether or not they are in school
today. For example:

SubName Sarah Jones


Telephone 01223658721
InSchool TRUE

Complete the diagram for the object SubstituteTeacher, including appropriate properties
and their getters and setters.

SubstituteTeacher
SubName : STRING

....................................................................................................

InSchool : BOOLEAN

....................................................................................................

SetTelephone(Tel : STRING)

....................................................................................................

GetSubName()

....................................................................................................

....................................................................................................

[3]

© UCLES 2022 9618/32/O/N/22 [Turn over


10

11 A simplified linked list is used to store the names of flowers in alphabetical order. It is implemented
using two 1D arrays:

• Flower stores the names of the flowers.


• NextPointer stores the pointer to the next flower name in the list.

HeadPointer indicates the index of the first flower name in the linked list.

HeadPointer 6

When the end of the linked list is reached, the next pointer has the value of 0.

The following table shows the initial content of the arrays.

Index Flower NextPointer


1 Rose 7
2 Marigold 1
3 Foxglove 10
4 Iris 9
5 Daisy 3
6 Dahlia 5
7 Saxifrage 0
8 Lupin 2
9 Lily 8
10 Hydrangea 4

(a) Several flower names have been deleted from the linked list. These are crossed out in the
following table.

Complete the table to show the new values of HeadPointer and NextPointer to keep the
remaining flower names in alphabetical order.

HeadPointer

Index Flower NextPointer


1 Rose
2 Marigold
3 Foxglove
4 Iris
5 Daisy
6 Dahlia
7 Saxifrage
8 Lupin
9 Lily
10 Hydrangea
[3]
© UCLES 2022 9618/32/O/N/22
11

(b) Complete the pseudocode algorithm so that it achieves the following when applied to the
arrays:

• The flower name is input.


• The linked list is searched, in order, for the flower name.
• If the flower name is found, an appropriate message is output to indicate it has been
found.
• If the flower name is not found, an appropriate message is output to indicate it has not
been found.
• The algorithm terminates when the next pointer value is 0.

Pointer HeadPointer
Found 0
OUTPUT "Enter a flower name "

………………………………………………………………….

………………………………………………………………….
IF Flower[Pointer] = FlowerName THEN
Found Pointer
Pointer 0
ELSE

………………………………………………………………….
ENDIF
ENDWHILE

………………………………………………………………….
OUTPUT Flower[Found], " is found"
ELSE

………………………………………………………………….
ENDIF
[5]

(c) Explain how you could improve the simplified linked list structure.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2022 9618/32/O/N/22


12

BLANK PAGE

Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the
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 Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge
Local Examinations Syndicate (UCLES), which is a department of the University of Cambridge.

© UCLES 2022 9618/32/O/N/22


Cambridge International AS & A Level
* 8 9 8 2 6 9 4 8 9 0 *

COMPUTER SCIENCE 9618/32


Paper 3 Advanced Theory May/June 2023

1 hour 30 minutes

You must answer on the question paper.

No additional materials are needed.

INSTRUCTIONS
● Answer all questions.
● Use a black or dark blue pen.
● Write your name, centre number and candidate number in the boxes at the top of the page.
● Write your answer to each question in the space provided.
● Do not use an erasable pen or correction fluid.
● Do not write on any bar codes.
● You may use an HB pencil for any diagrams, graphs or rough working.
● Calculators must not be used in this paper.

INFORMATION
● The total mark for this paper is 75.
● The number of marks for each question or part question is shown in brackets [ ].
● No marks will be awarded for using brand names of software packages or hardware.

This document has 16 pages. Any blank pages are indicated.

DC (RW/FC) 313065/3
© UCLES 2023 [Turn over
2

1 Numbers are stored in a computer using floating point representation with:

• 10 bits for the mantissa


• 6 bits for the exponent
• two’s complement form for both the mantissa and exponent.

(a) Write the normalised floating‑point representation of the following binary number using this
system:

0101010.111
Show your working.

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Mantissa Exponent

[2]

(b) Describe the reason why the normalised form of the following binary number cannot be
represented accurately using this system.

0101011.111001
...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

© UCLES 2023 9618/32/M/J/23


3

2 (a) Describe how records are organised and accessed in a sequential file.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

(b) A hashing algorithm is used to calculate storage locations for records in a random access file.
The algorithm calculates hash values using the function modulus 5.

The function modulus gives the remainder after integer division.


For example, 3003 modulus 5 = 3, so the record key 3003 gives a hash value of 3.

Complete the table to show the remaining hash values.

Record key Hash value

3003 3

1029

7630
[2]

© UCLES 2023 9618/32/M/J/23 [Turn over


4

3 Several syntax diagrams are shown.

digit letter
0 A

1 C

2 E

3 G

4 I

5 K

6 M

7 O

8 Q

9 S

Y
variable
letter digit

© UCLES 2023 9618/32/M/J/23


5

(a) State whether each variable is valid or invalid and give a reason for your choice in each case.

9SW ...........................................................................................................................................

Reason .....................................................................................................................................

...................................................................................................................................................

UWY ...........................................................................................................................................

Reason .....................................................................................................................................

...................................................................................................................................................
[2]

(b) <word> contains one or more letters.

Complete the Backus‑Naur Form (BNF) for <word> and use this to complete the BNF for
<variable>.

<word> ::= ............................................................................................................................

...................................................................................................................................................

<variable> ::= ...................................................................................................................

...................................................................................................................................................
[3]

(c) Vehicle registrations must begin with two letters and be followed by one, two or three digits.

Valid letters and digits are shown in the syntax diagrams on page 4.

(i) State an example of a valid vehicle registration.

...........................................................................................................................................

..................................................................................................................................... [1]

(ii) Draw a syntax diagram for a vehicle registration.

[3]

© UCLES 2023 9618/32/M/J/23 [Turn over


6

4 Draw one line from each Object‑Oriented Programming (OOP) term to its most appropriate
description.

OOP term Description

methods used to return the value of


a property
Encapsulation

the process of putting data and


methods together as a single unit
Getters
methods used to update the value of
a property
Polymorphism
allows methods to be redefined for
derived classes

Setters
enables the defining of a new class
that inherits from a parent class

[4]

5 (a) Encryption is used to scramble data to make it meaningless if intercepted.

Describe the purpose of quantum cryptography.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Explain the differences between symmetric and asymmetric cryptography when encrypting
and decrypting data.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

© UCLES 2023 9618/32/M/J/23


7

6 (a) Write pseudocode statements to declare the composite data type, TAppointments, to hold
data about patients for a dental clinic. It will include for each patient:

• name (first name and last name)


• date of birth
• telephone number
• date of last appointment
• date of next appointment
• all treatments are complete (yes or no).

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

(b) This pseudocode algorithm reads dental records stored in a random file using the user‑defined
data type TAppointments and prints the contents of the file, one record at a time.

Complete this file handling pseudocode:

DECLARE DentalRecord : ARRAY[1:250] OF TAppointments


DECLARE DentalFile : STRING
DECLARE Count : INTEGER
DentalFile "DentalFile.dat"
OUTPUT "The file ", DentalFile, " contains these records:"

OPENFILE .................................................................................................................

.......................................................................................... 1

REPEAT
SEEK DentalFile, Count

.....................................................................................................................
OUTPUT DentalRecord[Count]
Count Count + 1

.....................................................................(DentalFile)

.............................................................................................
[5]

© UCLES 2023 9618/32/M/J/23 [Turn over


8

7 (a) State two examples of where it would be appropriate to use packet switching.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Give four differences between circuit switching and packet switching.

1 ................................................................................................................................................

...................................................................................................................................................

2 ................................................................................................................................................

...................................................................................................................................................

3 ................................................................................................................................................

...................................................................................................................................................

4 ................................................................................................................................................

...................................................................................................................................................
[4]

© UCLES 2023 9618/32/M/J/23


9

8 (a) Describe the use of pipelining in Reduced Instruction Set Computers (RISC).

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) The processing of instructions is divided into five stages:

• instruction fetch (IF)


• instruction decode (ID)
• operand fetch (OF)
• instruction execute (IE)
• write back result (WB)

Each stage is carried out using a different register when pipelining is used.

Complete the table to show how a program consisting of six instructions would be completed
using pipelining.

Clock cycles

1 2 3 4 5 6 7 8 9 10 11 12

IF
Processor stages

ID

OF

IE

WB
[4]

© UCLES 2023 9618/32/M/J/23 [Turn over


10

9 This truth table represents a logic circuit.

INPUT OUTPUT

A B C D Z

0 0 0 0 1

0 0 0 1 1

0 0 1 0 1

0 0 1 1 1

0 1 0 0 0

0 1 0 1 0

0 1 1 0 1

0 1 1 1 1

1 0 0 0 0

1 0 0 1 0

1 0 1 0 0

1 0 1 1 0

1 1 0 0 0

1 1 0 1 0

1 1 1 0 0

1 1 1 1 0

(a) Write the Boolean logic expression that corresponds to the given truth table as the
sum‑of‑products.

Z = ............................................................................................................................................

............................................................................................................................................. [3]

© UCLES 2023 9618/32/M/J/23


11

(b) Complete the Karnaugh map (K‑map) for the given truth table.

AB
CD 00 01 11 10

00

01

11

10

[2]

(c) Draw loop(s) around appropriate group(s) in the K‑map to produce an optimal sum‑of‑products.
[2]

(d) Write the Boolean logic expression from your answer to part (c) as a simplified
sum‑of‑products.

Z = ............................................................................................................................................

............................................................................................................................................. [2]

(e) Use Boolean algebra to give your answer to part (d) in its simplest form.

Z = ...................................................................................................................................... [1]

10 (a) State one category of machine learning.

............................................................................................................................................. [1]

© UCLES 2023 9618/32/M/J/23 [Turn over


12

(b) Calculate the path that takes the shortest time to travel from the Begin node to the End node,
using the A* algorithm.
Show your working in the table provided.

The first two rows have already been completed.

12

g=5 Begin
h=8 4 11
A 5
D
6 7
7 C
6 B
8 6
2
8 7
E

5
7 G
End

7 1
4

1 F

Cost from
Destination Heuristic Total
Start node start node
node (h) (f = g + h)
(g)
Begin Begin 0 12 12

Begin A 5 8 13

Final path
[5]
© UCLES 2023 9618/32/M/J/23
13

11 (a) The pseudocode shown represents a queue Abstract Data Type (ADT) with procedures for
initialisation and to add new items. It is incomplete.

CONSTANT MaxLength = 50
DECLARE FrontPointer : INTEGER
DECLARE RearPointer : INTEGER
DECLARE Length : INTEGER
DECLARE Queue : ARRAY[0 : MaxLength – 1] OF STRING

// initialisation of queue
PROCEDURE Initialise
FrontPointer ‑1

.....................................................................................................................

................................................................. 0
ENDPROCEDURE

// adding a new item to the queue


PROCEDURE Enqueue(NewItem : STRING)

IF ............................................................................................. THEN

RearPointer ..................................................................................
IF RearPointer > MaxLength – 1 THEN
RearPointer 0
ENDIF

................................................................................................................
Length Length + 1
ENDIF
ENDPROCEDURE

(i) Study the pseudocode and insert the identifiers to complete this table.

Identifier Data type Description

STRING An array to store the contents of the queue.

INTEGER Points to the last item of the queue.

INTEGER Indicates the number of items in the queue.

INTEGER Points to the first item of the queue.


[2]

(ii) Complete the given pseudocode. [5]

© UCLES 2023 9618/32/M/J/23 [Turn over


14

(b) Explain the reasons why a queue ADT works better than a stack ADT in organising print jobs.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

© UCLES 2023 9618/32/M/J/23


15

BLANK PAGE

© UCLES 2023 9618/32/M/J/23


16

BLANK PAGE

Permission to reproduce items where third‑party owned material protected by copyright is included has been sought and cleared where possible. Every
reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the
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 Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge
Local Examinations Syndicate (UCLES), which is a department of the University of Cambridge.

© UCLES 2023 9618/32/M/J/23


Cambridge International AS & A Level
* 5 5 6 9 4 6 3 9 9 4 *

COMPUTER SCIENCE 9618/32


Paper 3 Advanced Theory October/November 2023

1 hour 30 minutes

You must answer on the question paper.

No additional materials are needed.

INSTRUCTIONS
● Answer all questions.
● Use a black or dark blue pen.
● Write your name, centre number and candidate number in the boxes at the top of the page.
● Write your answer to each question in the space provided.
● Do not use an erasable pen or correction fluid.
● Do not write on any bar codes.
● You may use an HB pencil for any diagrams, graphs or rough working.
● Calculators must not be used in this paper.

INFORMATION
● The total mark for this paper is 75.
● The number of marks for each question or part question is shown in brackets [ ].
● No marks will be awarded for using brand names of software packages or hardware.

This document has 16 pages. Any blank pages are indicated.

DC (EF/CT) 318340/2
© UCLES 2023 [Turn over
2

1 (a) Real numbers are stored in a computer using floating point representation with:

• 10 bits for the mantissa


• 6 bits for the exponent
• two’s complement form for both the mantissa and the exponent.

Write the normalised floating‑point representation of –96.75 in this system.

Show your working.

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]

(b) Explain why a binary representation is sometimes only an approximation to the real number it
represents.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

© UCLES 2023 9618/32/O/N/23


3

2 Describe what is meant by composite and non‑composite data types.

Composite ........................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

Non‑composite .................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................
[4]

3 The location of a record in a random file is determined using a hashing algorithm.

A collision may occur during the process of adding a record.

(a) Outline what is meant by the term collision in this context.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Explain how a collision can be dealt with when writing records to a random file.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

© UCLES 2023 9618/32/O/N/23 [Turn over


4

4 Complete the following paragraph about a protocol suite, using words from the given list.

Some words are not used.

BitTorrent circuit switching layered link list

peer‑to‑peer queue stack star TCP/IP

The protocols in a ............................................................................. determine the interconnectivity

rules for a ............................................................................. network model such as the

............................................................................. model.
[3]

5 (a) Outline the reasons why an operating system may need to use virtual memory.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Explain the circumstances in which disk thrashing could occur.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

© UCLES 2023 9618/32/O/N/23


5

6 (a) The Reverse Polish Notation (RPN) expression:

a b * 2 / c d / *

is to be evaluated where a = 20, b = 3, c = 10 and d = 5.

Show the changing contents of the following stack as the RPN expression is evaluated.

[4]

(b) Explain how an expression stored in RPN can be evaluated.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

© UCLES 2023 9618/32/O/N/23 [Turn over


6

7 (a) This logic circuit represents the Boolean expression: X = A + B + C

B X

Complete this truth table for the given logic circuit.

A B C X

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

[1]

(b) Apply De Morgan’s laws to the expression: X = A + B + C

X = ...................................................................................................................................... [1]

(c) Simplify the following expression using Boolean algebra.

Show all the stages in your simplification.

T = X.Y.Z + X.Y.Z + X

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

© UCLES 2023 9618/32/O/N/23


7

8 Calculate the shortest distance between the Start and each of the destinations in the diagram
using Dijkstra’s algorithm.

Show your working and write your answers in the table provided.

4 8
A B
C

2
3

8 9

D
2

Start 10
F

Working ............................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

Answers:

A B C D E F

[5]

© UCLES 2023 9618/32/O/N/23 [Turn over


8

9 (a) A stack Abstract Data Type (ADT) is to be implemented using pseudocode, with procedures
to initialise it and to push new items onto the stack.

A 1D array Stack stores the contents of the stack.

(i) Study the pseudocode in part (a)(ii) and complete the table of identifiers by writing the
missing data types and descriptions.

Identifier Data type Description

BasePointer

TopPointer

Stack REAL

[2]

(ii) Complete the pseudocode.

CONSTANT MaxSize = 40
DECLARE BasePointer : INTEGER
DECLARE TopPointer : INTEGER
DECLARE Stack : ARRAY[1:40] OF REAL

// initialisation of stack
PROCEDURE Initialise()

................................................................................ 1

................................................................................ 0
ENDPROCEDURE

// push an item onto the stack


PROCEDURE Push(NewItem : REAL)

................................................................................ MaxSize THEN

..........................................................................................................

Stack[TopPointer] .............................................................
ENDIF
ENDPROCEDURE
[5]

© UCLES 2023 9618/32/O/N/23


9

(b) Justify the use of a linked list instead of an array to implement a stack.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(c) Explain how a compiler makes use of a stack when translating recursive programming code.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

10 Describe the features of the SIMD and MISD computer architectures.

SIMD ................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

MISD ................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................
[4]

© UCLES 2023 9618/32/O/N/23 [Turn over


10

11 A declarative programming language is used to represent some facts about people and their
hobbies.

01 hobby(music).
02 hobby(caving).
03 hobby(climbing).
04 hobby(camping).
05 hobby(baking).
06 hobby(travelling).
07 person(toby).
08 person(natasha).
09 person(fatima).
10 person(joseph).
11 person(elijah).
12 person(nina).
13 enjoys(natasha, travelling).
14 enjoys(toby, climbing).
15 enjoys(nina, climbing).
16 enjoys(elijah, camping).
17 enjoys(fatima, baking).
18 enjoys(joseph, camping).
19 dislikes(toby, caving).

These clauses have the meanings:

Clause Meaning
01 Music is a hobby
07 Toby is a person
13 Natasha enjoys travelling
19 Toby dislikes caving

(a) Carlos is a person who enjoys the hobby of cycling but does not like music.

Write additional clauses to represent this information.

20 ............................................................................................................................................

21 ............................................................................................................................................

22 ............................................................................................................................................

23 ............................................................................................................................................
[4]

© UCLES 2023 9618/32/O/N/23


11

(b) Using the variable P, the goal:

enjoys(P, camping)

returns

P = elijah, joseph

Write the result returned by the goal:

enjoys(P, climbing)

P = .................................................................................................................................... [1]

(c) N is a person who might enjoy H if H is a hobby and N does not dislike H.

Write this as a rule.

might_enjoy(N, H)

IF ............................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

12 (a) Describe, with an example, what is meant by an exception.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2023 9618/32/O/N/23 [Turn over


12

(b) A pseudocode algorithm searches for a customer record in a random file


AccountRecord.dat. A user inputs the name of the customer.

The records are stored using the user‑defined data type TAccount.

TYPE TAccount
DECLARE AccountNumber : INTEGER
DECLARE Name : STRING
DECLARE Address : STRING
DECLARE Telephone : STRING
ENDTYPE

If the record is found, it is output, otherwise an error message is displayed.

Complete the file handling pseudocode.

DECLARE Customer : TAccount


DECLARE Location : INTEGER
DECLARE MaxSize : INTEGER
DECLARE FoundFlag : BOOLEAN
DECLARE SearchCustomer : STRING
MaxSize 1000

OPENFILE ...............................................................................................................
Location 1

............................................................................................................... FALSE
OUTPUT "Enter the customer’s name"

...............................................................................................................

................................................................................... AND Location <= MaxSize

................................... "AccountRecord.dat", ............................................


GETRECORD "AccountRecord.dat", Customer
IF SearchCustomer = Customer.Name THEN
OUTPUT "Customer found: "
OUTPUT Customer // output customer record
FoundFlag TRUE
ENDIF
Location Location + 1
ENDWHILE
IF NOT FoundFlag THEN

OUTPUT ".........................................................................................................."
ENDIF
[7]
© UCLES 2023 9618/32/O/N/23
13

BLANK PAGE

© UCLES 2023 9618/32/O/N/23


14

BLANK PAGE

© UCLES 2023 9618/32/O/N/23


15

BLANK PAGE

© UCLES 2023 9618/32/O/N/23


16

BLANK PAGE

Permission to reproduce items where third‑party owned material protected by copyright is included has been sought and cleared where possible. Every
reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the
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 Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge
Local Examinations Syndicate (UCLES), which is a department of the University of Cambridge.

© UCLES 2023 9618/32/O/N/23


Cambridge International AS & A Level
* 4 0 8 1 7 6 1 7 1 4 *

COMPUTER SCIENCE 9618/33


Paper 3 Advanced Theory May/June 2021

1 hour 30 minutes

You must answer on the question paper.

No additional materials are needed.

INSTRUCTIONS
● Answer all questions.
● Use a black or dark blue pen.
● Write your name, centre number and candidate number in the boxes at the top of the page.
● Write your answer to each question in the space provided.
● Do not use an erasable pen or correction fluid.
● Do not write on any bar codes.
● You may use an HB pencil for any diagrams, graphs or rough working.
● Calculators must not be used in this paper.

INFORMATION
● The total mark for this paper is 75.
● The number of marks for each question or part question is shown in brackets [ ].
● No marks will be awarded for using brand names of software packages or hardware.

This document has 12 pages.

DC (LO) 213987
© UCLES 2021 [Turn over
2

1 Real numbers are stored in a computer system using floating-point representation with:

• 10 bits for the mantissa


• 6 bits for the exponent
• Two’s complement form for both the mantissa and the exponent.

(a) Calculate the normalised floating-point representation of –7.25 in this system.


Show your working.

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]

(b) Calculate the denary value of the given binary floating-point number.
Show your working.

Mantissa Exponent

1 0 1 1 0 0 0 1 1 1 0 0 0 1 1 1

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Answer ......................................................................................................................................
[3]

© UCLES 2021 9618/33/M/J/21


3

(c) The given binary floating-point number is not normalised.

Normalise the floating-point number. Show your working.

Mantissa Exponent

0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]

(d) The denary number 513 cannot be stored accurately as a normalised floating-point number in
this computer system.

(i) Explain the reason for this.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [3]

(ii) Describe an alteration to the way floating-point numbers are stored to enable this number
to be stored accurately using the same total number of bits.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [2]

© UCLES 2021 9618/33/M/J/21 [Turn over


4

2 (a) Describe the purpose of a user-defined data type.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Define, using pseudocode, the following enumerated data types:

(i) SchoolDay to hold data about the days students are usually in school.

...........................................................................................................................................

..................................................................................................................................... [1]

(ii) WeekEnd to hold data about the days that are not school days.

...........................................................................................................................................

..................................................................................................................................... [1]

(c) Define, using pseudocode, the composite data type ClubMeet. This will hold data about club
members that includes:

• first name and last name


• the two days they attend:
○ one on a school day
○ one not on a school day.

Use the enumerated types you created in part (b).

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

© UCLES 2021 9618/33/M/J/21


5

3 (a) Draw one line to connect each Operating System (OS) term to the most appropriate
description about it.

OS term Description

Using secondary storage to simulate


additional main memory
Multi-tasking

Managing the processes running on


the CPU
Paging

Managing the execution of many programs


that appear to run at the same time

Interrupt handling

Locating non-contiguous blocks of data and


relocating them

Scheduling
Transferring control to another routine when
a service is required

Virtual memory
Reading/writing same-size blocks of data
from/to secondary storage when required

[5]

(b) Explain how an interpreter executes a program without producing a complete translated
version of it.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

© UCLES 2021 9618/33/M/J/21 [Turn over


6

4 (a) (i) Explain why Reverse Polish Notation (RPN) is used to carry out the evaluation of
expressions.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [2]

(ii) Identify, with reasons, a data structure that could be used to evaluate an expression
in RPN.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [2]

(b) Write the infix expression in RPN.

(a – b) * (a + c) / 7

...................................................................................................................................................

............................................................................................................................................. [1]

(c) Write the RPN expression as an infix expression.

a b / 4 * a b + -

...................................................................................................................................................

............................................................................................................................................. [1]

(d) Evaluate the RPN expression:

a b + c d / /

where a = 17, b = 3, c = 48 and d = 12.

Show your working.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2021 9618/33/M/J/21


7

5 (a) Calculate the shortest distance between the base and each of the other towns in the diagram
using Dijkstra’s algorithm.

Show your working and write your answers in the table provided.

Base
4
5

Town 1 2
1 Town 2
8

Town 3

7 3 Town 6
1

5
6
Town 4 Town 5

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Answers

Town 1 Town 2 Town 3 Town 4 Town 5 Town 6

[5]

© UCLES 2021 9618/33/M/J/21 [Turn over


8

(b) Explain the use of graphs to aid Artificial Intelligence (AI).

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

6 Give two benefits and two drawbacks of packet switching.

Benefit 1 ...........................................................................................................................................

..........................................................................................................................................................

Benefit 2 ...........................................................................................................................................

..........................................................................................................................................................

Drawback 1 ......................................................................................................................................

..........................................................................................................................................................

Drawback 2 ......................................................................................................................................

..........................................................................................................................................................
[4]

© UCLES 2021 9618/33/M/J/21


9

7 The diagram shows a logic circuit.

A P
Y
B

C R

Z
Q

(a) Complete the truth table for the given logic circuit. Show your working.

Inputs Working space Outputs


A B C P Q R Y Z
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
[3]
(b) State the name of the logic circuit.

............................................................................................................................................. [1]

(c) Write the Boolean expressions for the two outputs Y and Z in the truth table as
sum-of-products and state the purpose of each output.

Y = ............................................................................................................................................

Purpose ....................................................................................................................................

Z = ............................................................................................................................................

Purpose ....................................................................................................................................
[4]

© UCLES 2021 9618/33/M/J/21 [Turn over


10

8 (a) State two factors that may affect the performance of a sorting algorithm.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) The given algorithm is a simple bubble sort that arranges a set of scores stored in a one-
dimensional array into descending order, and orders the corresponding students’ names
stored into a two-dimensional array in the same order as the scores. All the arrays are indexed
from 1.

The contents of both arrays after sorting are shown.

Name
Score
1 2
1 98 1 Smithfield Tom
2 97 2 Johnson Jane

… …

248 5 248 Peters Jade


249 3 249 Allen John

YearSize 249 ←
Flag ←
TRUE
WHILE Flag = TRUE
Flag FALSE←
FOR Student ←
1 TO YearSize - 1
IF Score[Student] < Score[Student + 1] THEN
Temp1 ←
Score[Student]
Temp2 ←
Name[Student,1]
Temp3 ←
Name[Student,2]
Score[Student] Score[Student + 1] ←
Name[Student,1] Name[Student + 1,1] ←
Name[Student,2] Name[Student + 1,2] ←
Score[Student + 1] Temp1 ←
Name[Student + 1,1] Temp2 ←
Name[Student + 1,2] Temp3 ←
Flag TRUE ←
ENDIF
NEXT Student
ENDWHILE

© UCLES 2021 9618/33/M/J/21


11

Write an algorithm, using pseudocode, that will perform the same task using an insertion sort.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [6]

© UCLES 2021 9618/33/M/J/21 [Turn over


12

9 (a) Describe what is meant by an imperative (procedural) programming language.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Describe what is meant by a declarative programming language.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(c) Identify the programming paradigm for each of these program code examples.

Program code example Programming paradigm


male(john).
female(ethel).
parent(john, ethel).
FOR Counter = 1 TO 20
X = X * Counter
NEXT Counter
Start: LDD Counter
INC ACC
STO Counter
public class Vehicle
{
private speed;
public Vehicle()
{
speed = 0;
}
}
[4]

Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the
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
Cambridge Local Examinations Syndicate (UCLES), which itself is a department of the University of Cambridge.

© UCLES 2021 9618/33/M/J/21


Cambridge International AS & A Level
* 6 2 5 8 7 8 7 9 8 3 *

COMPUTER SCIENCE 9618/31


Paper 3 Advanced Theory October/November 2021

1 hour 30 minutes

You must answer on the question paper.

No additional materials are needed.

INSTRUCTIONS
● Answer all questions.
● Use a black or dark blue pen.
● Write your name, centre number and candidate number in the boxes at the top of the page.
● Write your answer to each question in the space provided.
● Do not use an erasable pen or correction fluid.
● Do not write on any bar codes.
● You may use an HB pencil for any diagrams, graphs or rough working.
● Calculators must not be used in this paper.

INFORMATION
● The total mark for this paper is 75.
● The number of marks for each question or part question is shown in brackets [ ].
● No marks will be awarded for using brand names of software packages or hardware.

This document has 16 pages. Any blank pages are indicated.

DC (SLM) 220617
© UCLES 2021 [Turn over
2

1 (a) Numbers are stored in a computer using floating-point representation with:

• 12 bits for the mantissa


• 4 bits for the exponent
• two’s complement form for both the mantissa and exponent.

(i) Write the normalised floating-point representation of the following unsigned binary
number using this system.

1011100.011001
Working .............................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

Mantissa Exponent

[2]

(ii) State the consequence of storing the binary number in part (a)(i) as a floating-point
number in this system. Justify your answer.

Consequence ....................................................................................................................

...........................................................................................................................................

Justification .......................................................................................................................

...........................................................................................................................................

...........................................................................................................................................
[2]

(b) Explain the reason why binary numbers are stored in normalised form.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]
© UCLES 2021 9618/31/O/N/21
3

2 Draw one line from each programming paradigm to its most appropriate description.

Programming paradigm Description

Programs using the instruction set of a


processor

Declarative
Programs based on events such as user
actions or sensor outputs

Imperative
Programs using the concepts of class,
inheritance, encapsulation and
polymorphism
Low-level

Programs with an explicit sequence of


commands that update the program state,
Object-oriented with or without procedure calls

Programs that specify the desired result


rather than how to get to it

[4]

3 Enumerated and pointer are two non-composite data types.

(a) Write pseudocode to create an enumerated type called Parts to include these parts sold in
a computer shop:

Monitor, CPU, SSD, HDD, LaserPrinter, Keyboard, Mouse

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Write pseudocode to create a pointer type called SelectParts that will reference the
memory location in which the current part name is stored.

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2021 9618/31/O/N/21 [Turn over


4

4 The following syntax diagrams for a particular programming language show the syntax of:

• a digit
• a capital letter
• a character.

digit capital letter


0 A

1 E

2 I

3 O

4 U

5 character
$

6
%

7
&

8
*

9
#

(a) Write the Backus-Naur Form (BNF) notation of the syntax diagram for character.

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2021 9618/31/O/N/21


5

(b) A password must begin with a character and be followed by one or more digits or capital
letters.

(i) State an example of a valid password.

..................................................................................................................................... [1]

(ii) A valid password is represented by the syntax diagram:

password
character digit

capital letter

Write the BNF notation of the syntax diagram for password.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [4]

© UCLES 2021 9618/31/O/N/21 [Turn over


6

5 (a) Compare sequential and serial methods of file organisation.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

(b) State the most suitable method of file access when a record is referenced by a unique
address on a disk-type storage medium.

............................................................................................................................................. [1]

(c) State the most suitable method of file access when a bank stores its data records in ascending
order of account number.

............................................................................................................................................. [1]

© UCLES 2021 9618/31/O/N/21


7

6 (a) Explain how packet switching is used to transfer messages across the internet.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [5]

(b) Outline the function of a router in packet switching.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

© UCLES 2021 9618/31/O/N/21 [Turn over


8

7 (a) Write the Boolean expression that corresponds to the given truth table as a sum-of-products.

INPUT OUTPUT

A B C D Z

0 0 0 0 0

0 0 0 1 0

0 0 1 0 0

0 0 1 1 0

0 1 0 0 0

0 1 0 1 0

0 1 1 0 0

0 1 1 1 0

1 0 0 0 0

1 0 0 1 1

1 0 1 0 0

1 0 1 1 1

1 1 0 0 1

1 1 0 1 1

1 1 1 0 1

1 1 1 1 1

Z = ............................................................................................................................................

............................................................................................................................................. [3]

© UCLES 2021 9618/31/O/N/21


9

(b) (i) Complete the Karnaugh map (K-map) for the given truth table.

AB

CD 00 01 11 10

00

01

11

10

[2]

(ii) Draw loop(s) around appropriate group(s) of 1s in the K-map to produce an optimal
sum-of-products. [2]

(iii) Write the Boolean expression from your answer to part b(ii) as a simplified
sum-of-products.

Z = .....................................................................................................................................

..................................................................................................................................... [2]

(iv) Write the simplified Boolean expression for your answer to part b(iii).

Z = .....................................................................................................................................

..................................................................................................................................... [1]

© UCLES 2021 9618/31/O/N/21 [Turn over


10

8 (a) Describe the purpose of the Secure Sockets Layer (SSL) and Transport Layer Security (TLS)
protocols.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Explain how SSL/TLS protocols are used when a client-server communication is initiated.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

© UCLES 2021 9618/31/O/N/21


11

9 (a) The diagram shown represents an artificial neural network.

Output
Layer
Input
Layer
Hidden Hidden
Layer 1 Hidden Layer 3
Layer 2

(i) State the reason for having multiple hidden layers in an artificial neural network.

...........................................................................................................................................

..................................................................................................................................... [1]

(ii) Explain how artificial neural networks enable machine learning.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [4]

© UCLES 2021 9618/31/O/N/21 [Turn over


12

(b) Find the shortest path between the Home and School nodes using the A* algorithm.
Show your working in the table provided.

The first two rows in the table have been completed.

14

h = 10 Home 9
g=1 4
A 5 C
3
7
B 6
2
6
D 6
3
7
F
1
2
3
E
3 5
School

Node Cost from Home node (g) Heuristic (h) Total (f = g + h)

Home 0 14 14

A 1 10 11

Final path
[5]

© UCLES 2021 9618/31/O/N/21


13

10 (a) State three essential features of recursion.

1 ................................................................................................................................................

...................................................................................................................................................

2 ................................................................................................................................................

...................................................................................................................................................

3 ................................................................................................................................................

...................................................................................................................................................
[3]

(b) Explain the reasons why a stack is a suitable Abstract Data Type (ADT) to implement
recursion.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

(c) Identify two ADTs other than a stack.

1 ................................................................................................................................................

2 ................................................................................................................................................
[2]

© UCLES 2021 9618/31/O/N/21 [Turn over


14

(d) The function StackFull() checks whether a stack is full.

The function uses the variable TopOfStack to represent the pointer to the most recent
position used on the stack, and the variable Max to represent the maximum size of the stack.
Assume TopOfStack and Max are global variables.

FUNCTION StackFull() RETURNS BOOLEAN


IF TopOfStack = Max THEN
RETURN TRUE
ELSE
RETURN FALSE
ENDIF
ENDFUNCTION

An algorithm AddInteger is required to add a new integer data element to a stack.

The stack is implemented as an array ArrayStack.

The function AddInteger() calls StackFull() and returns an appropriate message.

Complete the pseudocode for the function AddInteger().

FUNCTION AddInteger(NewInteger : INTEGER) RETURNS STRING

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

ENDFUNCTION
[5]

© UCLES 2021 9618/31/O/N/21


15

BLANK PAGE

© UCLES 2021 9618/31/O/N/21


16

BLANK PAGE

Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the
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
Cambridge Local Examinations Syndicate (UCLES), which itself is a department of the University of Cambridge.

© UCLES 2021 9618/31/O/N/21


Cambridge International AS & A Level
* 2 5 7 9 4 4 0 8 6 9 *

COMPUTER SCIENCE 9618/31


Paper 3 Advanced Theory May/June 2021

1 hour 30 minutes

You must answer on the question paper.

No additional materials are needed.

INSTRUCTIONS
● Answer all questions.
● Use a black or dark blue pen.
● Write your name, centre number and candidate number in the boxes at the top of the page.
● Write your answer to each question in the space provided.
● Do not use an erasable pen or correction fluid.
● Do not write on any bar codes.
● You may use an HB pencil for any diagrams, graphs or rough working.
● Calculators must not be used in this paper.

INFORMATION
● The total mark for this paper is 75.
● The number of marks for each question or part question is shown in brackets [ ].
● No marks will be awarded for using brand names of software packages or hardware.

This document has 12 pages.

DC (LO) 213986
© UCLES 2021 [Turn over
2

1 Real numbers are stored in a computer system using floating-point representation with:

• 10 bits for the mantissa


• 6 bits for the exponent
• Two’s complement form for both the mantissa and the exponent.

(a) Calculate the normalised floating-point representation of –7.25 in this system.


Show your working.

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]

(b) Calculate the denary value of the given binary floating-point number.
Show your working.

Mantissa Exponent

1 0 1 1 0 0 0 1 1 1 0 0 0 1 1 1

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Answer ......................................................................................................................................
[3]

© UCLES 2021 9618/31/M/J/21


3

(c) The given binary floating-point number is not normalised.

Normalise the floating-point number. Show your working.

Mantissa Exponent

0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]

(d) The denary number 513 cannot be stored accurately as a normalised floating-point number in
this computer system.

(i) Explain the reason for this.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [3]

(ii) Describe an alteration to the way floating-point numbers are stored to enable this number
to be stored accurately using the same total number of bits.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [2]

© UCLES 2021 9618/31/M/J/21 [Turn over


4

2 (a) Describe the purpose of a user-defined data type.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Define, using pseudocode, the following enumerated data types:

(i) SchoolDay to hold data about the days students are usually in school.

...........................................................................................................................................

..................................................................................................................................... [1]

(ii) WeekEnd to hold data about the days that are not school days.

...........................................................................................................................................

..................................................................................................................................... [1]

(c) Define, using pseudocode, the composite data type ClubMeet. This will hold data about club
members that includes:

• first name and last name


• the two days they attend:
○ one on a school day
○ one not on a school day.

Use the enumerated types you created in part (b).

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

© UCLES 2021 9618/31/M/J/21


5

3 (a) Draw one line to connect each Operating System (OS) term to the most appropriate
description about it.

OS term Description

Using secondary storage to simulate


additional main memory
Multi-tasking

Managing the processes running on


the CPU
Paging

Managing the execution of many programs


that appear to run at the same time

Interrupt handling

Locating non-contiguous blocks of data and


relocating them

Scheduling
Transferring control to another routine when
a service is required

Virtual memory
Reading/writing same-size blocks of data
from/to secondary storage when required

[5]

(b) Explain how an interpreter executes a program without producing a complete translated
version of it.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

© UCLES 2021 9618/31/M/J/21 [Turn over


6

4 (a) (i) Explain why Reverse Polish Notation (RPN) is used to carry out the evaluation of
expressions.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [2]

(ii) Identify, with reasons, a data structure that could be used to evaluate an expression
in RPN.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [2]

(b) Write the infix expression in RPN.

(a – b) * (a + c) / 7

...................................................................................................................................................

............................................................................................................................................. [1]

(c) Write the RPN expression as an infix expression.

a b / 4 * a b + -

...................................................................................................................................................

............................................................................................................................................. [1]

(d) Evaluate the RPN expression:

a b + c d / /

where a = 17, b = 3, c = 48 and d = 12.

Show your working.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2021 9618/31/M/J/21


7

5 (a) Calculate the shortest distance between the base and each of the other towns in the diagram
using Dijkstra’s algorithm.

Show your working and write your answers in the table provided.

Base
4
5

Town 1 2
1 Town 2
8

Town 3

7 3 Town 6
1

5
6
Town 4 Town 5

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Answers

Town 1 Town 2 Town 3 Town 4 Town 5 Town 6

[5]

© UCLES 2021 9618/31/M/J/21 [Turn over


8

(b) Explain the use of graphs to aid Artificial Intelligence (AI).

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

6 Give two benefits and two drawbacks of packet switching.

Benefit 1 ...........................................................................................................................................

..........................................................................................................................................................

Benefit 2 ...........................................................................................................................................

..........................................................................................................................................................

Drawback 1 ......................................................................................................................................

..........................................................................................................................................................

Drawback 2 ......................................................................................................................................

..........................................................................................................................................................
[4]

© UCLES 2021 9618/31/M/J/21


9

7 The diagram shows a logic circuit.

A P
Y
B

C R

Z
Q

(a) Complete the truth table for the given logic circuit. Show your working.

Inputs Working space Outputs


A B C P Q R Y Z
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
[3]
(b) State the name of the logic circuit.

............................................................................................................................................. [1]

(c) Write the Boolean expressions for the two outputs Y and Z in the truth table as
sum-of-products and state the purpose of each output.

Y = ............................................................................................................................................

Purpose ....................................................................................................................................

Z = ............................................................................................................................................

Purpose ....................................................................................................................................
[4]

© UCLES 2021 9618/31/M/J/21 [Turn over


10

8 (a) State two factors that may affect the performance of a sorting algorithm.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) The given algorithm is a simple bubble sort that arranges a set of scores stored in a one-
dimensional array into descending order, and orders the corresponding students’ names
stored into a two-dimensional array in the same order as the scores. All the arrays are indexed
from 1.

The contents of both arrays after sorting are shown.

Name
Score
1 2
1 98 1 Smithfield Tom
2 97 2 Johnson Jane

… …

248 5 248 Peters Jade


249 3 249 Allen John

YearSize 249 ←
Flag ←
TRUE
WHILE Flag = TRUE
Flag FALSE←
FOR Student ←
1 TO YearSize - 1
IF Score[Student] < Score[Student + 1] THEN
Temp1 ←
Score[Student]
Temp2 ←
Name[Student,1]
Temp3 ←
Name[Student,2]
Score[Student] Score[Student + 1] ←
Name[Student,1] Name[Student + 1,1] ←
Name[Student,2] Name[Student + 1,2] ←
Score[Student + 1] Temp1 ←
Name[Student + 1,1] Temp2 ←
Name[Student + 1,2] Temp3 ←
Flag TRUE ←
ENDIF
NEXT Student
ENDWHILE

© UCLES 2021 9618/31/M/J/21


11

Write an algorithm, using pseudocode, that will perform the same task using an insertion sort.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [6]

© UCLES 2021 9618/31/M/J/21 [Turn over


12

9 (a) Describe what is meant by an imperative (procedural) programming language.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Describe what is meant by a declarative programming language.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(c) Identify the programming paradigm for each of these program code examples.

Program code example Programming paradigm


male(john).
female(ethel).
parent(john, ethel).
FOR Counter = 1 TO 20
X = X * Counter
NEXT Counter
Start: LDD Counter
INC ACC
STO Counter
public class Vehicle
{
private speed;
public Vehicle()
{
speed = 0;
}
}
[4]

Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the
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
Cambridge Local Examinations Syndicate (UCLES), which itself is a department of the University of Cambridge.

© UCLES 2021 9618/31/M/J/21


Cambridge International AS & A Level
* 4 9 1 1 3 9 2 1 4 2 *

COMPUTER SCIENCE 9618/31


Paper 3 Advanced Theory October/November 2022

1 hour 30 minutes

You must answer on the question paper.

No additional materials are needed.

INSTRUCTIONS
● Answer all questions.
● Use a black or dark blue pen.
● Write your name, centre number and candidate number in the boxes at the top of the page.
● Write your answer to each question in the space provided.
● Do not use an erasable pen or correction fluid.
● Do not write on any bar codes.
● You may use an HB pencil for any diagrams, graphs or rough working.
● Calculators must not be used in this paper.

INFORMATION
● The total mark for this paper is 75.
● The number of marks for each question or part question is shown in brackets [ ].
● No marks will be awarded for using brand names of software packages or hardware.

This document has 12 pages. Any blank pages are indicated.

DC (LK/CGW) 302515/4
© UCLES 2022 [Turn over
2

1 Real numbers are stored in a computer system using floating-point representation with:

• 8 bits for the mantissa


• 8 bits for the exponent
• two’s complement form for both mantissa and exponent.

(a) Write the normalised floating-point representation of +202 in this system.


Show your working.

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]

(b) Write the normalised floating-point representation of –202 in this system.


Show your working.

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]

© UCLES 2022 9618/31/O/N/22


3

(c) A binary number is stored in the computer system.

Mantissa Exponent

0 0 0 1 1 1 1 0 0 0 0 1 1 0 0 0

(i) State why the number is not normalised.

...........................................................................................................................................

..................................................................................................................................... [1]

(ii) Write the normalised floating-point representation of the number.

Mantissa Exponent

[2]

2 Outline the functions of the Transport and Internet layers of the TCP/IP protocol suite.

Transport layer .................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

Internet layer ....................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................
[5]

© UCLES 2022 9618/31/O/N/22 [Turn over


4

3 (a) State what is meant by the term enumerated data type.

...................................................................................................................................................

............................................................................................................................................. [1]

(b) State what is meant by the term pointer data type.

...................................................................................................................................................

............................................................................................................................................. [1]

(c) The months of the year are: January, February, March, April, May, June, July, August,
September, October, November and December.

Write the pseudocode statement to define the data type Quarter1, to hold the names of the
first three months of a year.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(d) The composite data type Pet is used to store data about the various pets of a group of
students. It uses these fields:

Field name Data type


PetName String
AnimalType String
PetAge Integer
PetGender Char
OwnerName String

(i) Write the pseudocode statement to set up a variable for one record of the composite
data type Pet.

...........................................................................................................................................

..................................................................................................................................... [1]

© UCLES 2022 9618/31/O/N/22


5

(ii) Write pseudocode to store the details of the following pet, in the variable you set up in
part (d)(i).

PetName AnimalType PetAge PetGender OwnerName


Tibbles Cat 8 M Jasmine Smith

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [3]

4 Draw one line to connect each stage of compilation to its most appropriate description.

Stage of compilation Description

minimising a program’s execution time and


memory requirement

Lexical analysis
converting an intermediate representation of
source code into an executable form

Syntax analysis
converting a sequence of characters into a
sequence of tokens

Code generation
directly executing instructions written in a
scripting language

Optimisation
using parsing algorithms to interpret the
meaning of a sequence of tokens

[4]

© UCLES 2022 9618/31/O/N/22 [Turn over


6

5 (a) Write the infix expression in Reverse Polish Notation (RPN).

a * b + b - d + 15

...................................................................................................................................................

............................................................................................................................................. [1]

(b) (i) Write the RPN expression in infix form.

a b - c d + * a /

...........................................................................................................................................

..................................................................................................................................... [1]

(ii) Evaluate your infix expression from part (b)(i) when a = 5, b = 10, c = 27 and d = 12.

...........................................................................................................................................

..................................................................................................................................... [1]

6 A message is encrypted using a private key and sent to an individual using asymmetric encryption.

(a) State what is meant by a private key.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Describe the process of asymmetric encryption.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2022 9618/31/O/N/22


7

(c) Explain how a digital signature is used to verify a message when it is received.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

7 (a) Complete the Karnaugh map (K-map) for the Boolean expression.

Z = Ā. B. C̄. D̄ + Ā. B. C̄. D + A. B. C̄. D̄ + A. B. C̄. D + A. B̄. C̄. D̄ + A. B̄. C̄. D

AB

CD 00 01 11 10

00

01

11

10

[2]

(b) Draw loop(s) around appropriate group(s) in the K-map to produce an optimal
sum-of-products. [2]

(c) Write the Boolean expression from your answer to part (b) as a simplified sum-of-products.
Use Boolean algebra to give your answer in its simplest form.

Simplified sum-of-products

Z = ............................................................................................................................................

Simplest form

Z = ............................................................................................................................................
[3]

© UCLES 2022 9618/31/O/N/22 [Turn over


8

8 Virtual memory, paging and segmentation are used in memory management.

(a) Explain what is meant by virtual memory.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

(b) State one difference between paging and segmentation in the way memory is divided.

...................................................................................................................................................

............................................................................................................................................. [1]

9 Deep learning is used in Artificial Intelligence (AI).

(a) Describe what is meant by deep learning.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Outline the reasons for using deep learning.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2022 9618/31/O/N/22


9

10 Reduced Instruction Set Computers (RISC) and Complex Instruction Set Computers (CISC) are
two types of processor.

(a) Tick (3) one box in each row to show if the statement applies to RISC or CISC processors.

Statement RISC CISC


uses a smaller instruction set
uses single-cycle instructions and limited addressing modes
uses fewer general-purpose registers
uses both hardwired and micro-coded control unit
uses a system where cache is split between data and
instructions
[2]

(b) Describe the process of pipelining during the fetch-execute cycle in RISC processors.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

© UCLES 2022 9618/31/O/N/22 [Turn over


10

11 (a) Define these Object-Oriented Programming (OOP) terms:

Instance ....................................................................................................................................

...................................................................................................................................................

Inheritance ................................................................................................................................

...................................................................................................................................................

Polymorphism ...........................................................................................................................

...................................................................................................................................................
[3]

(b) In OOP, a class contains attributes and methods.

Complete the pseudocode for the class Car to enable objects to be created. The class needs
to include:

• string attributes to store the make, model, body type and fuel type
• an integer attribute to store the number of cars of that type built.

The attributes must be available only through the methods of the class.

CLASS .....................................

PRIVATE Make : STRING

PRIVATE ................................................................

................................................................................

................................................................................

................................................................................

PUBLIC PROCEDURE New(CarMake : STRING, ................................................... ,

.....................................................)

Make ← ......................................
Model ← ......................................

BodyType ← CarBodyType

Fuel ← ""

NumberBuilt ← 0

ENDPROCEDURE

GetFuel()

GetNumberBuilt()

.....................................
[5]
© UCLES 2022 9618/31/O/N/22
11

12 (a) The array Names[0:99] is in alphabetical order.

Complete this pseudocode binary search algorithm.

Lower ←0
......................................................................................................
Mid ← 0
Exit ← FALSE
OUTPUT "Enter the name to be found "
INPUT Target
REPEAT

....................................................................................................... THEN

OUTPUT Target, " does not exist"


Exit ←
TRUE
ENDIF
Mid ←Lower + (Upper – Lower + 1) DIV 2
IF Names[Mid] < Target THEN

Lower ←
.....................................................................................................
ENDIF
IF Names[Mid] > Target THEN

.....................................................................................................
ENDIF

...................................................................................................... THEN
OUTPUT Target, " was found at location ", Mid
Exit ← TRUE
ENDIF

......................................................................................................
[6]

(b) Big O notation is used to classify efficiency of algorithms.

The Big O notation for time complexity in a binary search is O(log n).

(i) State the Big O notation for time complexity of a linear search.

..................................................................................................................................... [1]

(ii) Describe the meaning of O(log n) as it applies to a binary search algorithm.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [2]

© UCLES 2022 9618/31/O/N/22


12

BLANK PAGE

Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the
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 Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge
Local Examinations Syndicate (UCLES), which is a department of the University of Cambridge.

© UCLES 2022 9618/31/O/N/22


Cambridge International AS & A Level
* 2 6 9 2 3 9 2 3 6 8 *

COMPUTER SCIENCE 9618/31


Paper 3 Advanced Theory May/June 2023

1 hour 30 minutes

You must answer on the question paper.

No additional materials are needed.

INSTRUCTIONS
● Answer all questions.
● Use a black or dark blue pen.
● Write your name, centre number and candidate number in the boxes at the top of the page.
● Write your answer to each question in the space provided.
● Do not use an erasable pen or correction fluid.
● Do not write on any bar codes.
● You may use an HB pencil for any diagrams, graphs or rough working.
● Calculators must not be used in this paper.

INFORMATION
● The total mark for this paper is 75.
● The number of marks for each question or part question is shown in brackets [ ].
● No marks will be awarded for using brand names of software packages or hardware.

This document has 12 pages.

DC (KS) 327186
© UCLES 2023 [Turn over
2

1 Numbers are stored in two different computer systems by using floating-point representation.

System 1 uses:

• 10 bits for the mantissa


• 6 bits for the exponent
• two’s complement form for both the mantissa and the exponent.

System 2 uses:

• 8 bits for the mantissa


• 8 bits for the exponent
• two’s complement form for both the mantissa and the exponent.

(a) Calculate the normalised floating-point representation of 113.75 and show how it would be
represented in each of these two systems.

Show your working.

System 1

Mantissa Exponent

System 2

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[4]

© UCLES 2023 9618/31/M/J/23


3

(b) Explain the problem that occurred in part (a) when representing the number in system 2.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

2 (a) Draw one line from each machine learning category to its most appropriate description.

Machine learning category Description

simulates the data-processing


capabilities of the human brain to
make decisions
Supervised
learning
enables learning by mapping an input
to an output based on example input–
output pairs
Reinforcement
learning
enables information related to errors
produced by the neural network to be
transmitted
Deep
learning
enables learning in an interactive
environment by trial and error using
its own experiences
Unsupervised
learning
enables learning by allowing the
process to discover patterns on its
own that were previously undetected
[4]

(b) Describe the purpose of both the A* algorithm and Dijkstra’s algorithm.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2023 9618/31/M/J/23 [Turn over


4

3 (a) A hashing algorithm is used to calculate storage locations for records in a random access file.
It calculates hash values by using the function modulus 3.

The function modulus gives the remainder after integer division.


For example, 1030 modulus 3 = 1. Therefore, the record key 1030 gives a hash value of 1.

Complete the table to show the remaining hash values.

Record key Hash value


1030 1

1050

1025
[2]

(b) Describe what happens, in relation to the storage or retrieval of a record in the file, when
the calculated hash value is a duplicate of a previously calculated hash value for a different
record key.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

© UCLES 2023 9618/31/M/J/23


5

4 Two descriptions of user-defined data types are given.

Give appropriate type declaration statements for each, including appropriate names.

(a) A data type to hold a set of prime numbers below 20. These prime numbers are:

2, 3, 5, 7, 11, 13, 17, 19

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) A data type to point to a day in the week, for example Monday.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

5 (a) State, with a reason, where it would be appropriate to use circuit switching.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Give two benefits and two drawbacks of circuit switching.

Benefit 1 ...................................................................................................................................

...................................................................................................................................................

Benefit 2 ...................................................................................................................................

...................................................................................................................................................

Drawback 1 ...............................................................................................................................

...................................................................................................................................................

Drawback 2 ...............................................................................................................................

...................................................................................................................................................
[4]

© UCLES 2023 9618/31/M/J/23 [Turn over


6

6 Several syntax diagrams are shown.

operator digit
+ 0

– 1

* 2

/ 3

symbol
$ 4

% 5

& 6

@ 7

# 8

letter 9
A

password
letter digit symbol

© UCLES 2023 9618/31/M/J/23


7

(a) State whether each of the following passwords is valid or invalid and give a reason for your
choice.

DPAD99$ ...................................................................................................................................

Reason .....................................................................................................................................

...................................................................................................................................................

DAD#95 .....................................................................................................................................

Reason .....................................................................................................................................

...................................................................................................................................................

ADY123? ...................................................................................................................................

Reason .....................................................................................................................................

...................................................................................................................................................
[3]

(b) Complete the Backus-Naur Form (BNF) for the syntax diagrams shown.

<symbol> ::= ........................................................................................................................

...................................................................................................................................................

<letter> ::= ........................................................................................................................

...................................................................................................................................................
[1]

(c) An identifier begins with one or more letters, followed by zero digits or one digit or more
digits.

Valid letters and digits are shown in the syntax diagrams on page 6.

Draw a syntax diagram for an identifier.

[4]

© UCLES 2023 9618/31/M/J/23 [Turn over


8

7 (a) Complete the Karnaugh map (K-map) for the following Boolean expression.

Z = A.B.C.D + A.B.C.D + A.B.C.D + A.B.C.D + A.B.C.D + A.B.C.D

AB

CD 00 01 11 10

00

01

11

10

[2]

(b) Draw loop(s) around appropriate group(s) in the K-map to produce an optimal
sum-of-products. [2]

(c) Write the Boolean logic expression from your answer to part (b) as a simplified
sum-of-products.

Z = ............................................................................................................................................

............................................................................................................................................. [2]

(d) Use Boolean algebra to give your answer to part (c) in its simplest form.

Z = ...................................................................................................................................... [1]

© UCLES 2023 9618/31/M/J/23


9

8 Outline the characteristics of massively parallel computers.

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

.................................................................................................................................................... [3]

9 (a) Encryption is used to alter data into a form that makes it meaningless if intercepted.

Describe the purpose of asymmetric key cryptography.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Identify two benefits and two drawbacks of quantum cryptography.

Benefit 1 ...................................................................................................................................

...................................................................................................................................................

Benefit 2 ...................................................................................................................................

...................................................................................................................................................

Drawback 1 ...............................................................................................................................

...................................................................................................................................................

Drawback 2 ...............................................................................................................................

...................................................................................................................................................
[4]

© UCLES 2023 9618/31/M/J/23 [Turn over


10

10 The pseudocode algorithm shown copies an active accounts text file ActiveFile.txt to an
archive accounts text file ArchiveFile.txt, one line at a time. Any blank lines found in the
active accounts text file are replaced with the words "Account not present" in the archive
accounts text file.

Complete this file-handling pseudocode.

DECLARE Account : STRING

..........................................................................................................................................................

OPENFILE "ArchiveFile.txt" FOR WRITE

WHILE NOT ......................................................................................................................................


READFILE "ActiveFile.txt", Account
IF Account = "" THEN

WRITEFILE "ArchiveFile.txt", " .........................................................................."


ELSE

WRITEFILE "ArchiveFile.txt", ...............................................................................


ENDIF
ENDWHILE

..........................................................................................................................................................
CLOSEFILE "ArchiveFile.txt"
[5]

11 Pseudocode is to be written to implement a queue Abstract Data Type (ADT) with items of the
string data type. This will be implemented using the information in the table.

Identifier Data type Description

FrontPointer INTEGER points to the start of the queue

RearPointer INTEGER points to the end of the queue

Length INTEGER the current size of the queue

Queue STRING 1D array to implement the queue

A constant, with identifier MaxSize, limits the size of the queue to 60 items.

(a) Write the pseudocode to declare MaxSize, FrontPointer, RearPointer, Length and
Queue.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]
© UCLES 2023 9618/31/M/J/23
11

(b) Complete the following pseudocode for the function Dequeue to remove the front item from
the queue.

FUNCTION Dequeue RETURNS STRING


DECLARE Item : STRING

......................................................................................................................... > 0 THEN

Item ← .......................................................................................................................

......................................................................................................................................
IF Length = 0 THEN
CALL Initialise // reset the pointers
ELSE
IF FrontPointer > MaxSize THEN

....................................................................................................................... ← 1
ENDIF
ENDIF
ELSE
OUTPUT "The print queue was empty – error!"
Item ← ""
ENDIF
RETURN Item
ENDFUNCTION
[4]

(c) Explain how a new element can be added to the queue if it is implemented using two stacks.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

12 (a) Describe what is meant by recursion.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2023 9618/31/M/J/23 [Turn over


12

(b) A Fibonacci sequence is a series of numbers formed by adding together the two preceding
numbers, for example:

0, 1, 1, 2, …

This function calculates and returns values in the Fibonacci sequence and uses recursion.

FUNCTION Fib(Number : INTEGER) RETURNS INTEGER


IF Number <= 1 THEN
Result ← Number
ELSE
Result ← Fib(Number – 1) + Fib(Number – 2)
ENDIF
RETURN Result
ENDFUNCTION

Complete the trace table for the function when it is called as Fib(5).

Call number Function call Number Result Return value


5

[5]

Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the
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 Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge
Local Examinations Syndicate (UCLES), which is a department of the University of Cambridge.

© UCLES 2023 9618/31/M/J/23

You might also like