Computer Science (2210) · May/June 2020 · Question paper 21

Cambridge Computer Science (2210) question paper for paper 21, May/June 2020 — 2210/21/M/J/20, file 2210_s20_qp_21.pdf.

Advertisement
Loading the paper…
Text of this paper

www.dynamicpapers.com

Cambridge O Level

* 0 1 8 2 9 7 2 4 6 2 *

COMPUTER SCIENCE

2210/21

Paper 2 Problem-solving and Programming

May/June 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 (JP) 198770
© UCLES 2020

[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
A shop sells a range of mobile devices, SIM cards and accessories as shown in the table:
Category
Phone
Phone
Phone
Phone
Phone
Phone
Tablet
Tablet
Tablet
Tablet
SIM card
SIM card
Case
Case
Charger
Charger

Item code
BPCM
BPSH
RPSS
RPLL
YPLS
YPLL
RTMS
RTLM
YTLM
YTLL
SMNO
SMPG
CSST
CSLX
CGCR
CGHM

Description
Compact
Clam Shell
RoboPhone – 5-inch screen and 64 GB memory
RoboPhone – 6-inch screen and 256 GB memory
Y-Phone Standard – 6-inch screen and 64 GB memory
Y-Phone Deluxe – 6-inch screen and 256 GB memory
RoboTab – 8-inch screen and 64 GB memory
RoboTab – 10-inch screen and 128 GB memory
Y-Tab Standard – 10-inch screen and 128 GB memory
Y-Tab Deluxe – 10-inch screen and 256 GB memory
SIM Free (no SIM card purchased)
Pay As You Go (SIM card purchased)
Standard
Luxury
Car
Home

Price ($)
29.99
49.99
199.99
499.99
549.99
649.99
149.99
299.99
499.99
599.99
0.00
9.99
0.00
50.00
19.99
15.99

Write and test a program or programs for this shop.

•
•
•

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 arrays, 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 system.
Write a program to:
•
use appropriate data structures to store the item code, description and price information for the
mobile devices, SIM cards and accessories
•
allow the customer to choose a specific phone or tablet
•
allow phone customers to choose whether the phone will be SIM Free or Pay As You Go
•
allow the customer to choose a standard or luxury case
•
allow the customer to choose the chargers required (none, one or both may be purchased)
•
calculate the total price of this transaction
•
output a list of the items purchased and the total price.
Task 2 – Allow a customer to order multiple mobile devices.
Extend Task 1 to:
•
offer the customer the opportunity to purchase an additional mobile device
•
if required, perform bulleted steps 2 to 7 of Task 1 for each additional mobile device and
calculate a running total for the customer
•
once no further devices are required, output the total the customer will need to pay.
Task 3 – Offering discounts.
Extend the program to allow a discount of 10% off the price of every additional phone or tablet
purchased.
Output the new total the customer will need to pay and the amount of money saved.
© UCLES 2020

2210/21/M/J/20

3
1

www.dynamicpapers.com

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

Identify two arrays you could have used for Task 1 and, in each case, state its purpose.
Array 1
Purpose

Array 2
Purpose

[4]

(ii)

Identify two variables you could have used for Task 1 and, in each case, state its
purpose.
Variable 1
Purpose

Variable 2
Purpose

[4]

(b) Explain why the item code data could not be stored as a real data type and identify the most
suitable data type for the item code data.

[2]
© UCLES 2020

2210/21/M/J/20

[Turn over

4

www.dynamicpapers.com

(c) Write an algorithm to show how you input your choice of mobile device and SIM card (part of
Task 1), using either pseudocode, programming statements or a flowchart. It is not necessary
to show initialisation or setting up of arrays containing product details.

© UCLES 2020

2210/21/M/J/20

5

www.dynamicpapers.com

[5]
© UCLES 2020

2210/21/M/J/20

[Turn over

6

www.dynamicpapers.com

(d) Explain how your program completes Task 3. Any programming statements used in your
answer must be fully explained.

[5]

© UCLES 2020

2210/21/M/J/20

7

www.dynamicpapers.com

Section B starts on page 8.

© UCLES 2020

2210/21/M/J/20

[Turn over

8

www.dynamicpapers.com

Section B
2

Tick (ü) one box in each row to identify if the statement about structure diagrams is true or false.
Statement

True
(ü)

False
(ü)

A structure diagram is a piece of code that is available throughout the
structure of a program.
A structure diagram shows the hierarchy of a system.
A structure diagram is another name for an array.
A structure diagram shows the relationship between different components
of a system.
[2]
3

Programs can perform validation and verification checks when data is entered.
(a) Give the names of two different validation checks and state the purpose of each one.
Check 1
Purpose

Check 2
Purpose

[4]
(b) Give the name of one verification check.
[1]
(c) Describe the difference between validation and verification.

[2]

© UCLES 2020

2210/21/M/J/20

9
4

www.dynamicpapers.com

The pseudocode algorithm shown should allow numbers to be entered and should allow
50 numbers to be stored in an array.

←

0
Count
REPEAT
INPUT Values[Count]
Count + 1
Count
UNTIL Count = 0

←

(a) Explain why the algorithm will never end.

[2]
(b) Re-write the original pseudocode so that it terminates correctly and also prevents numbers
below 100 from being stored in the array Values[ ]

[4]
(c) Describe how you could change your pseudocode in part (b) so that it prevents numbers
below 100 and above 200 from being stored in the array Values[ ]

[2]

© UCLES 2020

2210/21/M/J/20

[Turn over

10
5

www.dynamicpapers.com

The flowchart represents an algorithm.
The predefined function DIV gives the value of the result of integer division,
9 DIV 4 gives y a value of 2
for example, y

←

An input value of –1 ends the algorithm.

START

INPUT
Value

IS
Value =
-1 ?

Yes

No

No

Calc1

Value DIV 2

Calc2

Value DIV 3

IS
Calc1 =
Value / 2 ?
Yes

No

IS
Calc2 =
Value / 3 ?
Yes
OUTPUT
Value

© UCLES 2020

2210/21/M/J/20

END

11

www.dynamicpapers.com

(a) Complete the trace table for the input data:
50, 33, 18, 15, 30, –1, 45, 12, 90, 6
Value

Calc1

Calc2

OUTPUT

[4]
(b) Describe the purpose of the algorithm.

[2]

© UCLES 2020

2210/21/M/J/20

[Turn over

12
6

www.dynamicpapers.com

A garden centre sells garden tools and stores details of these in a database table named TOOLS.
Code is the primary key in the TOOLS table.
Code

Description

Price ($)

Quantity_Stock

Quantity_Ordered

GFLG

Garden Fork

50.00

1

50

GSLG

Garden Spade

50.00

11

0

GHLG

Garden Hoe

45.00

8

0

HFSM

Hand Fork

9.99

42

0

HSSM

Hand Spade

9.99

40

0

HWSM

Hand Weeder

9.99

11

0

HS20

Hose (20 metres)

45.00

10

0

HS35

Hose (35 metres)

60.00

2

0

HS50

Hose (50 metres)

75.00

20

60

YBLG

Yard Brush

24.99

100

0

LMHD

Lawn Mower

99.99

5

0

LMBT

Lawn Mower (Battery)

249.99

7

0

LMPT

Lawn Mower (Petrol)

349.99

10

25

TRBT

Edge Trimmer (Battery)

79.99

15

0

TRPT

Edge Trimmer (Petrol)

59.99

20

0

SHSM

Shears

40.00

40

0

HCSM

Hedge Clippers

40.00

45

0

(a) State the purpose of the primary key in the TOOLS table.

[1]

© UCLES 2020

2210/21/M/J/20

13

www.dynamicpapers.com

(b) List the output from the data shown in the table TOOLS that would be given by this query-byexample.
Field:

Code

Description

Price ($)

Quantity_Stock

Quantity_Ordered

Table:

TOOLS

TOOLS

TOOLS

TOOLS

TOOLS

Sort:

Descending

Show:

ü

Criteria:

ü

ü
>40

>0

>0

or:

[3]
(c) Complete the query-by-example grid to output the tools where the quantity in stock is below
25. Only show the Code, Description and Quantity_Stock fields in ascending order of Code.
Field:
Table:
Sort:
Show:
Criteria:
or:
[3]

© UCLES 2020

2210/21/M/J/20

14
BLANK PAGE

© UCLES 2020

2210/21/M/J/20

www.dynamicpapers.com

15
BLANK PAGE

© UCLES 2020

2210/21/M/J/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

2210/21/M/J/20

Advertisement