0478 m17 QP 22
0478 m17 QP 22
0478 m17 QP 22
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.
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.
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 syllabus is approved for use in England, Wales and Northern Ireland as a Cambridge International Level 1/Level 2 Certificate.
DC (SLM/SW) 134136/3
© UCLES 2017 [Turn over
2
Section A
You are advised to spend no longer than 40 minutes answering this section.
Use the pre-release material and your experience from attempting the tasks before the examination to
answer Question 1.
Pre-release material
An experiment has taken place which measures the reaction speeds of students. Each student is
aged from 12 to 16, and belongs to a school house (Saturn or Mars). A program is required to store
the age, school house and reaction time of each student in the school. There are 650 students in the
school. The program should be able to output the reaction times of different student groups.
• Your program must include appropriate prompts for the entry of data.
• Error messages and other output need to be set out clearly.
• All variables, constants and other identifiers must have meaningful names.
You will need to complete these three tasks. Each task must be fully tested.
Set up one-dimensional arrays for the whole school to store the following data:
Input and store the records for an appropriate sample of students. Inputs must be validated on
entry and any invalid inputs rejected.
Using your sample, calculate and output the average reaction times for students in Saturn and
students in Mars.
Extend your program to prompt users to input a specific age and school house. Using only records
that match the criteria input, the program should identify, calculate and output:
The output should include a suitable message for each of the reaction times identified.
1 (a) All variables and other identifiers should have meaningful names.
(i) Declare the array used to store the reaction times for the whole school.
.......................................................................................................................................[1]
(ii) Change this declaration so the array can only hold records for a sample of 50 students.
.......................................................................................................................................[1]
(iii) Explain why an array is an effective data structure for storing the reaction time records.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
(b) Write an algorithm to complete Task 1 for the whole school, using either pseudocode,
programming statements or a flowchart. DO NOT include any validation routines.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
(c) Identify three different types of test data you used to test the validation checks on the age
input in Task 1. For each type, give an example of appropriate data.
[6]
(d) Explain how you calculated and outputted the average reaction time based on the user
inputs of age and school house, as part of Task 3. Any programming statements used in your
answer must be fully explained.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[5]
(e) Explain how you would change your solution to Task 3 to output the age of the student with
the fastest reaction time.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]
Section B
2 Read this section of code that inputs the ages of people entering an event. The input sequence is
ended by inputting a negative value for age. The code outputs the number of people at the event
over the age of 18.
01 Num18 = 0
02 INPUT Age
03 WHILE Age >= 0 DO
04 IF Age >= 18 THEN
05 Num18 = Num18 + Age 06
ENDIF
07 ENDWHILE
08 PRINT Num18 - Age
Locate these errors and suggest code correction to remove each error.
Correction......Num18=Num18+1..............................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
Correction.................PRINT Num18.......................................................................
..........................................................................................................................................................
Correction........If Age.18....................................................................................
..........................................................................................................................................................
[4]
• EmployeeID, an employee ID which must be two letters followed by 4 numbers, e.g. TY4587
• Manager, whether the employee is a manager or not
• AnnualHoliday, number of whole days’ annual holiday
• PayGrade, the employee’s pay grade which must be a single letter A–F
EmployeeID STRING
Type check
[8]
START
INPUT A OUTPUT B
IS Yes B A
A > 0 ? B B + A C C – 1
C A
No
IS
OUTPUT C <= 1 ? Yes
'Exit'
No
END
A B C OUTPUT
4 4 4
8 3
12 2
16 1 16
3 3 3
6 2
9 1 9
-1 Exit
[4]
5 (a) Rewrite the following pseudocode algorithm using a WHILE … DO … ENDWHILE loop.
INPUT Num
FOR Counter ← 1 TO 12
Num ← Num * Counter
A[Counter] ← Num
NEXT
....Counter 0
INPUT Num
WHILE Counter<12 DO
Num Num*Counter
A[Counter] Num
Counter Counter + 1
...ENDWHILE............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[4]
(b) Explain the differences between a WHILE … DO … ENDWHILE and a REPEAT … UNTIL
loop.
.........A while loop is a pre-condition loop that may never run if the criteria is never met,
whereas a repeat loop is a post-condition loop that will always run at least once (since the
condition is checked at the
end).........................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[4]
6 A database table, DEVICE, has been set up to record the electronic equipment used in a small
business.
Sort: Ascending
Show: 3
Criteria: Y >1000
or:
......Alan Swales
Chantel Law.............................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]
(b) Complete the query-by-example grid below to select all Desktop devices that were either
purchased before 31/12/2016 or cost under $1000. Only show the Device ID and Device
Type.
Sort:
(tick mark) (tick mark)
Show:
<1000
Criteria:
<#31/12/2016#
or:
[4]
BLANK PAGE
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.