Computer Science (0478) · Oct/Nov 2015 · Question paper 21

Cambridge Computer Science (0478) question paper for paper 21, Oct/Nov 2015 — 0478/21/O/N/15, file 0478_w15_qp_21.pdf.

Advertisement
Loading the paper…
Text of this paper

www.dynamicpapers.com

Cambridge International Examinations
Cambridge International General Certificate of Secondary Education

* 6 8 7 3 5 2 6 4 2 6 *

0478/21

COMPUTER SCIENCE
Paper 2 Problem-solving and Programming

October/November 2015
1 hour 45 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.
DO NOT ATTEMPT TASKS 1, 2 AND 3 in the pre-release material; these are for information only.
You are advised to spend no more than 40 minutes on Section A (Question 1).
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 50.

This document consists of 11 printed pages and 1 blank page.
DC (CW/CGW) 95072/2
© UCLES 2015

[Turn over

www.dynamicpapers.com
2
Section A
You are advised to spend no longer than 40 minutes answering this section.
Here is a copy of the pre-release material.
DO NOT attempt Tasks 1, 2 and 3 now.
Use the pre-release material and your experience from attempting the tasks before the examination to
answer Question 1.
Pre-release Material
Write and test a program to complete the three tasks.
A new born baby is kept in a cot in a hospital; the temperature of the baby is monitored every
10 minutes. The temperature of the baby is recorded in degrees Celsius to one decimal place and
must be within the range 36.0°C to 37.5°C.
TASK 1
To simulate the monitoring required, write a routine that allows entry of the baby’s temperature in
degrees Celsius. The routine should check whether the temperature is within the acceptable range,
too high or too low and output a suitable message in each case.
TASK 2
Write another routine that stores the temperatures taken over a three hour period in an array. This
routine should output the highest and lowest temperatures and calculate the difference between
these temperatures.
TASK 3
For a baby who has a temperature difference of more than one degree Celsius, and/or has been
outside the acceptable range more than twice in the three hour period, output a suitable message
giving a summary of the problem.
Your program must include appropriate prompts for the entry of data. Error messages and other
outputs need to be set out clearly and understandably. All variables, constants and other identifiers
must have meaningful names. Each task must be fully tested.

© UCLES 2015

0478/21/O/N/15

www.dynamicpapers.com
3
1

(a) All variables, constants and other identifiers should have meaningful names.
(i)

When you performed the tasks, you used variables.
Write suitable declarations for two of these.
State what you used each one for.
Variable 1
Use
Variable 2
Use [4]

(ii)

When you performed the tasks, you may have used constants.
Write suitable declarations for two of these.
State what you used each one for.
Constant 1
Use

Constant 2
Use
[4]

© UCLES 2015

0478/21/O/N/15

[Turn over

www.dynamicpapers.com
4
(b) Write an algorithm to complete Task 1, using either pseudocode, programming statements
or a flowchart.

[5]

© UCLES 2015

0478/21/O/N/15

www.dynamicpapers.com
5
(c) (i)

Explain how you completed Task 3. You can include pseudocode or programming
statements as part of your explanation. You should assume that Task 2 has been
completed.

[5]

(ii)

Comment on the efficiency of your design for Task 3.

[2]

© UCLES 2015

0478/21/O/N/15

[Turn over

www.dynamicpapers.com
6
Section B
2

Read this section of program code that should input 50 numbers and then output the average.
1

Total = 0

2

For Counter = 1 TO 50

3

INPUT Num

4

Total = Total + 1

5

Counter = Counter + 1

6

Average = Total/Counter

7

NEXT Counter

8

PRINT Average

There are four errors in this code.
Locate these errors and suggest code corrections to remove each error.
1

2

3

4
[4]

© UCLES 2015

0478/21/O/N/15

www.dynamicpapers.com
7

Question 3 begins on page 8.

© UCLES 2015

0478/21/O/N/15

[Turn over

www.dynamicpapers.com
8
3

(a) The flowchart inputs an integer. The predefined function DIV gives the integer result of the
10 DIV 3 gives the value Y = 3. The predefined function MOD gives the
division, e.g. Y
10 MOD 3 gives the value Y = 1.
value of the remainder, e.g. Y
START

Posn @ 1
New @ 0

INPUT X

T1 @ X DIV 2
T2 @ X MOD 2
New @New+T2 * Posn
Posn @Posn * 10
X @T1
is T1
>= 2?

Yes

No
New @New+T1 * Posn

OUTPUT New

END

© UCLES 2015

0478/21/O/N/15

www.dynamicpapers.com
9
Complete a trace table for each of the two input values 5 and 12.
Trace table for input value 5
X

Posn

New

T1

T2

OUTPUT

T1

T2

OUTPUT

Trace table for input value 12
X

Posn

New

[6]

(b) State the purpose of the flowchart in part (a).
[1]

© UCLES 2015

0478/21/O/N/15

[Turn over

www.dynamicpapers.com
10
4

A routine checks the weight of melons to be sold in a supermarket. Melons weighing under
0.5 kilograms are rejected and melons weighing over 2 kilograms are also rejected.
Give an example of each type of test data for this routine.
Normal
Extreme
Abnormal [3]

5

Identify two different conditional statements that you can use when writing pseudocode.
1
2 [2]

6

A picture gallery owner has decided to set up a database to keep information about the pictures
he has for sale. The database table, PICTURE, will contain the following fields:
Title; Artist; Description; Catalogue Number; Size (area in square centimetres); Price; Arrived (date
picture arrived at gallery); Sold (whether picture is already sold)
(a) (i)

State what data type you would choose for each field.
Title
Artist
Description
Catalogue Number
Size
Price
Arrived
Sold [4]

(ii)

State which field you would choose for the primary key.
[1]

© UCLES 2015

0478/21/O/N/15

www.dynamicpapers.com
11
(b) Give a validation check that you can perform on each of these fields. Each validation check
must be different.
Catalogue Number
Size
Price
Arrived [4]

(c) Complete the query-by-example grid below to select and show the Catalogue Number, Title
and Price of all unsold pictures by the artist ‘Twister’.
Field:
Table:
Sort:
Show:
Criteria:
or:
[5]

© UCLES 2015

0478/21/O/N/15

www.dynamicpapers.com
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 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

0478/21/O/N/15

Advertisement