Computer Science (0478) · May/June 2018 · Question paper 23

Cambridge Computer Science (0478) question paper for paper 23, May/June 2018 — 0478/23/M/J/18, file 0478_s18_qp_23.pdf.

Advertisement
Loading the paper…
Text of this paper

www.dynamicpapers.com

Cambridge International Examinations
Cambridge International General Certificate of Secondary Education

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

0478/23

COMPUTER SCIENCE

May/June 2018

Paper 2 Problem-solving and Programming

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 approved 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/FC) 148635/3
© UCLES 2018

[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 car park has space for 100 cars and a barrier entrance and exit system. There is a display at the
entrance to show how many spaces are empty. Cars are issued a ticket with a unique number on entry
and the time of issue is stored. The car park charges $1.50 per hour and the fee is paid at a machine
before leaving the car park. At the machine, the ticket number and departure time are entered; the fee is
calculated by the machine and the amount due is paid by the ticket holder. Cars cannot stay overnight; the
system is reset at midnight.
Write and test a program or programs for the car park manager.

•
•
•

Your program or programs must include appropriate prompts for the entry of data.
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 – Operating the car park.
The system is reset at midnight every day.
Set up a system using arrays and with suitable prompts that will carry out the following as cars enter or
leave the car park:
On Entry:
•
display the number of empty car park spaces
•
issue the next available ticket number
•
store the current time and the ticket number
•
display the updated number of empty car park spaces.
On Exit:
•
input a ticket number and departure time
•
output the amount of time the car stayed at the car park
•
delete the ticket number from the array
•
display the updated number of empty car park spaces.
TASK 2 – Working out the cost and daily takings.
Amend the program so that it will calculate the amount to be paid using a charge of $1.50 per hour, or
part of an hour (i.e. any amount of time into the next hour is charged for a whole hour). The amount to be
paid is displayed and is added to a running total for the day, before the ticket number is deleted from the
array. At the end of the day, the following information is displayed:
•
total daily takings
•
number of cars that have used the car park
•
average charge per car
•
average length of stay per car.
TASK 3 – Introducing parking restrictions.
The car park manager decides to restrict the length of stay to a maximum of eight hours, and will charge
an extra $100 if a car overstays. Modify your program to implement this change and ensure the driver is
aware of this extra charge. Output the number of cars that have overstayed in a day.
© UCLES 2018

0478/23/M/J/18

3
1

www.dynamicpapers.com

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

State the name, data type and use of two arrays you created for Task 1.
Array 1 name
Data type
Use

Array 2 name
Data type
Use

[4]

(ii)

State the name, value and use of two constants you could have created for Task 3.
Constant 1 name
Value
Use

Constant 2 name
Value
Use

[4]

© UCLES 2018

0478/23/M/J/18

[Turn over

4

www.dynamicpapers.com

(b) Write an algorithm to perform the set up and ‘On Entry’ part of Task 1, using either pseudocode,
programming statements or a flowchart.

[6]

© UCLES 2018

0478/23/M/J/18

5

www.dynamicpapers.com

(c) Explain how your program calculates if a car has overstayed the permitted parking time and
how the charge is calculated and output (part of Task 3). Any programming statements you
use in your answer must be fully explained.

[4]
(d) One of the inputs required ‘On Exit’ in Task 1 is ticket number. State two items of suitable test
data you could use to test your input validation and state why you chose them.
Test data 1
Reason

Test data 2
Reason

[2]

© UCLES 2018

0478/23/M/J/18

[Turn over

6

www.dynamicpapers.com

Section B
2

Describe, using an example, the purpose of the following checks during data entry.
(a) Validation check

[2]
(b) Verification check

[2]

3

This section of program code reads the contents of the array, totals the numbers and prints out the
sum and average of the numbers. Assume the array is full.
Complete the four missing items by writing them in the spaces provided in this code.
1

Numbers[1:30]

2

Total = 0

3

= 0

4

FOR Count = 1 TO

5

Number = Numbers[Count]

6

Total = + Number

7

Counter = Counter + 1

8

Count

9

PRINT ′The sum of the numbers you entered is ′, Number

10 PRINT ′The average of the numbers you entered is ′, Number / Counter
[4]

© UCLES 2018

0478/23/M/J/18

7
4

www.dynamicpapers.com

An algorithm is written in pseudocode:
INPUT Number
IF Number > 100
THEN OUTPUT ″The number is too large″
ELSE OUTPUT ″The number is acceptable″
ENDIF
(a) Describe the purpose of the algorithm.

[2]
(b) (i)

The algorithm only allows one attempt at inputting an acceptable value.
State how you would change the algorithm so that it continues until a suitable input is
supplied.

[1]

(ii)

Re-write the algorithm in full, using pseudocode, to implement your answer to part (b)(i).

[3]

© UCLES 2018

0478/23/M/J/18

[Turn over

www.dynamicpapers.com

8
5

The flowchart allows a set of 10 numbers to be entered; it finds and outputs the largest of these
numbers.
START

Max
–1000.00
Counter
0

INPUT Num

Yes

Max

Is Num >
Max ?
No

Num

Counter

Counter + 1

Is Counter
< 10 ?
No
OUTPUT Max

END

© UCLES 2018

0478/23/M/J/18

Yes

www.dynamicpapers.com

9
(a) Complete the trace table for the input data:

6.30, 18.62, 50.01, 3.13, 2.05, 50.10, 40.35, 30.69, 0.85, 17.30
Max

Counter

Num

OUTPUT

[3]
(b) Describe two different changes you should make to the flowchart to find the smallest number
instead of the largest number.
Change 1

Change 2

[2]

© UCLES 2018

0478/23/M/J/18

[Turn over

www.dynamicpapers.com

10
6

A shop that sells copies of movies to the public has set up a new database table called 2018MOV
to store some new releases. Part of this table is given, showing the catalogue number, title, genres
and available formats (Blu-ray, DVD or streaming) of each movie.
CatNo

Title

Genre 1

Genre 2

Blu-ray

DVD

Stream

Adventure

Fantasy

Yes

No

Yes

18m01

Battery Rangers

18m02

Golfwatch

Comedy

Drama

Yes

No

Yes

18m03

Chair 27

Comedy

Drama

Yes

Yes

No

18m04

Wander Woman

Action

Fantasy

Yes

No

Yes

18m05

Justine League

Action

Fantasy

Yes

Yes

Yes

18m06

That

Horror

Thriller

Yes

Yes

No

18m07

Insect Dude

Action

Fantasy

No

Yes

No

18m08

Dover Beach

Action

History

No

Yes

No

18m12

Slow 25

Action

Thriller

No

Yes

No

18m15

Kongkers

Adventure

Fantasy

No

Yes

No

18m16

Transducers: The Last Night

Action

Sci-Fi

Yes

Yes

Yes

18m17

The Pale Tower

Fantasy

Sci-Fi

Yes

Yes

No

18m19

Bea and the Bute

Fantasy

Romance

Yes

Yes

Yes

18m21

The Daddy

Action

Fantasy

No

No

Yes

18m22

Planet Wars: Episode X

Sci-Fi

Action

Yes

No

Yes

18m23

Guardians of the Milky Way

Action

Sci-Fi

Yes

Yes

Yes

18m26

Odin

Horror

Sci-Fi

No

Yes

Yes

18m27

That

Fantasy

Sci-Fi

No

No

Yes

18m30

Underneath

Action

Horror

Yes

No

No

18m31

Debatable Me

Animation

Action

Yes

Yes

No

(a) State the number of records in this part of the table.
[1]
(b) (i)

Give the name of the field that should be used for the primary key.
[1]

(ii)

State the reason for choosing this field for the primary key.

[1]

© UCLES 2018

0478/23/M/J/18

www.dynamicpapers.com

11

(c) Complete the table to show the most appropriate data type for each field based on the data
shown in the table at the start of question 6.
Field

Data type

CatNo
Title
Genre 1
Stream
[2]
(d) List the output that would be given by this query-by-example.
Field:

CatNo

Title

Genre 1

Blu-ray

DVD

Stream

Table:

2018MOV

2018MOV

2018MOV

2018MOV

2018MOV

2018MOV

3

3

3

3

3

Sort:
Show:
Criteria:

=“Comedy”

or:

[2]
(e)

Using the query-by-example grid, write a query to identify all the movies that are categorised
as Sci-Fi and available to stream. Only display the catalogue number and title of the film, with
the titles listed in alphabetical order.

Field:
Table:
Sort:
Show:
Criteria:
or:
[4]

© UCLES 2018

0478/23/M/J/18

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 International
Examinations Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download at www.cie.org.uk after
the live examination series.
Cambridge International Examinations is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of University of Cambridge Local
Examinations Syndicate (UCLES), which is itself a department of the University of Cambridge.

© UCLES 2018

0478/23/M/J/18

Advertisement