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

Cambridge Computer Science (0478) question paper for paper 21, May/June 2022 — 0478/21/M/J/22, file 0478_s22_qp_21.pdf.

Advertisement
Loading the paper…
Text of this paper

www.dynamicpapers.com

Cambridge IGCSE™

* 3 0 6 2 8 7 9 6 9 6 *

COMPUTER SCIENCE

0478/21

Paper 2 Problem-solving and Programming

May/June 2022
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 12 pages.
DC (KN) 303743/3
© UCLES 2022

[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 following tasks before the
examination to answer Question 1.
Pre-release material
Friends of Seaview Pier is an organisation devoted to the restoration and upkeep of a pier in the
town. A pier is a wooden structure that provides a walkway over the sea. The pier requires regular
maintenance and the friends of the pier need to raise money for this purpose.
Members of Friends of Seaview Pier each pay $75 per year, as a contribution to the pier’s running costs.
This entitles them to free admission to the pier throughout the year. They can also volunteer to help run
the pier, by working at the pier entrance gate, working in the gift shop, or painting and decorating.
To provide additional income, the pier’s wooden planks can be sponsored. A brass plaque, which
contains a short message of the sponsor’s choice, is fitted to a plank on the pier, for a donation of
$200.
Write and test a program or programs for the Friends of Seaview Pier:
•
Your program or programs must include appropriate prompts for the entry of data. Data must be
validated on entry.
•
All outputs, including error messages, 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 – becoming a member of Friends of Seaview Pier
Set up a system to enable people to become members of Friends of Seaview Pier and for each new
member enter:
•
their first name and last name
•
whether or not they wish to work as a volunteer
○ if they choose to volunteer, identify the area from:
– the pier entrance gate
– the gift shop
– painting and decorating
•
the date of joining
•
whether or not they have paid the $75 fee.
All of this information needs to be stored using suitable data structures.
Task 2 – using the membership data
Extend the program in Task 1 so that a list of the first and last names of members can be output in
any of the following categories:
•
Members who have chosen to work as volunteers.
•
Volunteers who would like to work at the pier entrance gate.
•
Volunteers who would like to work in the gift shop.
•
Volunteers who would like to help with painting and decorating tasks.
•
Members whose membership has expired (they have not re-joined this year).
•
Members who have not yet paid their $75 fee.
Task 3 – sponsoring a wooden plank
Add an additional option to the program in Task 1 to enable the pier’s wooden planks to be
sponsored. Separate data structures should be used to store the names of the individuals and
the short messages they would like to have written on their brass plaque. An output would display
everything that was input for the sponsor to confirm. If errors are found, the program should allow
data to be re-entered. Once complete, the data is stored and the sponsor is charged $200.
© UCLES 2022

0478/21/M/J/22

3
1

www.dynamicpapers.com

(a) Describe the data structures you could have used in Task 1. Your description should include
types of data structure, names used for data structures, their uses and examples of sample
data.

[5]
(b) Explain how you could change your program in Task 1 to total all the money collected from
new members who have paid.

[3]
(c) Describe how data input in Task 1 could be validated to find out if a new member wants to
work as a volunteer.

[3]

© UCLES 2022

0478/21/M/J/22

[Turn over

4

www.dynamicpapers.com

(d) Write an algorithm to show how your program completes Task 3 assuming the option to
sponsor a wooden plank has been chosen, using pseudocode, programming statements or a
flowchart. Details completed in Task 1 are not required.

© UCLES 2022

0478/21/M/J/22

5

www.dynamicpapers.com

[5]
© UCLES 2022

0478/21/M/J/22

[Turn over

6

www.dynamicpapers.com

(e) Explain how your program allows any one of the member or volunteer lists to be selected and
displayed (part of Task 2). Any programming statements used in your answer must be fully
explained.

[4]

© UCLES 2022

0478/21/M/J/22

www.dynamicpapers.com

7
Section B
2

Tick (ü) one box in each row to identify the most appropriate data type for each description. Only
one tick (ü) per column.
Description

Data type
Boolean

Char

Integer

Real

String

a single character from the keyboard
multiple characters from the keyboard
only one of two possible values
only whole numbers
any number
[4]
3

Give one piece of normal test data and one piece of erroneous test data that could be used to
validate the input of an email address.
State the reason for your choice in each case.
Normal test data

Reason

Erroneous test data

Reason

[4]

© UCLES 2022

0478/21/M/J/22

[Turn over

www.dynamicpapers.com

8
4

The flowchart shows an algorithm that should allow 60 test results to be entered into the variable
Score. Each test result is checked to see if it is 50 or more. If it is, the test result is assigned to the
Pass array. Otherwise, it is assigned to the Fail array.
(a) Complete this flowchart:
START
PassCount

0

FailCount

0

Count

0

Yes

No

Count

Count + 1

No

Yes
END
[6]
© UCLES 2022

0478/21/M/J/22

9

www.dynamicpapers.com

(b) Write a pseudocode routine that will check that each test result entered into the algorithm is
between 0 and 100 inclusive.

[4]

© UCLES 2022

0478/21/M/J/22

[Turn over

www.dynamicpapers.com

10
5

The pseudocode represents an algorithm.
The pre-defined function DIV gives the value of the result of integer division.
For example, Y = 9 DIV 4 gives the value Y = 2
The pre-defined function MOD gives the value of the remainder of integer division.
For example, R = 9 MOD 4 gives the value R = 1

←
←

0
First
0
Last
INPUT Limit
1 TO Limit
FOR Counter
INPUT Value
IF Value >= 100
THEN
IF Value < 1000
THEN
Value DIV 100
First
Value MOD 10
Last
IF First = Last
THEN
OUTPUT Value
ENDIF
ENDIF
ENDIF
NEXT Counter

←

←
←

(a) Complete the trace table for the algorithm using this input data:
8, 66, 606, 6226, 8448, 642, 747, 77, 121
Counter

Value

First

Last

Limit

OUTPUT

[5]

© UCLES 2022

0478/21/M/J/22

11

www.dynamicpapers.com

(b) Describe the purpose of the algorithm.

[2]

© UCLES 2022

0478/21/M/J/22

[Turn over

www.dynamicpapers.com

12
6

A computer game shop records its stock levels in a database table called GAMES. The fields used
in the stock table are shown.

Name

Description

GameID

primary key

GameName

the name of each game

AgeRestriction

the minimum age at which a person is allowed to play each game

GamePrice

the selling price for each game

NumberStock

the quantity of each game currently in stock

OnOrder

whether or not each game is on order from the suppliers

DateLastOrdered

the date the most recent order for each game was placed

GameDescription

a summary of the contents and purpose of each game

(a) State the number of fields that are in the table GAMES.
[1]
(b) State one important fact that must be true for a field to be a primary key.

[1]
(c) Complete the query-by-example grid to output all the games that have no stock and that are
on order with the supplier. Display only the GameID, GameName and GamePrice fields in
alphabetical order of the name of the game.
Field:
Table:
Sort:
Show:
Criteria:
or:
[3]

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 Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge
Local Examinations Syndicate (UCLES), which is a department of the University of Cambridge.

© UCLES 2022

0478/21/M/J/22

Advertisement