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

Cambridge Computer Science (0478) question paper for paper 21, Oct/Nov 2020 — 0478/21/O/N/20, file 0478_w20_qp_21.pdf.

Advertisement
Loading the paper…
Text of this paper

www.dynamicpapers.com

Cambridge IGCSE™

* 5 2 7 8 6 0 5 5 8 3 *

COMPUTER SCIENCE

0478/21

Paper 2 Problem-solving and Programming

October/November 2020
1 hour 45 minutes

You must answer on the question paper.
No additional materials are needed.
INSTRUCTIONS
●
Answer all questions.
●
Do not attempt Tasks 1, 2 and 3 in the copy of the pre-release material on page 2; these are for
information only.
●
Use a black or dark blue pen. You may use an HB pencil for any diagrams or graphs.
●
Write your name, centre number and candidate number in the boxes at the top of the page.
●
Write your answer to each question in the space provided.
●
Do not use an erasable pen or correction fluid.
●
Do not write on any bar codes.
●
Calculators must not be used in this paper.
INFORMATION
●
The total mark for this paper is 50.
●
The number of marks for each question or part question is shown in brackets [ ].
●
No marks will be awarded for using brand names of software packages or hardware.

This document has 16 pages. Blank pages are indicated.
DC (ST/CT) 185129/2
© UCLES 2020

[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
A car insurance system allows customers to check how much it would cost to buy insurance for a car for
twelve months. The starting price of the car insurance is $500. The actual price a customer pays for the car
insurance changes depending upon this information:
• engine size of car
• value of car
• where car is kept overnight
• number of kilometres (km) driven a year
• age of driver
• years insured without an insurance claim
Engine
size in
litres

Price
change

Value in
$1000

Price
change

Kept
overnight

Price
change

1000 km
driven a
year

Price
change

Age of
driver

Price
change

Years
without
claim

Price
change

<=0.5

–5%

<0.5

–5%

Garage

–5%

<5

–5%

18–20

+100%

1

–10%

>0.5 to 1.0

0%

0.5 to 2

0%

Drive

0%

5 to 20

0%

21–25

+50%

2

–20%

>1.0 to 2.5

+5%

>2 to 10

+5%

Street

+5%

>20

+5%

26–30

+25%

3

–30%

>2.5

+10%

>10 to 20

+10%

31–70

0%

4

–40%

>20

+15%

71–80

+10%

5

–50%

>80

+20%

6

–60%

>6

–70%

Table 1

Table 2

The actual price is calculated by:
• finding the total of the percentage changes for the customer using Table 1
• applying this total percentage change to the starting price of the car insurance
• applying the years without claim discount percentage for the customer using Table 2.
Write and test a program or programs to calculate the price for a customer to insure a car.
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 – Calculate the price to insure a car.
Write a program to obtain the required information from a customer and calculate the price to insure the car.
Display the price to insure the car. Display the total percentage change calculated from Table 1, and the
years without claim discount percentage from Table 2 separately.
Task 2 – New customer discount.
Extend Task 1 to include an additional discount of 10% off the price to any new customer who is aged
between 26 and 70 inclusive, who also has 2 or more years without a claim. Display the amount of money
this would save and the new price.
Task 3 – Adding an extra driver.
Customers can add one extra driver. The age of the extra driver may increase the price. The new price is
calculated by applying the percentage price change for the age of the extra driver from Table 1 to the price.
Extend Task 2 to calculate and display the new price including an extra driver if required.

•

© UCLES 2020

0478/21/O/N/20

3
1

www.dynamicpapers.com

All variables, constants and other identifiers must have meaningful names.
(a) Identify one array that you could have used for Task 1. Give the data type and state the use
of the array.
Array
Data type
Use

[3]
(b) Data entered by a customer includes the age of the driver in Task 1.
Identify two different validation checks you could use for the age of the driver.
Justify your choice for each one.
Validation check 1

Justification

Validation check 2

Justification

[4]

© UCLES 2020

0478/21/O/N/20

[Turn over

4

www.dynamicpapers.com

(c) Write an algorithm for Task 2, using either pseudocode, programming statements or a
flowchart. Assume that Task 1 has been completed.

[6]

© UCLES 2020

0478/21/O/N/20

5
(d) (i)

www.dynamicpapers.com

Explain how your program completed Task 3. Assume that Task 2 has been completed.
Any programming statements used in your answer must be fully explained.

[4]

© UCLES 2020

0478/21/O/N/20

[Turn over

6
(ii)

www.dynamicpapers.com

The car insurance system needs updating to record the percentage of customers who
bought car insurance after obtaining a price to insure a car. Describe the changes
required to your program.

[3]

© UCLES 2020

0478/21/O/N/20

7

www.dynamicpapers.com

Section B
2

Describe the purpose of variables and constants. Use an example of each in your answer.

[4]

© UCLES 2020

0478/21/O/N/20

[Turn over

8
3

www.dynamicpapers.com

This pseudocode algorithm calculates the weight and number of bags in a load of firewood. The
weight in kilograms of each bag is input. The algorithm finishes when either 50 bags have been
weighed, or as soon as the total weight exceeds 1000 kilograms. Only then are the total weight
and the number of bags in the load output.
01
02
03
04
05
06
07
08
09
10
11
12

←
←
←
←

1000
TotalWeight
0
BagCount
50
MaxBag
1000
MaxWeight
REPEAT
OUTPUT "Please Enter weight of bag"
INPUT Weight
TotalWeight + Weight
TotalWeight
BagCount + 1
BagCount
OUTPUT "Number of bags in the load is ", BagCount
UNTIL TotalWeight > MaxWeight AND BagCount >= MaxBag
OUTPUT "Total weight of the load is ", MaxWeight

←

←

(a) Give the line number(s) from the algorithm of:
an assignment statement
a loop
a counting statement
a totalling statement
[4]
(b) Give the line numbers of the four errors in this pseudocode. Suggest a correction for each
error.
Error 1 line number
Correction

Error 2 line number
Correction

Error 3 line number
Correction

Error 4 line number
Correction

[4]
© UCLES 2020

0478/21/O/N/20

9

www.dynamicpapers.com

(c) Explain how you could extend the algorithm to calculate and display the average weight of a
bag of firewood in the load.

[4]

© UCLES 2020

0478/21/O/N/20

[Turn over

www.dynamicpapers.com

10
4

This flowchart inputs five numbers and performs a calculation.
The predefined function MOD finds the remainder from integer division for example
25 MOD 11 gives R a value of 3
R

←

START

INPUT
V,W,X,Y,Z

IS
V = 0?

Yes

No
A

← V*2 + W*3 + X*4 + Y*5
B

OUTPUT
"Valid"

Yes

← A MOD 11
IS
B = Z?

No
OUTPUT
"Invalid"

© UCLES 2020

0478/21/O/N/20

END

11

www.dynamicpapers.com

(a) Complete the trace table for this set of input data:
5, 4, 6, 2, 1, 9, 3, 2, 1, 6, 7, 6, 1, 5, 1, 0, 0, 0, 0, 0
V

W

X

Y

Z

A

B

OUTPUT

[4]
(b) Describe the purpose of this flowchart.

[2]

© UCLES 2020

0478/21/O/N/20

[Turn over

12
5

www.dynamicpapers.com

A database table, AIRLINE, stores data used to compare airlines.
Code

Airline name

Number of
employees

Number of
countries

Head office

Share price

FJ

FastJet

60000

30

Europe

514.50

MA

MurphyAir

35000

8

Europe

152.67

JS

JetSeven

45000

22

Asia

257.44

K3

Koala3

22000

11

Australia

501.21

NS

NorthState

30000

4

America

108.22

SS

SouthState

30000

4

America

126.35

BJ

BlueJet

15000

7

Africa

215.45

SK

SkyKing

32000

27

Europe

506.12

PF

PandaFly

50000

35

Asia

317.88

(a) State how many fields and how many records are shown in the AIRLINE table.
Number of Fields
Number of Records
[2]
(b) Show the output that would be given by this query-by-example.
Field: Airline name

Number of employees

Head office

Share price

Table: AIRLINE

AIRLINE

AIRLINE

AIRLINE

Sort:
Show:

3

3

Criteria:

< 35000

> 500.00

or:

[2]

© UCLES 2020

0478/21/O/N/20

13

www.dynamicpapers.com

(c) Complete the query-by-example grid to find every airline with a head office in Asia or Africa,
and number of countries greater than 4. Only show the airline name and number of countries.
Field:
Table:
Sort:
Show:
Criteria:
or:
[4]

© UCLES 2020

0478/21/O/N/20

14
BLANK PAGE

© UCLES 2020

0478/21/O/N/20

www.dynamicpapers.com

15
BLANK PAGE

© UCLES 2020

0478/21/O/N/20

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 2020

0478/21/O/N/20

Advertisement