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

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

Advertisement
Loading the paper…
Text of this paper

www.dynamicpapers.com

Cambridge IGCSE™

* 0 4 0 5 0 8 6 6 6 5 *

COMPUTER SCIENCE

0478/23

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/JG) 185347/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 baguette ordering service allows customers to order filled baguettes. There are two sizes of
baguette: 30 cm and 15 cm. Baguettes are available as white, brown or seeded bread. Baguettes
have one filling and can have up to three salad items added.
Filling and salad choices are:
Filling

Salad

Beef
Chicken
Cheese
Egg
Tuna
Turkey

Lettuce
Tomato
Sweetcorn
Cucumber
Peppers

Customers choose their baguette options. They then confirm their order, alter their choices or choose
not to proceed.
Each day the ordering service calculates the number of each:
•
size of baguette sold
•
type of bread (white, brown or seeded) sold
•
filling sold.
Write and test a program or programs for the baguette ordering 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 – Ordering.
Customers are given choices on size, type of bread, filling and salad items as shown. Only valid
choices can be accepted. The customer is asked to confirm their order, alter their choices or choose
not to proceed. If the customer confirms their order they are given a unique order number. Display
the baguette ordered and the order number.
Task 2 – Recording the choices.
Extend TASK 1 to record totals for the size, types of bread and fillings sold that day and calculate
the total number of baguettes sold that day.
Task 3 – Finding the most and least popular baguette fillings.
Using your results from TASK 2, display the most popular and least popular fillings as a percentage
of the total number of baguettes sold that day.
© UCLES 2020

0478/23/O/N/20

3
1

www.dynamicpapers.com

All variables, constants and other identifiers must have meaningful names.
(a) Identify one constant and identify one variable that you could have used for Task 1. Give the
value that would be assigned to the constant. Give the data type for the variable. State what
each one could be used for.
Constant
Value
Use

Variable
Data type
Use

[6]
(b) (i)

Write an algorithm to allow a customer to choose the filling and salad items for their
baguette (part of Task 1), using either pseudocode, programming statements or a
flowchart. Your algorithm must only include this part of Task 1.

© UCLES 2020

0478/23/O/N/20

[Turn over

4

www.dynamicpapers.com

© UCLES 2020

0478/23/O/N/20

5

www.dynamicpapers.com

[5]
(ii)

Explain how your algorithm in part (b)(i) ensured that only valid choices were accepted
for the filling.

[3]

(c) Explain how you would need to change your program for Task 1 if there were three sizes of
baguette to choose from (15 cm, 20 cm and 30 cm).

[2]

© UCLES 2020

0478/23/O/N/20

[Turn over

6

www.dynamicpapers.com

(d) 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/23/O/N/20

7

www.dynamicpapers.com

Section B starts on Page 8.

© UCLES 2020

0478/23/O/N/20

[Turn over

8

www.dynamicpapers.com

Section B
2

An algorithm has been written in pseudocode to check the temperature readings taken from a
freezer are within the range –18 degrees to –25 degrees inclusive.
The algorithm counts the number of times that the temperature reading is below –25 degrees and
the number of times that the temperature reading is above –18 degrees.
An engineer is called if there are more than 10 temperature readings below –25 degrees.
An alarm sounds if there are more than 5 temperature readings above –18 degrees.
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22

0
TooHot
1000
TooCold
REPEAT
OUTPUT "Please enter temperature"
INPUT Temperature
IF Temperature < -25
THEN
TooCold – 1
TooCold
ENDIF
IF Temperature > -18
THEN
TooHot + 1
TooHot
ENDIF
UNTIL TooHot > 5 OR TooCold > 10
IF TooHot < 5
THEN
INPUT "Alarm!!"
ENDIF
IF TooCold > 10
THEN
OUTPUT "Call the Engineer"
ENDIF

(a) Give the line number(s) from the algorithm of:
an assignment statement
a loop
a counting statement
a selection statement
[4]

© UCLES 2020

0478/23/O/N/20

9

www.dynamicpapers.com

(b) Give line numbers where the four errors are to be found in the 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]
(c) Explain how you could extend the algorithm to count the number of times the temperature
readings are within the range –18 degrees to –25 degrees inclusive.

[4]

© UCLES 2020

0478/23/O/N/20

[Turn over

www.dynamicpapers.com

10
3

Four programming concepts and five descriptions are shown.
Draw a line to connect each Programming concept to its correct Description. Not all Descriptions
will be connected to a Programming concept.
Programming concept

Description

Validation

A subroutine that does not have to
return a value

Verification

An automatic check to ensure that data
input is reasonable and sensible

A subroutine that always returns
a value
Procedure
An overview of a program or subroutine

Function

A check to ensure that data input
matches the original
[4]

© UCLES 2020

0478/23/O/N/20

11

www.dynamicpapers.com

Question 4 starts on Page 12.

© UCLES 2020

0478/23/O/N/20

[Turn over

www.dynamicpapers.com

12
4

This flowchart represents an algorithm that allows the input of two numbers and performs a
calculation.
The predefined function MOD finds the remainder from integer division for example X
gives X a value of 3.

8 MOD 5

START

INPUT
Y,Z

IS
Y = 0?

Yes

END

No

IS
Y > Z?
No

A

OUTPUT
"Valid"

Yes

Z MOD Y

IS
A = 0?
No

OUTPUT
"Invalid"
© UCLES 2020

0478/23/O/N/20

Yes

A

Y MOD Z

13

www.dynamicpapers.com

(a) Complete a trace table for this set of input data:
11, 4, 6, 2, 3, 9, 3, 2, 2, 6, 0, 0, 1, 1
Y

Z

A

OUTPUT

[4]
(b) Explain the purpose of this algorithm.

[2]

© UCLES 2020

0478/23/O/N/20

[Turn over

14
5

www.dynamicpapers.com

A marine wildlife rescue centre uses a database table, MARINE, to keep records of its creatures.
Creature

Class

Quantity

Ready for release

Offspring

Manta Ray

Fish

3

Y

N

Short-tailed Albatross

Bird

4

Y

N

Emperor Penguin

Bird

50

Y

Y

Bluefin Tuna

Fish

2

N

N

Manatee

Mammal

4

Y

N

Hawksbill Turtle

Reptile

10

Y

Y

Hammerhead Shark

Fish

3

Y

N

Yellow-eyed Penguin

Bird

4

Y

N

Kemp’s Ridley Sea Turtle

Reptile

1

Y

N

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

Class

Ready for release

Table: MARINE

MARINE

MARINE

Sort:
Show:
Criteria:

3

3
="Bird"

or:

[2]

© UCLES 2020

0478/23/O/N/20

15

www.dynamicpapers.com

(c) Complete the query-by-example grid to display the creatures, in ascending order of quantity,
that have no offspring and are ready for release. Display only the creature field.
Field:
Table:
Sort:
Show:
Criteria:
or:
[4]

© UCLES 2020

0478/23/O/N/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/23/O/N/20

Advertisement