0% found this document useful (0 votes)
71 views16 pages

Cambridge International General Certificate of Secondary Education

This document is an exam paper for a Cambridge International General Certificate of Secondary Education (GCSE) in Computer Science. It provides instructions for candidates and includes a pre-release material section describing tasks to develop a program for a take-away shop. The tasks involve setting up a menu with item codes and prices (Task 1), allowing customers to place orders (Task 2), and calculating daily takings and profit (Task 3). Question 1 asks the candidate to describe arrays and variables used in Tasks 1 and 2, and provide an algorithm for entering item codes and quantities for an order in Task 2. The pre-release material and tasks are intended to test the candidate's ability to design, develop and test a program to solve practical problems

Uploaded by

Ahmed Zeeshan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views16 pages

Cambridge International General Certificate of Secondary Education

This document is an exam paper for a Cambridge International General Certificate of Secondary Education (GCSE) in Computer Science. It provides instructions for candidates and includes a pre-release material section describing tasks to develop a program for a take-away shop. The tasks involve setting up a menu with item codes and prices (Task 1), allowing customers to place orders (Task 2), and calculating daily takings and profit (Task 3). Question 1 asks the candidate to describe arrays and variables used in Tasks 1 and 2, and provide an algorithm for entering item codes and quantities for an order in Task 2. The pre-release material and tasks are intended to test the candidate's ability to design, develop and test a program to solve practical problems

Uploaded by

Ahmed Zeeshan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Cambridge International Examinations

Cambridge International General Certificate of Secondary Education


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

COMPUTER SCIENCE 0478/21


Paper 2 Problem-solving and Programming October/November 2018
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 14 printed pages and 2 blank pages.

DC (SR/SG) 150262/3
© UCLES 2018 [Turn over
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 are working at a local take-away shop and you have decided to write a program to track daily
takings and profit. Here is the menu:

Menu item Price


French fries $2.00
1/4 pound burger $5.00
1/4 pound cheeseburger $5.55
1/2 pound burger $7.00
1/2 pound cheeseburger $7.50
Medium pizza $9.00
Medium pizza with extra toppings $11.00
Large pizza $12.00
Large pizza with extra toppings $14.50
Garlic bread $4.50

Write and test a program or programs.


• 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 – Setting up the menu.


Set up a series of arrays to store the menu items and the prices, using the data supplied in the
menu. Devise an item code for each menu item and store these in another array. Output a new
menu including the item codes so that customers can place an order using the item codes.

TASK 2 – Placing an order.


Extend the program so that when a customer places their order from the menu you enter each item
code and the quantity. When the order is completely entered, a unique order code is generated.
Display the order ensuring that the unique order code, menu items and quantities are shown, along
with the item prices and the total cost of the order. Set up arrays for the day to store the unique order
code and the total cost of each order.

TASK 3 – Calculating daily takings and profit.


10% of the takings are profit. Extend the program to display the total daily takings and profit.
Modify your program to allow you to enter the percentage of the takings that are profit. Output the
total daily takings, the profit and the percentage used in the calculation.
© UCLES 2018 0478/21/O/N/18
3

1 (a) All arrays, 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, data type and use of two variables you have created for Task 2.

Variable 1 name .................................................................................................................

Data type ............................................................................................................................

Use .....................................................................................................................................

...........................................................................................................................................

Variable 2 name .................................................................................................................

Data type ............................................................................................................................

Use .....................................................................................................................................

...........................................................................................................................................
[4]

© UCLES 2018 0478/21/O/N/18 [Turn over


4

(b) Write an algorithm to enter each item code and quantity. Then when the order is completely
entered, generate a unique order code (part of Task 2), using either pseudocode,
programming statements or a flowchart. You should assume that Task 1 has already been
completed.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
© UCLES 2018 0478/21/O/N/18
5

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...............................................................................................................................................[5]
© UCLES 2018 0478/21/O/N/18 [Turn over
6

(c) Explain how your program calculates the profit using your input (last part of Task 3) with
variable profit percentage and outputs the results. Any programming statements you use in
your answer must be fully explained.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...............................................................................................................................................[4]

© UCLES 2018 0478/21/O/N/18


7

(d) State three items of test data you could use in Task 3 to test the input of the percentage profit
value and explain why you chose them.

Your reasons must be different for each item of test data.

Test data 1 .................................................................................................................................

Reason ......................................................................................................................................

...................................................................................................................................................

Test data 2 .................................................................................................................................

Reason ......................................................................................................................................

...................................................................................................................................................

Test data 3 .................................................................................................................................

Reason ......................................................................................................................................

...................................................................................................................................................
[3]

© UCLES 2018 0478/21/O/N/18 [Turn over


8

Section B

2 Six terms associated with programming and six descriptions are listed.

Draw a line to link each term with its most appropriate description.

Term Description

Pre-written code to include in


Top-down design your own program to carry out
a common task.

Shows the steps representing


Structure diagram an algorithm using various
shapes of boxes.

Shows the hierarchy of the


Flowchart different components which
make up a system.

Shows the values of variables


Pseudocode as you manually test your
program.

Breaks down a system into


Library routine
successively smaller pieces.

Describes a program using a


Trace table
simplified high-level notation.

[5]

© UCLES 2018 0478/21/O/N/18


9

3 Describe, giving a different example for each, the purpose of these validation checks used in
programming.

Range check ....................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

Example ............................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

Length check ....................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

Example ............................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

Type check .......................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

Example ............................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................
[6]

© UCLES 2018 0478/21/O/N/18 [Turn over


10

4 An algorithm is written in pseudocode:

Total 0
FOR Count 1 TO 50
INPUT Num
Total Total + Num
NEXT Count
OUTPUT Total

(a) Describe the purpose of the algorithm.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...............................................................................................................................................[3]

(b) Re-write the algorithm in pseudocode using a different type of loop.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...............................................................................................................................................[3]

(c) Describe how you could modify the original algorithm shown at the start of question 4, to
allow any number of inputs.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...............................................................................................................................................[2]

© UCLES 2018 0478/21/O/N/18


11

Question 5 starts on page 12.

© UCLES 2018 0478/21/O/N/18 [Turn over


12

5 The flowchart performs a mathematical process on a number input called TestNum

DIV is used to represent integer division e.g. 7 DIV 3 = 2

START

Flag True

INPUT
TestNum

Num TestNum – 1

Yes Is Num = No
1?

Num Num – 1

Yes Is TestNum / No
Flag False Num = TestNum
DIV Num ?

Is Flag = Yes
True ?

No

OUTPUT
TestNum

END

© UCLES 2018 0478/21/O/N/18


13

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

Flag TestNum Num OUTPUT

[2]

(b) Complete the trace table for the input data: 6

Flag TestNum Num OUTPUT

[2]

(c) State the purpose of the algorithm in the flowchart.

...................................................................................................................................................

...............................................................................................................................................[1]

© UCLES 2018 0478/21/O/N/18 [Turn over


14

6 The database table, PCSTOCK, is a part of the database in an electronics shop, showing some of
the desktop (DT), tablet (TB) and laptop (LT) computers they have in stock.

PCID ScreenSize RAM Type HDD(GB) Price


DT303240 30 32 DT 4000 $5000.00
DT303220 30 32 DT 2000 $4500.00
DT301620 30 16 DT 2000 $4000.00
DT231610 23 16 DT 1000 $3000.00
LT191620 19 16 LT 2000 $3000.00
LT171610 17 16 LT 1000 $2500.00
DT230820 23 8 DT 2000 $2000.00
DT190810 19 8 DT 1000 $1500.00
LT190810 19 8 LT 1000 $1500.00
LT170805 17 8 LT 500 $1200.00
DT230420 23 4 DT 2000 $1000.00
DT190410 19 4 DT 1000 $750.00
LT190410 19 4 LT 1000 $950.00
TB100206 10 2 TB 64 $200.00

(a) 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


PCID
ScreenSize
Type
Price
[2]

(b) Using the query-by-example grid, write a query to identify all the desktop computers with a
hard drive larger than 1000 GB. All fields in the table should be shown, sorted in descending
order by price.

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

© UCLES 2018 0478/21/O/N/18


15

BLANK PAGE

© UCLES 2018 0478/21/O/N/18


16

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/21/O/N/18

You might also like