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

Cambridge Computer Science (0478) question paper for paper 21, Oct/Nov 2019 — 0478/21/O/N/19, file 0478_w19_qp_21.pdf.

Advertisement
Loading the paper…
Text of this paper

www.dynamicpapers.com

Cambridge Assessment International Education
Cambridge International General Certificate of Secondary Education

* 8 6 4 9 8 3 8 3 6 1 *

0478/21

COMPUTER SCIENCE
Paper 2 Problem-solving and Programming

October/November 2019
1 hour 45 minutes

Candidates answer on the Question Paper.
No Additional Materials are required.
No calculators allowed.
READ THESE INSTRUCTIONS FIRST
Write your centre number, candidate number and name in the spaces at the top of this page.
Write in dark blue or black pen.
You may use an HB pencil for any diagrams, graphs or rough working.
Do not use staples, paper clips, glue or correction fluid.
DO NOT WRITE IN ANY BARCODES.
Answer all questions.
DO NOT ATTEMPT TASKS 1, 2 AND 3 in the pre-release material; these are for information only.
You are advised to spend no more than 40 minutes on Section A (Question 1).
No marks will be awarded for using brand names of software packages or hardware.
Any businesses described in this paper are entirely fictitious.
At the end of the examination, fasten all your work securely together.
The number of marks is given in brackets [ ] at the end of each question or part question.
The maximum number of marks is 50.

This syllabus is regulated for use in England, Wales and Northern Ireland as a Cambridge International Level 1/Level 2 Certificate.

This document consists of 11 printed pages and 1 blank page.
DC (NH) 162395/3
© UCLES 2019

[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
You have been asked to write a program to calculate the area of a patio and the cost of the stone slabs
needed to cover it. The program should work for any patio that can be represented as a rectangle, or
group of rectangles that are joined together, and only one type of stone slab may be used.
Type of stone slab

Price per square metre

Dover

$30.00

Exeter

$35.00

London

$42.00

Portland

$49.50

Shaftesbury

$55.00

York

$62.75

Write and test a program or programs to calculate the cost of the stone slabs for a patio.

•
•
•

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 – Setting up the system for a simple rectangular patio.
Set up your program to:
•
Store the type and price per square metre of the stone slabs using a suitable programming technique.
•
Prompt and allow the user to input the length and width of their patio and the type of stone slab they
would like.
•
Calculate and display the number of square metres of stone slabs required, rounded up to the next
whole square metre, and the total cost of the stone slabs.
Task 2 – Working on more complex shapes.
Assuming that a patio can be made up of a group of rectangles, extend your program to:
•
Enter the number of rectangles making up the patio and the type of stone slab to be used.
•
Allow the dimensions for each rectangle to be entered.
•
Calculate and display the total area of the patio rounded up to the next whole square metre.
•
Calculate and display the total cost of the stone slabs.
Task 3 – Allowing for waste.
It is likely that some of the stone will not be useable, so it is sensible to allow a percentage for wastage,
for example, 10%. Alter your program to allow the user to input a percentage to calculate wastage and
add this to the number of square metres of stone slabs to be purchased, rounded up to the next whole
square metre. Display the revised total area and cost.
© UCLES 2019

0478/21/O/N/19

3
1

www.dynamicpapers.com

(a) All variables, constants and other identifiers must have meaningful names.
Name two variables that you could have used for Task 1. State the data type and purpose of
each variable.
Variable 1 name
Data type
Purpose

Variable 2 name
Data type
Purpose

[6]
(b) Describe how arrays could be used to store the data about the types and price per square
metre of the stone slabs for Task 1.

[2]

© UCLES 2019

0478/21/O/N/19

[Turn over

4

www.dynamicpapers.com

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

© UCLES 2019

0478/21/O/N/19

5

www.dynamicpapers.com

[5]
© UCLES 2019
0478/21/O/N/19
[Turn over

6

www.dynamicpapers.com

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

[3]
© UCLES 2019

0478/21/O/N/19

7

www.dynamicpapers.com

(e) Name two validation checks that could be used when entering patio dimensions in Task 1 or
Task 2 and describe their purpose.
Validation check 1
Purpose

Validation check 2
Purpose

[4]

© UCLES 2019

0478/21/O/N/19

[Turn over

8

www.dynamicpapers.com

Section B
2

For each of the four descriptions in the table, place a tick in the correct column to show whether it
describes a Structure diagram, a Flowchart or Library routines.
Structure
diagram

Description

Flowchart

Library
routines

A modelling tool used to show the hierarchy of a
system.
A collection of standard programs available for
immediate use.
A graphical representation used to represent an
algorithm.
A graphical representation to show how a system is
broken into sub-systems.
[4]
3

Examine the following pseudocode:
INPUT A
INPUT B
INPUT C
INPUT D
INPUT E
INPUT F
INPUT G
INPUT H
INPUT I
INPUT J
INPUT K
INPUT L
A + B + C + D + E + F + G + H + I + J + K + L
T
OUTPUT "The average equals ", T / 12
(a) Describe what happens in this pseudocode.

[3]

© UCLES 2019

0478/21/O/N/19

9

www.dynamicpapers.com

(b) Describe how this pseudocode could be altered to allow any number of values to be input.

[3]
(c) Re-write the given pseudocode to allow any number of values to be input.

[5]

© UCLES 2019

0478/21/O/N/19

[Turn over

10
4

www.dynamicpapers.com

(a) Complete the trace table for this algorithm using the given input data.
0
Index
0 TO 7
FOR Count
INPUT Value
IF Value > 50
THEN
Value
PassMarks[Index]
Index + 1
Index
ENDIF
NEXT Count
PRINT "Number passed ", Index
Input data: 58, 40, 67, 85, 12, 13, 75, 82
PassMarks

Index Count Value [0] [1] [2] [3] [4] [5] [6] [7]

OUTPUT

[6]
(b) Give the purpose of the algorithm shown in part (a).

[1]

© UCLES 2019

0478/21/O/N/19

11
5

www.dynamicpapers.com

A car manufacturer makes a range of car models named Pegasus, Apollo and Cupid. It keeps a
database to store the records of its range and the different options for each car model. Within the
table CAR_RANGE, the following data needs to be stored:
1.
2.
3.
4.
5.

Car model
Body style – saloon, hatchback or estate
How many doors it has
Whether it uses petrol, diesel or batteries as fuel
An identifier for a specific car.

(a) Complete the table to show suitable field names and an example of appropriate data for each
field in the database table CAR_RANGE.
Field name

Example of data

[3]
(b) State which of your fields would be most appropriate for a primary key and give a reason for
your choice.

[2]
(c) Complete the query-by-example grid to provide a list of car models using petrol and the
number of doors these cars have, in alphabetical order of car model. Display only the car
models and the number of doors.
Field:
Table:
Sort:
Show:
Criteria:
or:
[3]

© UCLES 2019

0478/21/O/N/19

12

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 2019

0478/21/O/N/19

Advertisement