Computer Science (9608) · Oct/Nov 2017 · Question paper 42

Cambridge Computer Science (9608) question paper for paper 42, Oct/Nov 2017 — 9608/42/O/N/17, file 9608_w17_qp_42.pdf.

Advertisement
Loading the paper…
Text of this paper

www.dynamicpapers.com

Cambridge International Examinations
Cambridge International Advanced Subsidiary and Advanced Level

* 5 5 2 9 0 1 8 9 5 3 *

9608/42

COMPUTER SCIENCE
Paper 4 Further Problem-solving and Programming Skills

October/November 2017
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 14 printed pages and 2 blank pages.
DC (LK/JG) 129979/4
© UCLES 2017

[Turn over

2
1

www.dynamicpapers.com

Students are choosing their A Level subjects based on their IGCSE subject results.
A student can take:

•
•
•

Computer Science, if they have a grade C in Maths or a grade C in Computer Science
Maths, if they have a grade C in Maths
Physics, if they have a grade C in Science and a grade C in Maths.

(a) Complete the decision table.

Actions

Conditions

Column
1

2

3

4

5

6

7

8

Grade C in
Computer Science

Y

Y

Y

Y

N

N

N

N

Grade C in Maths

Y

Y

N

N

Y

Y

N

N

Grade C in Science

Y

N

Y

N

Y

N

Y

N

Take Computer
Science
Take Maths
Take Physics
[4]

(b) Simplify your solution by removing redundancies.
Column

Actions

Conditions

S

T

U

V

W

X

Y

Z

Grade C in
Computer Science
Grade C in Maths
Grade C in Science
Take Computer
Science
Take Maths
Take Physics
[3]

© UCLES 2017

9608/42/O/N/17

3

www.dynamicpapers.com

(c) Show how the columns from part (a) were simplified to create the columns in part (b).
For example, if columns 5, 6 and 7 were simplified to create column X, then you state this in
your answer.

[3]

© UCLES 2017

9608/42/O/N/17

[Turn over

4
2

www.dynamicpapers.com

(a) A project manager is planning to create a new computer game. The following table shows the
activities and the estimated number of weeks to complete each activity.
Activity

Description

Weeks to complete

A

Interview end user

1

B

Produce requirements analysis

2

C

Design program structure

3

D

Design Interface

1

E

Program development

12

F

Black-box testing

2

G

Produce technical documentation

4

H

Acceptance testing

1

I

Installation

1

Complete the labelling of the Program Evaluation Review Technique (PERT) chart using the
data in the table. The first two activities have been done for you.
4

1

1

A

5
7

6

2
B

2
8

3

9

10
[7]
(b) State what the dashed lines in the PERT chart represent.

[1]

© UCLES 2017

9608/42/O/N/17

www.dynamicpapers.com

5
3

A declarative programming language is used to represent the knowledge base:
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15

room(master_bedroom).
room(ensuite_bathroom).
room(office).
room(spare_bedroom).
room(nursery).
furniture(bed).
furniture(desk).
furniture(cot).
furniture(wardrobe).
furniture(computer).
located(bed, master_bedroom).
located(bed, spare_bedroom).
located(cot, nursery).
located(computer, office).
located(computer, master_bedroom).

These clauses have the following meanings:
Clause

Explanation

01

Master bedroom is a room

06

Bed is an item of furniture

11

Bed is located in the master bedroom

(a) Corridor is a room that contains a table and a lamp.
Write additional clauses to represent this information.
16
17
18
19
20
[5]

© UCLES 2017

9608/42/O/N/17

[Turn over

6

www.dynamicpapers.com

(b) Using the variable WhatItem, the goal:
located(WhatItem, master_bedroom).
returns:
WhatItem = bed, computer
Write the result returned by the goal:
located(bed, WhichRoom).
WhichRoom =
[2]
(c) (i)

Clauses to identify rooms that are next to each other need to be stored.
The nursery is next to the master bedroom. This information is stored as:
21 nextTo(nursery, master_bedroom).
22 nextTo(master_bedroom, nursery).
Explain why both clauses are necessary.

[2]

(ii)

The corridor is next to the main bathroom.
Write additional clauses for this fact.
23
24
25
[3]

(d) B can be moved into A, if B is furniture, A is a room and B is not already in A.
Write this as a rule.
canBeMovedTo( , )
IF
[6]

© UCLES 2017

9608/42/O/N/17

7
4

www.dynamicpapers.com

(a) The array Numbers[0 : Max] stores numbers. An insertion sort can be used to sort these
numbers into ascending order.
Complete the following pseudocode for the insertion sort algorithm.
FOR Pointer

1 TO (Max - 1)

ItemToInsert
CurrentItem

WHILE (CurrentItem > 0) AND (Numbers[CurrentItem – 1] > ItemToInsert)
Numbers[ ]
CurrentItem

Numbers[CurrentItem - 1]

CurrentItem – 1

ENDWHILE
Numbers[CurrentItem]

ENDFOR

[4]

(b) Identify two features of the array Numbers that would have an impact on the performance of
this insertion sort algorithm.
1
2
[2]

© UCLES 2017

9608/42/O/N/17

[Turn over

www.dynamicpapers.com

8
5

The following table shows part of the instruction set for a processor. The processor has one
general purpose register, the Accumulator (ACC), and an Index Register (IX).
Instruction
Op code

Explanation

Operand

LDM

#n

Immediate addressing. Load the number n to ACC.

LDD

<address>

Direct addressing. Load the contents of the location at the given
address to ACC.

LDI

<address>

Indirect addressing. The address to be used is at the given
address. Load the contents of this second address to ACC.

LDX

<address>

Indexed addressing. Form the address from <address> + the
contents of the index register. Copy the contents of this calculated
address to ACC.

LDR

#n

Immediate addressing. Load the number n to IX.

STO

<address>

Store the contents of ACC at the given address.

STX

<address>

Indexed addressing. Form the address from <address> + the
contents of the index register. Copy the contents from ACC to this
calculated address.

ADD

<address>

Add the contents of the given address to the ACC.

INC

<register> Add 1 to the contents of the register (ACC or IX).

DEC

<register> Subtract 1 from the contents of the register (ACC or IX).

JMP

<address>

Jump to the given address.

CMP

<address>

Compare the contents of ACC with the contents of <address>.

CMP

#n

Compare the contents of ACC with number n.

JPE

<address>

Following a compare instruction, jump to <address> if the compare
was True.

JPN

<address>

Following a compare instruction, jump to <address> if the compare
was False.

LSL

#n

Bits in ACC are shifted n places to the left. Zeros are introduced
on the right hand end.

LSR

#n

Bits in ACC are shifted n places to the right. Zeros are introduced
on the left hand end.

IN

Key in a character and store its ASCII value in ACC.

OUT

Output to the screen the character whose ASCII value is stored
in ACC.

END

Return control to the operating system.

© UCLES 2017

9608/42/O/N/17

www.dynamicpapers.com

9

(a) Six letters are stored, starting at the location labelled LETTERS. A program is needed to
perform a linear search on LETTERS to find the letter 'x'. The program counts the number of
times 'x' appears in LETTERS.
The following is the pseudocode for the program.
0 TO 5
FOR COUNT
IF LETTERS[COUNT] = LETTERTOFIND
THEN
FOUND + 1
FOUND
ENDIF
ENDFOR
Write this program. Use the op codes from the given instruction set.
Label
START:

Op code
LDR

Operand
#0

LOOP:

Comment
// initialise Index Register
// load LETTERS
// is LETTERS = LETTERTOFIND ?
// if not, go to NOTFOUND
// increment FOUND

NOTFOUND:
// increment COUNT
// is COUNT = 6 ?
// if yes, end
// increment Index Register
// go back to beginning of loop
ENDP:

END

// end program

LETTERTOFIND:

'x'

LETTERS:

'd'
'u'
'p'
'l'
'e'
'x'

© UCLES 2017

COUNT:

0

FOUND:

0

[10]
9608/42/O/N/17

[Turn over

10

www.dynamicpapers.com

(b) Six values are stored, starting at the location VALUES. A program is needed to divide each of
the values by 8 and store them back in their original location.
Write this program. Use the op codes from the instruction set on the next page.
Label

Op code

Operand

START:

Comment
// initialise the Index Register
// load the value from VALUES
// divide by 8
// store the new value in VALUES
// increment the Index Register
// increment REPS
// is REPS = 6 ?
// repeat for next value

END
REPS:
VALUES:

0
22
13
5
46
12
33
[10]

© UCLES 2017

9608/42/O/N/17

www.dynamicpapers.com

11
Instruction
Op code

Explanation

Operand

LDM

#n

Immediate addressing. Load the number n to ACC.

LDD

<address>

Direct addressing. Load the contents of the location at the given
address to ACC.

LDI

<address>

Indirect addressing. The address to be used is at the given
address. Load the contents of this second address to ACC.

LDX

<address>

Indexed addressing. Form the address from <address> + the
contents of the index register. Copy the contents of this calculated
address to ACC.

LDR

#n

Immediate addressing. Load the number n to IX.

STO

<address>

Store the contents of ACC at the given address.

STX

<address>

Indexed addressing. Form the address from <address> + the
contents of the index register. Copy the contents from ACC to this
calculated address.

ADD

<address>

Add the contents of the given address to the ACC.

INC

<register> Add 1 to the contents of the register (ACC or IX).

DEC

<register> Subtract 1 from the contents of the register (ACC or IX).

JMP

<address>

Jump to the given address.

CMP

<address>

Compare the contents of ACC with the contents of <address>.

CMP

#n

Compare the contents of ACC with number n.

JPE

<address>

Following a compare instruction, jump to <address> if the compare
was True.

JPN

<address>

Following a compare instruction, jump to <address> if the compare
was False.

LSL

#n

Bits in ACC are shifted n places to the left. Zeros are introduced
on the right hand end.

LSR

#n

Bits in ACC are shifted n places to the right. Zeros are introduced
on the left hand end.

IN

Key in a character and store its ASCII value in ACC.

OUT

Output to the screen the character whose ASCII value is stored
in ACC.

END

Return control to the operating system.

© UCLES 2017

9608/42/O/N/17

[Turn over

www.dynamicpapers.com

12
6

A bank has a range of customer accounts, which includes current accounts and savings accounts.
All accounts have:

•
•

an account number
a balance (amount of money in an account).

A current account has a level (bronze, silver or gold). A monthly fee ($) is taken from each account.
Savings account customers pay a regular amount ($) into their account. The payment interval is a
number of weeks (for example, 4).
An object-oriented program will be written to process data about the accounts.
(a) Complete the class diagram.
Account
AccountNumber : STRING
Balance : CURRENCY
Constructor()
GetAccountNumber()
GetBalance()
SetAccountNumber()
SetBalance()

CurrentAccount

SavingsAccount

Constructor()

© UCLES 2017

GetPaymentInterval()
SetPaymentInterval()

9608/42/O/N/17

[3]

13

www.dynamicpapers.com

(b) Write program code to declare the Account class.
Programming language
Program code

[5]
© UCLES 2017
9608/42/O/N/17
[Turn over

14

www.dynamicpapers.com

(c) Write program code to declare the SavingsAccount class. Do not write any get or set
methods.
Programming language
Program code

[5]

© UCLES 2017

9608/42/O/N/17

15
BLANK PAGE

© UCLES 2017

9608/42/O/N/17

www.dynamicpapers.com

16

www.dynamicpapers.com

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 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/42/O/N/17

Advertisement