Computer Science (0478) · May/June 2019 · Question paper 21

Cambridge Computer Science (0478) question paper for paper 21, May/June 2019 — 0478/21/M/J/19, file 0478_s19_qp_21.pdf.

Advertisement
Loading the paper…
Text of this paper

www.dynamicpapers.com

Cambridge Assessment International Education
Cambridge International General Certificate of Secondary Education

* 2 5 0 9 2 3 6 3 9 5 *

0478/21

COMPUTER SCIENCE

May/June 2019

Paper 2 Problem-solving and Programming

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.
Any businesses described in this paper are entirely fictitious.
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 syllabus is regulated for use in England, Wales and Northern Ireland as a Cambridge International Level 1/Level 2 Certificate.

This document consists of 13 printed pages and 3 blank pages.
DC (SC) 162367/3
© UCLES 2019

[Turn over

2

www.dynamicpapers.com

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
The local high school uses buses to transport students to school. There are six bus routes labelled A to F. You have
conducted a survey to analyse the punctuality statistics of these buses over a four-week period. The data from the
survey are shown in the table:
Day
Mon1
Tue1
Wed1
Thu1
Fri1
Mon2
Tue2
Wed2
Thu2
Fri2
Mon3
Tue3
Wed3
Thu3
Fri3
Mon4
Tue4
Wed4
Thu4
Fri4

Bus A
0
0
0
2
2
4
0
3
4
−2
−5
0
0
3
4
−1
8
1
1
−2

Bus B
0
1
0
0
1
2
0
0
0
0
1
0
0
0
2
0
0
1
0
0

Punctuality table
Bus C
Bus D
2
1
0
0
−1
0
−1
0
−2
0
−2
0
−3
0
−1
0
0
0
0
0
−2
2
0
0
1
0
1
0
1
0
1
0
−1
0
−1
0
2
0
−2
0

Bus E
−1
−1
−1
−2
−4
−10
−2
0
0
0
0
1
2
−3
1
1
3
−1
0
0

Bus F
0
−5
−5
−5
−4
−3
−5
0
0
0
0
−2
−3
1
1
1
0
0
−2
−5

Positive numbers represent minutes early, negative numbers represent minutes late and 0 represents the bus having
been on time.
Write and test a program or programs for the local high school.

•
•
•

Your program or programs must include appropriate prompts for the entry of data; data must be validated on
entry.
Error messages and other output need to be set out clearly and understandably.
All variables, constants and other identifiers must have meaningful names.

You will need to complete these three tasks. Each task must be fully tested.
Task 1 – Setting up the data storage.
Using arrays set up a system to enable data for each bus route to be entered covering each day of a four-week
period. It must be possible to enter the data supplied or your own set of data, using suitable prompts as necessary.
Task 2 – Working out the statistics.
Extend your program so that the following statistics for the four-week period may be calculated and output:
•
the number of late arrivals for each bus route
•
the average number of minutes late for each bus route
•
the bus route with the highest number of days on which it was late
•
the average number of minutes late for each bus route, using only data from days on which it was late
All the results should be displayed with appropriate annotation.
Task 3 – Checking specific days.
Extend the program as follows:
•
Allow the user to input a specific day, for example Fri3, to be used for analysis of data.
•
Find and display how many buses were late on this particular day.
•
For each late bus, display the route label and how late the bus was on this particular day.
© UCLES 2019

0478/21/M/J/19

3
1

www.dynamicpapers.com

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

State one array you used for Task 1. State the data type and purpose of this array.
Array
Data type
Purpose

[3]

(ii)

State one variable you used for Task 2 and one variable you used for Task 3. In each
case, state the data type and purpose of the variable.
Task 2 variable name
Data type
Purpose

Task 3 variable name
Data type
Purpose

[6]

© UCLES 2019

0478/21/M/J/19

[Turn over

4

www.dynamicpapers.com

(b) Write an algorithm to show how you calculated and output the number of late arrivals and the
average number of minutes late for each bus route (part of Task 2), using either pseudocode,
programming statements or a flowchart.

© UCLES 2019

0478/21/M/J/19

5

www.dynamicpapers.com

[6]
© UCLES 2019

0478/21/M/J/19

[Turn over

6

www.dynamicpapers.com

(c) Explain how your program uses the input in Task 3 to only find the data for that specific day
(part of Task 3). Any programming statements used in your answer must be fully explained.

[3]

© UCLES 2019

0478/21/M/J/19

7

www.dynamicpapers.com

(d) Explain how you would alter your program in Task 1 to allow you to choose the number of
weeks to enter data on bus arrival times.

[2]

© UCLES 2019

0478/21/M/J/19

[Turn over

8

www.dynamicpapers.com

Section B
2

Describe each of the following data types used in programming. In each case, give an example of
a piece of data to illustrate your answer. Each example must be different.
Char

String

Boolean

[6]

3

(a) Give an example of a conditional statement using pseudocode.

[2]
(b) Describe the purpose of a conditional statement.

[2]

© UCLES 2019

0478/21/M/J/19

9

www.dynamicpapers.com

Question 4 starts on page 10.

© UCLES 2019

0478/21/M/J/19

[Turn over

10
4

www.dynamicpapers.com

This section of program code may be used as a validation check.
1
2
3
4
5
6
7

PRINT "Input a value between 0 and 100 inclusive"
INPUT Value
WHILE Value < 0 OR Value > 100
PRINT "Invalid value, try again"
INPUT Value
ENDWHILE
PRINT "Accepted: ", Value

(a) Give a name for this type of validation check.
[1]
(b) Describe what is happening in this validation check.

[2]
(c) Complete the trace table for this program code using the test data: 200, 300, –1, 50, 60

Value

OUTPUT

[3]

© UCLES 2019

0478/21/M/J/19

11

www.dynamicpapers.com

(d) Draw a flowchart to represent this section of program code.

[5]

© UCLES 2019

0478/21/M/J/19

[Turn over

www.dynamicpapers.com

12
5

The table, BEVERAGES, shows the number of calories in 100 ml of a range of popular beverages.
It also shows the availability of these drinks in a can, a small bottle and a large bottle.
BevNo

BevName

Calories

Can

Small Bottle

Large Bottle

Bev01

Cola

40

Yes

Yes

Yes

Bev02

Lime

45

Yes

No

Yes

Bev03

Energy Drink 1

52

Yes

Yes

No

Bev04

Energy Drink 2

43

Yes

No

No

Bev05

Mango

47

Yes

No

Yes

Bev06

Lemon Iced Tea

38

Yes

No

Yes

Bev07

Lemonade

58

Yes

Yes

Yes

Bev08

Orange Juice

46

Yes

Yes

No

Bev12

Apple Juice

50

Yes

Yes

No

Bev15

Chocolate Milk

83

Yes

Yes

No

(a) Give a reason for choosing BevNo as the primary key for this table.

[1]
(b) State the number of records shown in the table BEVERAGES.
[1]

© UCLES 2019

0478/21/M/J/19

www.dynamicpapers.com

13

(c) List the output that would be given by this query-by-example.
Field:

BevNo

BevName

Can

Small Bottle

Large Bottle

Table:

BEVERAGES

BEVERAGES

BEVERAGES

BEVERAGES

BEVERAGES

= "Yes"

= "Yes"

= "Yes"

Sort:

Descending

Show:

ü

Criteria:

ü

or:

[3]
(d) Complete the query-by-example grid to output a list showing just the names and primary keys
of all the beverages with a calorie count greater than 45. The list should be in alphabetical
order of names.
Field:
Table:
Sort:
Show:
Criteria:
or:
[4]

© UCLES 2019

0478/21/M/J/19

14
BLANK PAGE

© UCLES 2019

0478/21/M/J/19

www.dynamicpapers.com

15
BLANK PAGE

© UCLES 2019

0478/21/M/J/19

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
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 2019

0478/21/M/J/19

Advertisement