Computer Science (9608) · May/June 2017 · Question paper 31
Cambridge Computer Science (9608) question paper for paper 31, May/June 2017 — 9608/31/M/J/17, file 9608_s17_qp_31.pdf.
Text of this paper
www.dynamicpapers.com
Cambridge International Examinations
Cambridge International Advanced Subsidiary and Advanced Level
* 5 2 2 4 8 4 8 0 8 4 *
9608/31
COMPUTER SCIENCE
May/June 2017
Paper 3 Advanced Theory
1 hour 30 minutes
Candidates answer on the Question Paper.
No Additional Materials are required.
No calculators allowed.
READ THESE INSTRUCTIONS FIRST
Write your Centre number, candidate number and name in the spaces at the top of this page.
Write in dark blue or black pen.
You may use an HB pencil for any diagrams, graphs or rough working.
Do not use staples, paper clips, glue or correction fluid.
DO NOT WRITE IN ANY BARCODES.
Answer all questions.
No marks will be awarded for using brand names of software packages or hardware.
At the end of the examination, fasten all your work securely together.
The number of marks is given in brackets [ ] at the end of each question or part question.
The maximum number of marks is 75.
This document consists of 16 printed pages.
DC (ST/SG) 133411/3
© UCLES 2017
[Turn over
www.dynamicpapers.com
2
1
(a) Consider the following user-defined data type:
TYPE LibraryBookRecord
DECLARE ISBN
: INTEGER
DECLARE Title
: STRING
ENDTYPE
(i)
Write a pseudocode statement to declare a variable, Book, of type LibraryBookRecord.
[1]
(ii)
Write a pseudocode statement that assigns ‘Dune’ to the Title of Book.
[1]
(b) The user-defined data type LibraryBookRecord needs to be modified by adding the
following fields:
•
•
a field called Genre which can take two values, fiction or non-fiction
a field called NumberOfLoans which can be an integer value in the range 1 to 99
Write the updated version of LibraryBookRecord.
[3]
(c) A pointer is a variable that stores the address of a variable of a particular type.
Consider the code on page 3, which uses the following identifiers:
Identifier
© UCLES 2017
Data type
Description
IntPointer
^INTEGER
pointer to an integer
IntVar
INTEGER
an integer variable
Temp1
INTEGER
an integer variable
Temp2
INTEGER
an integer variable
9608/31/M/J/17
www.dynamicpapers.com
3
IntVar
57
IntPointer
Temp2
@IntVar
IntPointer^
IntPointer^
Temp1
//
//
//
//
//
//
//
//
assigns the value 57 to the integer
variable IntVar
assigns to IntPointer the address of the
integer variable IntVar
assigns to variable Temp2 the value at an
address pointed at by IntPointer
assigns the value in the variable Temp1 to
the memory location pointed at by IntPointer
The four assignment statements are executed. The diagram shows the memory contents
after execution.
Variable
Memory
address
Contents
...
8217
IntVar
8216
88
8215
8214
...
7307
IntPointer
7306
8216
7305
...
6717
Temp1
6716
88
Temp2
6715
57
6714
...
Use the diagram to state the current values of the following expressions:
(i)
@Temp2 [1]
(ii)
IntPointer [1]
(iii)
IntPointer^ [1]
(iv)
IntPointer^ = Temp2 + 6 [1]
© UCLES 2017
9608/31/M/J/17
[Turn over
4
www.dynamicpapers.com
(d) Write pseudocode statements that will achieve the following:
(i)
Assign the value 22 to the variable Temp2.
[1]
(ii)
Place the address of Temp1 in IntPointer.
[1]
(iii)
Copy the value in Temp2 into the memory location currently pointed at by IntPointer.
[1]
© UCLES 2017
9608/31/M/J/17
5
2
www.dynamicpapers.com
The following incomplete table shows descriptions and terms relating to malware.
(a) Complete the table with appropriate description and terms.
Description
Term
(i)
A standalone piece of malicious software that can
replicate itself using a network.
[1]
(ii)
Use email to attempt to obtain an individual’s
confidential data.
[1]
(iii)
Virus
[2]
(b) State two vulnerabilities that the malware in part (a)(i) or part (a)(iii) can exploit.
Vulnerability 1
Vulnerability 2
[2]
Question 2 continues on the next page.
© UCLES 2017
9608/31/M/J/17
[Turn over
www.dynamicpapers.com
6
(c) Anna has to send an email to Bob containing confidential information. Bob and Anna have
never sent emails to each other before.
Bob and Anna both have public and private keys.
The first step is for Anna to request that Bob sends her one of his keys.
(i)
State the key that Bob sends. [1]
(ii)
Explain how Anna can be sure that it is Bob who has sent the key.
[2]
(iii)
Anna has received the key from Bob.
The following incomplete table shows the sequence of actions between Anna and Bob to
communicate the confidential information.
Complete the table.
The person
performing the
action
Anna
Bob
Anna
Anna
Bob
What that person does
Requests Bob’s <answer to part (c)(i)> key.
Sends the email to Bob.
[4]
© UCLES 2017
9608/31/M/J/17
7
www.dynamicpapers.com
Question 3 begins on page 8.
© UCLES 2017
9608/31/M/J/17
[Turn over
www.dynamicpapers.com
8
3
Consider the following logic circuit, which contains a redundant logic gate.
A
X
B
C
(a) Write the Boolean algebraic expression corresponding to this logic circuit.
X = [3]
(b) Complete the truth table for this logic circuit.
A
B
C
0
0
0
0
0
1
0
1
0
0
1
1
1
0
0
1
0
1
1
1
0
1
1
1
Working space
X
[2]
(c) (i)
Complete the Karnaugh Map (K-map) for the truth table in part (b).
AB
00
C
01
11
10
0
1
The K-map can be used to simplify the expression in part (a).
(ii)
Draw loop(s) around appropriate groups to produce an optimal sum-of-products.
(iii)
Write a simplified sum-of-products expression, using your answer to part (ii).
[1]
[2]
X = [2]
© UCLES 2017
9608/31/M/J/17
9
www.dynamicpapers.com
(d) One Boolean identity is:
̅
A + A.B
=A+B
Simplify the expression for X in part (a) to the expression for X in part (c)(iii). You should use
the given identity.
[2]
© UCLES 2017
9608/31/M/J/17
[Turn over
www.dynamicpapers.com
10
4
A bank has 95 000 customers. Each customer has a unique ID.
When a customer uses an Automated Teller Machine (ATM) to obtain cash, their current balance
is checked. The balance is stored in a file which has the following fields:
•
•
•
the customer ID (6-digit number in the range 100000 to 999999)
an encrypted PIN
the current balance
The file can store a maximum of 100 000 records.
(a) Give a reason why a random organisation would be appropriate for this file.
[1]
(b) An algorithm for inserting a new record in this file uses the following hash function:
RecordKey
CustomerID MOD 100000
where RecordKey is the record position in the file.
(i)
Complete the table to show the values generated by the hash function for the given
customer IDs.
CustomerID
RecordKey
802139
2139
700004
689998
102139
[1]
(ii)
State the range of possible values for RecordKey.
Minimum value of RecordKey:
Maximum value of RecordKey:
[2]
© UCLES 2017
9608/31/M/J/17
11
(iii)
www.dynamicpapers.com
A procedure is written to insert a new record into the file.
Complete the algorithm for this procedure.
PROCEDURE InsertRecord(CustomerID : INTEGER)
RecordKey
Success
CustomerID MOD 100000
FALSE
// Find position for new record and insert it
REPEAT
IF record at position RecordKey is
THEN
Insert new record at position RecordKey
Success
TRUE
ELSE
IF RecordKey =
THEN
RecordKey
ELSE
RecordKey
+ 1
ENDIF
ENDIF
UNTIL Success = TRUE
ENDPROCEDURE
(c) (i)
[4]
Explain why an encrypted version of the PIN is stored in the file.
[2]
© UCLES 2017
9608/31/M/J/17
[Turn over
12
(ii)
www.dynamicpapers.com
A customer attempts to withdraw cash from an ATM. An algorithm is used to check if the
customer has entered the correct PIN.
Complete the algorithm.
1. Customer ID is read from card.
2. Customer enters PIN.
3. Customer PIN is
4.
5. Customer record is located in file.
6.
7. If match then transaction can proceed.
© UCLES 2017
9608/31/M/J/17
[3]
13
5
www.dynamicpapers.com
(a) A web browser is used to request and display a page stored on an internet web server.
Explain how each of the following items is used in this event.
(i)
Packet:
[2]
(ii)
Router:
[2]
(iii)
TCP/IP:
[2]
(b) The Internet can be used for video conferencing. Data can be transmitted over the Internet
using either packet switching or circuit switching.
(i)
State two problems that could arise if video conferencing were to use packet switching.
Problem 1
Problem 2
[2]
(ii)
Explain what is meant by circuit switching.
[2]
© UCLES 2017
9608/31/M/J/17
[Turn over
14
(iii)
www.dynamicpapers.com
Explain how the use of circuit switching overcomes the problems you have identified in
part (i).
[3]
6
A computer system is used to manage some of the functions in a vehicle. The vehicle has a
number of sensors and actuators. One sensor is used to monitor the moisture on the screen. If the
moisture exceeds a pre-set value, the windscreen wiper motor turns on automatically.
The software used in the computer system is dedicated to the sensor management functions.
When the system starts, the software runs some initial tasks. It then loops continuously until the
system is switched off.
(a) (i)
State the name given to the type of system described.
[1]
(ii)
Explain your answer to part (i).
[1]
(b) Within the software loop, the value of each sensor is read in turn. The value read from the
sensor is then processed.
State two drawbacks with this method of reading and processing sensor data.
Drawback 1
Drawback 2
[2]
© UCLES 2017
9608/31/M/J/17
15
www.dynamicpapers.com
(c) An alternative method of reading and processing sensor data is to use interrupts. Each sensor
is connected so that it can send an interrupt signal to the processor if its value changes.
On receipt of an interrupt signal, the processor carries out a number of steps as shown in the
following diagram.
Interrupt
1. Disable interrupts
2. Save current task
3. Identify source of
interrupt
4. Jump to Interrupt
Service Routine
5. Restore task
Return to task
(i)
6. Enable interrupts
State the purpose of step 1.
[1]
(ii)
State the purpose of step 6.
[1]
(iii)
Explain how the current task is saved in step 2.
[2]
© UCLES 2017
9608/31/M/J/17
[Turn over
www.dynamicpapers.com
16
(iv)
State two benefits of using interrupts to read and process the sensor data.
Benefit 1
Benefit 2
[2]
(v)
The interrupt handler in step 3 has to test each bit of a 16-bit register to discover the
source of the interrupt.
The contents of the 16-bit register are loaded into the 16-bit accumulator:
Bit:
15
14
13
12
11
10
Accumulator
9
8
7
0
0
0
0
0
0
1
0
1
6
5
4
3
2
1
0
0
1
0
1
0
0
0
An instruction is required to achieve the following:
•
•
If bit 9 is zero, set the accumulator to zero.
If bit 9 is one, set the accumulator to a non-zero value.
Write this instruction using an appropriate bitwise operation.
[2]
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 International
Examinations Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download at www.cie.org.uk after
the live examination series.
Cambridge International Examinations is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of University of Cambridge Local
Examinations Syndicate (UCLES), which is itself a department of the University of Cambridge.
© UCLES 2017
9608/31/M/J/17