Computer Science (9608) · Oct/Nov 2015 · Question paper 43

Cambridge Computer Science (9608) question paper for paper 43, Oct/Nov 2015 — 9608/43/O/N/15, file 9608_w15_qp_43.pdf.

Advertisement
Loading the paper…
Text of this paper

www.dynamicpapers.com

Cambridge International Examinations
Cambridge International Advanced Level

* 4 0 9 5 2 0 9 1 3 2 *

9608/43

COMPUTER SCIENCE
Paper 4 Further Problem-solving and Programming Skills

October/November 2015
2 hours

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 (KN/SW) 115643
© UCLES 2015

[Turn over

www.dynamicpapers.com
2
Throughout the paper you will be asked to write either pseudocode or program code.
Complete the statement to indicate which high-level programming language you will use.
Programming language

1

A large software house has been asked to supply a computerised solution for a business. The
project manager has drawn up a list of activities and their likely duration.

Activity

Weeks to
complete

Description

A

Write requirement specification

5

B

Produce program design

5

C

Write module code

15

D

Module testing

10

E

Integration testing

5

F

Alpha testing

3

G

Install software and acceptance testing

5

H

Write end user training guide

5

J

Write technical documentation

K

End user training

4

L

Sign off final system

1

10

(a) The project manager decides to construct a Program Evaluation Review Technique (PERT)
chart from this data.
1

5
A

2

3

5

6

3
F

9

7

10
J
4

8

10
(i)

Complete the PERT chart.

(ii)

State the critical path.

[7]

[2]
(iii)

Calculate the minimum number of weeks for the completion of this solution.
[1]

© UCLES 2015

9608/43/O/N/15

www.dynamicpapers.com
3
(b) For activity J:
(i)

State the earliest start time.
Week number [1]

(ii)

State the latest start time.
Week number [1]

(c) Give a reason why the project manager used a PERT chart.

[1]

© UCLES 2015

9608/43/O/N/15

[Turn over

www.dynamicpapers.com
4
2

A declarative programming language is used to represent the following facts and rules:
01
02
03
04
05
06
07
08
09
10
11
12
13
14

male(ali).
male(raul).
male(ahmed).
male(philippe).
female(meena).
female(aisha).
female(gina).
parent(ali, raul).
parent(meena, raul).
parent(ali, ahmed).
parent(meena, ahmed).
parent(ali, aisha).
parent(meena, aisha).
father(A, B) IF male(A) AND parent(A, B).

These clauses have the following meaning:
Clause

Explanation

01

Ali is male

05

Meena is female

08

Ali is a parent of Raul

14

A is the father of B if A is male and A is a parent of B

(a) More facts are to be included.
Philippe and Gina are the parents of Meena.
Write the additional clauses to record this.
15

16

[2]

(b) Using the variable P, the goal
parent(P, raul)
returns
P =

ali, meena

Write the result returned by the goal
parent(ali, C)
C = [2]

© UCLES 2015

9608/43/O/N/15

www.dynamicpapers.com
5
(c) Use the variable F to write the goal to find the father of Ahmed.
[1]
(d) Write the rule to show that X is the mother of Y.
mother(X, Y)
IF
[2]
(e) W is a grandparent of Z if W is a parent of one of Z’s parents.
Complete the following rule:
grandparent(W, Z)
IF

[2]
(f)

Complete the rule to show that G is a grandfather of K.
grandfather(G, K)
IF

[2]

© UCLES 2015

9608/43/O/N/15

[Turn over

www.dynamicpapers.com
6
3

A lending library stocks two types of item for loan: books and CDs.
All stock items have a title, the date the item was acquired and whether the item is currently out on
loan.
Books have an author and ISBN. CDs have an artist and play time in minutes.
The library needs a program to process data about the stock items. The program will use an
object-oriented programming language.
(a) Complete the class diagram showing the appropriate properties and methods.
StockItem
Title: STRING

ShowTitle()

Book

CD

Author: STRING

Constructor()

ShowAuthor()

[7]

© UCLES 2015

9608/43/O/N/15

www.dynamicpapers.com
7
(b) Write program code
(i)

for the class definition for the superclass StockItem.
Programming language

[3]

(ii)

for the class definition for the subclass Book.
Programming language

[3]

© UCLES 2015

9608/43/O/N/15

[Turn over

www.dynamicpapers.com
8
(iii)

to create a new instance of Book with:
•
identifier NewBook
•
title “Computers”
•
author A.Nyone
•
ISBN 099111
•
acquired on 12/11/2001
•
not out on loan
Programming language

[3]

© UCLES 2015

9608/43/O/N/15

www.dynamicpapers.com
9

Question 4 begins on page 10.

© UCLES 2015

9608/43/O/N/15

[Turn over

www.dynamicpapers.com
10
4

A binary tree Abstract Data Type (ADT) has these associated operations:
•
•
•

create the tree (CreateTree)
add an item to tree (Add)
output items in ascending order (TraverseTree)

(a) Show the final state of the binary tree after the following operations are carried out.
CreateTree
Add("Dodi")
Add("Farai")
Add("Elli")
Add("George")
Add("Ben")
Add("Celine")
Add("Ali")

[4]

© UCLES 2015

9608/43/O/N/15

www.dynamicpapers.com
11
(b) The binary tree ADT is to be implemented as an array of nodes. Each node consists of data
and two pointers.
Using pseudocode, a record type, Node, is declared as follows:
TYPE Node
DECLARE Name : STRING
DECLARE LeftPointer : INTEGER
DECLARE RightPointer : INTEGER
ENDTYPE
The statement
DECLARE Tree : ARRAY[1:10] OF Node
reserves space for 10 nodes in array Tree.
The CreateTree operation links all nodes into a linked list of free nodes. It also initialises the
RootPointer and FreePointer.
Show the contents of the Tree array and the values of the two pointers, RootPointer and
FreePointer, after the operations given in part (a) have been carried out.
Tree
RootPointer

Name

LeftPointer

RightPointer

[1]
[2]
FreePointer

[3]
[4]
[5]
[6]
[7]
[8]
[9]
[10]
[7]

© UCLES 2015

9608/43/O/N/15

[Turn over

www.dynamicpapers.com
12
(c) A programmer needs an algorithm for outputting items in ascending order. To design this, the
programmer writes a recursive procedure in pseudocode.
(i)

Complete the pseudocode:
01 PROCEDURE TraverseTree(BYVALUE Root: INTEGER)
02
03

IF Tree[Root].LeftPointer
THEN

04

TraverseTree( )

05

ENDIF

06

OUTPUT .Name

07

IF <> 0

08

THEN

09
10

TraverseTree( )
ENDIF

11 ENDPROCEDURE
[5]
(ii)

Explain what is meant by a recursive procedure. Give a line number from the code above
that shows procedure TraverseTree is recursive.

Line number [2]

(iii)

Write the pseudocode call required to output all names stored in Tree.

[1]

© UCLES 2015

9608/43/O/N/15

www.dynamicpapers.com
13

Question 5 begins on page 14.

© UCLES 2015

9608/43/O/N/15

[Turn over

www.dynamicpapers.com
14
5

Data about sports club members are stored in a random file of records.
•
•
•
•
•

The key field of a member record is the member ID (range 1000 to 9999).
Other member data are stored.
A hashing function is used to calculate a record address.
The random file initially consists of dummy records.
Dummy records are shown by member ID set to 0.

FUNCTION Hash(MemberID : INTEGER) RETURNS INTEGER
Address ← MemberID MOD 100
RETURN Address
ENDFUNCTION
(a) New members with the following member IDs have joined the sports club:
1001, 3005, 4096, 2098, 7002
Indicate where each record should be stored by deleting the zero and writing the member ID
in the correct cell.

MembershipFile
Address

MemberID

0

0

1

0

2

0

3

0

4

0

5

0

6

0

7

0

8

0

Other member data

:
:
96

0

97

0

98

0

99

0

© UCLES 2015

[2]
9608/43/O/N/15

www.dynamicpapers.com
15
(b) (i)

The program stores a new member’s data in the record variable NewMember. The field
MemberID stores the member ID.
Complete the pseudocode:
10 // generate record address
20 NewAddress ←
30 // move pointer to the disk address for the record
40 SEEK
50 PUTRECORD "MembershipFile",
[4]

(ii)

Before records can be saved to the file MembershipFile, the file needs to be opened.
Complete the pseudocode.
01 TRY
02

OPENFILE FOR RANDOM

03 EXCEPT
04

05 ENDTRY
[2]
(iii)

A record with member ID 9001 is to be stored.
Explain the problem that occurs when this record is saved.

[2]

(iv)

Describe a method, without changing the function Hash, to handle the problem identified
in part (b)(iii).

[2]

© UCLES 2015

9608/43/O/N/15

[Turn over

www.dynamicpapers.com
16
(v)

Write pseudocode to implement the method you described in part (b)(iv).
Choose line numbers to indicate where your pseudocode should be inserted in the
pseudocode of part (b)(i).

[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 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 2015

9608/43/O/N/15

Advertisement