Computer Science (0478) · Feb/March 2020 · Question paper 22
Cambridge Computer Science (0478) question paper for paper 22, Feb/March 2020 — 0478/22/F/M/20, file 0478_m20_qp_22.pdf.
Text of this paper
www.dynamicpapers.com
Cambridge IGCSE™
* 4 6 4 3 3 9 9 2 4 4 *
COMPUTER SCIENCE
0478/22
Paper 2 Problem-solving and Programming
February/March 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 (CJ/FC) 184904/3
© 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 buying service helps customers calculate the price of buying a new car from Snazzy Autos.
There are three models of car available: hatchback, saloon and estate. A car can be bought with
optional extras.
Model
Price
Optional extra
Price
Hatchback
Rs 5.35 lakh
Set of luxury seats
Rs 45000
Saloon
Rs 4.95 lakh
Satellite navigation
Rs 5500
Estate
Rs 6.25 lakh
Parking sensors
Rs 10000
Bluetooth connectivity
Rs 350
Sound system
Rs 1000
Snazzy Autos customers buying a new car can trade in an old car. Offers from Rs 10000 to
Rs 1.00 lakh can be made for an old car. If an old car is not traded in, then a discount of 5% is taken
off the price of the new car and any optional extras. In addition, repeat customers are offered a
discount of 10% off any optional extras and 10% off the price of the new car before trade-in.
Customers can either pay for the new car in full or make monthly payments over several years.
Write and test a program or programs for the car buying service.
•
•
•
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
Customers choose the model of car and select any optional extras required. Only valid choices can
be accepted for the model and the extras. The customer is asked if they are an existing customer and
if they have an old car to trade in. If the customer trades in an old car the amount offered by Snazzy
Autos is entered. The price of the new car including model and extras is displayed. Any discount or
trade-in amounts are displayed and the total price to pay is calculated and displayed.
Task 2 – Calculate the payment(s)
Extend Task 1 to display these payment methods:
•
•
•
full amount paid now customer receives cashback of 1% on the total price
equal monthly payments are made over four years with no extra charge
the total price is increased by 5%; equal monthly payments are made over seven years.
For each payment method display: the total amount to pay, the amount of each payment, the number
of payments and cashback where appropriate.
Task 3 – New full amount payment offer
Extend Task 2 to offer customers who decide to pay the full amount now either the 1% cashback or
the chosen optional extras free. Customers are shown the offer that is the best value first and the
other as an alternative. Details of each offer must be displayed in full.
© UCLES 2020
0478/22/F/M/20
3
1
www.dynamicpapers.com
All variables, constants and other identifiers must have meaningful names.
(a) State the name of one constant that you could have used for Task 1. Give the value that
would be assigned to the constant. State the use of this constant.
Constant name
Value
Use
[3]
(b) State the name of the variable that you used to store the amount offered for the trade-in of
an old car in Task 1. Give the most appropriate data type for this variable. Explain how your
program ensured that any data entered for the trade-in offer was valid.
Variable name
Data type
Validation
[4]
© UCLES 2020
0478/22/F/M/20
[Turn over
4
www.dynamicpapers.com
(c) Snazzy Autos has decided to add another model to the cars available in Task 1. The new
model is a convertible, price Rs 6.75 lakh. Explain the changes required to your program for
Task 1.
[4]
© UCLES 2020
0478/22/F/M/20
5
www.dynamicpapers.com
(d) Write an algorithm for Task 2, using either pseudocode, programming statements or a
flowchart. Assume that Task 1 has been completed.
[5]
© UCLES 2020
0478/22/F/M/20
[Turn over
6
www.dynamicpapers.com
(e) 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/22/F/M/20
7
www.dynamicpapers.com
Section B starts on page 8.
© UCLES 2020
0478/22/F/M/20
[Turn over
www.dynamicpapers.com
8
Section B
2
(a) An algorithm has been written in pseudocode to input 50 numbers. Positive numbers are
stored in the array PosNum[ ]. Negative numbers are stored in the array NegNum[ ].
Zeros are not included in the positive and negative counts.
←
0
Count
Count
PosCount
Count
NegCount
REPEAT
INPUT Number
IF Number > 0
THEN
PosCount + 1
PosCount
Number
PosNum[PosCount]
ELSE
NegCount + 1
NegCount
Number
NegNum[NegCount]
ENDIF
Count + 1
Count
UNTIL Count >= 50
OUTPUT "There are ", PosCount," positive numbers"
OUTPUT "There are ", NegCount," negative numbers"
←
←
←
←
←
←
←
Describe the error in the pseudocode and write the correction for this error.
Error
Correction
[4]
© UCLES 2020
0478/22/F/M/20
9
www.dynamicpapers.com
(b) The algorithm needs to be changed so there is no limit to how many numbers can be input.
When the number 9999 is input, the algorithm stops more numbers being input and outputs
the results. The number 9999 is not to be stored nor counted as a positive number.
Explain how you would change the algorithm.
[4]
© UCLES 2020
0478/22/F/M/20
[Turn over
www.dynamicpapers.com
10
3
This flowchart inputs student percentage marks for three examinations. If the average of these
marks is 80% or over then a distinction grade is awarded. If the average of these marks is less
than 40% then a fail grade is awarded. Otherwise a pass grade is awarded.
START
INPUT
Mark1,Mark2,Mark3
Total
Mark1 +
Mark2 + Mark3
Average
Total / 3
IS
Average >= 80 ?
No
OUTPUT
"Fail"
Yes
IS
Average < 40 ?
No
OUTPUT
"Pass"
END
© UCLES 2020
0478/22/F/M/20
Yes
OUTPUT
"Distinction"
www.dynamicpapers.com
11
(a) Complete a trace table for each set of input data:
Set 1: 88, 74, 60
Mark1
Mark2
Mark3
Total
Average
OUTPUT
Mark3
Total
Average
OUTPUT
Mark3
Total
Average
OUTPUT
Set 2: 20, 33, 67
Mark1
Mark2
Set 3: 79, 91, 70
Mark1
Mark2
[5]
(b) It has been decided to include an extra grade of Merit when the average of the marks is 60%
or more, and less than 80%. Describe the changes that will need to be made to the flowchart.
[3]
© UCLES 2020
0478/22/F/M/20
[Turn over
12
4
www.dynamicpapers.com
Explain why validation and verification checks are needed when data is input.
Include an example of each type of check in your answer.
[4]
© UCLES 2020
0478/22/F/M/20
13
www.dynamicpapers.com
Question 5 starts on page 14.
© UCLES 2020
0478/22/F/M/20
[Turn over
14
5
www.dynamicpapers.com
A database table, BOX, is used to keep a record of boxes made and sold by a craftsman. Boxes
are categorised by:
•
•
•
•
•
SIZE – small, medium or large
SHAPE – brief description for example ‘star shaped’
WOOD – maple, beech, walnut or ebony
PRICE – price in $
SOLD – whether the box is sold or not.
A database management system uses these data types:
Text
Number
Currency
Boolean
(a) Select the most appropriate data type for each field from the four types shown. State the
reason why you chose the data type.
SIZE data type
Reason
SHAPE data type
Reason
WOOD data type
Reason
PRICE data type
Reason
SOLD data type
Reason
[5]
© UCLES 2020
0478/22/F/M/20
15
(b) (i)
www.dynamicpapers.com
Complete the query-by-example grid below to only display the price of small walnut
boxes.
Field:
Table:
Sort:
Show:
Criteria:
or:
[3]
(ii)
The query-by-example grid from part (b)(i) needs to be changed to show both walnut
and beech boxes and display the wood used. Only one column needs to be changed.
Write the changed column.
Field:
Table:
Sort:
Show:
Criteria:
or:
[2]
© UCLES 2020
0478/22/F/M/20
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/22/F/M/20