1CP1 02 Sam Qu
1CP1 02 Sam Qu
Computer Science
Paper 2: Application of Computational Thinking
Instructions
• Use black ink or ball-point pen.
• Fill in the boxes at the top of this page with your name,
centre number and candidate number.
• Answer all questions.
• Answer the questions in the spaces provided
– there may be more space than you need.
• You are not allowed to use a calculator.
Information
• The total mark for this paper is 80.
• The marks for each question are shown in brackets
– use this as a guide as to how much time to spend on each question.
Advice
• Read each question carefully before you start to answer it.
• Try to answer every question.
• Check your answers if you have time at the end.
Turn over
S49768A
©2015 Pearson Education Ltd.
*S49768A0126*
1/1/1/1
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) – 45
Issue 2.0 – December 2015 © Pearson Education Limited 2015
Answer ALL questions. Write your answers in the space provided.
Questions in this paper are based on a scenario.
Sparky Autos
Sparky Autos is a family-run business based on a farm. The business
offers visitors the opportunity to drive small electric cars around a
racetrack on the farm.
There are up to 20 electric cars available each time for a race.
Each car has:
• an electronic tag so its number and position can be tracked using
sensors placed around the farm
• a number painted on its side.
1 Cars at Sparky Autos are serviced regularly to check that they are safe and reliable.
A service can be triggered by the car being run for 100 hours or if 30 days have passed.
(a) State two variables that need to be created to store data for each car.
(2)
1 . . . . . . . ................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................................................................................................................................... . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . ..................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................. . . . . . . . . . . . . . . . . . . . .
2 . . . . . . . ................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................................................................................................................................... . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . ..................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................. . . . . . . . . . . . . . . . . . . . .
(b) Each car takes at least 30 minutes to service. Older cars take longer to service. Ten
minutes is added for each full year of the car’s age. The year of purchase is known.
Construct a general expression showing the time needed to service any car.
(2)
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
2
46
*S49768A0226*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015
2 A computer program can be used to determine information about the cars and the
drivers.
(a) Complete the table to show an input, a process and an output, using the
following information:
• each race has 5 laps
• there are 10 cars in this race.
(3)
(b) The arithmetic operator modulus (MOD) manipulates numbers. It could be used
in the calculations required by the processes in the table above.
State the purpose of the MOD function.
(1)
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
3
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015 *S49768A0326* Turn over
47
3 Sparky Autos gives discounts based on the number of visitors in a group.
The pseudo-code for an algorithm that determines group discounts is shown.
(a) Complete the table to show the output of the pseudo-code algorithm, based on
the given inputs.
(3)
Input
Output displayed
numAdults numChildren
8 0
2 2
12 0
Input
Requirements
numAdults numChildren
4
48
*S49768A0426*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015
BLANK PAGE
QUESTION 4 BEGINS ON THE NEXT PAGE.
5
*S49768A0526*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015
49
Turn over
4 A computer programmer uses a programming language to write program code for
Sparky Autos.
(a) State two techniques that the programmer could use to make the code easy to read.
(2)
1 . . . . . . . ................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................................................................................................................................... . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . ..................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................. . . . . . . . . . . . . . . . . . . . .
2 . . . . . . . ................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................................................................................................................................... . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . ..................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................. . . . . . . . . . . . . . . . . . . . .
(b) In the summer, Sparky Autos is open more hours each day. This means additional
members of staff are needed.
Pseudo-code that works out the number of days that additional members of staff
are needed is shown.
(i) Complete the table to identify the line number(s) that show one example of
each of the different programming constructs.
(4)
A comment
Selection
Iteration
6
50
*S49768A0626*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015
(ii) Complete the trace table showing the execution of the pseudo-code. You may
not need to fill in all the rows in the table.
(4)
7
*S49768A0726*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015
51
Turn over
5 Sparky Autos collects data about many different aspects of the business.
(a) An algorithm had an error as shown.
A programmer corrected the error as the code translator displayed this message.
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
8
52
*S49768A0826*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015
(b) The pseudo-code for an algorithm that determines the maximum number of
visitors in a three-day period is shown.
Error Correction
Line 10
Line 13
9
*S49768A0926*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015
53
Turn over
(c) Complete the table to give the appropriate data type of a variable to store each item.
(4)
10
54
*S49768A01026*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015
BLANK PAGE
QUESTION 6 BEGINS ON THE NEXT PAGE.
11
*S49768A01126*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015
55
Turn over
6 A programmer has written subprograms to help him in his work.
The pseudo-code for a function to determine the amount of time elapsed between
the car switch being turned on and turned off is shown.
(a) The underlined item in line 18 has a name when used with the RETURN keyword.
State this name.
(1)
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
(b) Explain why the variable on line 2, totalTime, is not reset when the pseudo-code
on line 16 is executed.
(2)
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
12
56
*S49768A01226*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015
(c) Explain the effect of executing the pseudo-code on line 17.
(2)
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
13
*S49768A01326*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015 Turn over
57
7 The pseudo-code for a procedure that repeatedly checks the time is shown. The effect
of calling this procedure is that the calling code waits for 5 seconds.
Amend this procedure so that it will wait for any number of required seconds without
user input.
(3)
14
58
*S49768A01426*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015
BLANK PAGE
QUESTION 8 BEGINS ON THE NEXT PAGE.
15
*S49768A01526*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015
59
Turn over
8 At the start of a race, cars are placed on a starting grid in a staggered pattern.
When a car makes a false start it breaks a light beam and this notifies the computer
system. The race must be stopped if a car makes a false start.
• There is a maximum of 20 cars in a race.
• The programmer has chosen to use a 1-dimensional array to store this data.
16
60
*S49768A01626*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015
Assess how appropriate a 1-dimensional array is as opposed to using separate
variables when storing this data.
(5)
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
17
*S49768A01726*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015 Turn over
61
9 Sparky Autos collects, stores, and processes data about its customers.
(a) It collects the names and postal addresses of customers. This data is stored in a
comma separated value file (CSV) with one record per line. The file contains over
5000 records. Part of the file is shown.
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
18
62
*S49768A01826*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015
(b) Before driving the cars, each customer fills in an information sheet. Customers
under 16-years old must have the sheet completed by a parent or guardian. The
information is entered into a computer program and stored on the hard disc of
the computer.
(i) Part of the information sheet is shown.
1 . . . . . . . ................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................................................................................................................................... . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . ..................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................. . . . . . . . . . . . . . . . . . . . .
2 . . . . . . . ................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................................................................................................................................... . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . ..................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................. . . . . . . . . . . . . . . . . . . . .
(ii) Give a reason why it may be illegal for organisations to share their data with
third parties.
(1)
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . .
19
*S49768A01926*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015 Turn over
63
10 Each car at Sparky Autos has a pedal to make the car go forward.
(a) The drivers can make the car go forward by using the pedal.
• The closer the pedal is to the floor, the faster the car goes.
• The further the pedal is from the floor, the slower the car goes.
• Each car has its speed limited to 15 kilometres per hour.
Complete the flow chart to show this process.
(6)
20
64
*S49768A02026*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015
Speed = 0
oldPos = height of
pedal off floor
newPos = height of
pedal off floor
newPos > No
oldPos?
Yes
No No
Speed Speed
< 15 > = 0.5
Yes Yes
21
*S49768A02126*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015
65
Turn over
(b) Each car also has direction indicators, which are controlled by an indicator switch
that is operated by the driver.
• The car has two indicator lamps, one on the right and one on the left.
• The indicator switch has three positions.
• The middle position is the off position.
• The up position is to indicate a right turn.
• The down position is to indicate a left turn.
• When a lamp is turned on, it flashes (on, off ) in 0.5 second intervals, until the
switch is moved to the off position.
22
66
*S49768A02226*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015
Construct a flow chart to show this process.
(6)
23
*S49768A02326*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015
67
Turn over
11 A light sequence is used to control the start of the races.
Only the red light is on at the start of the race.
Amber 1
The red light goes off and the first amber light goes on for
1 second.
Amber 2
It goes off and the second amber light goes on for 1 second.
Green
It goes off and the green light goes on to start the race.
The program for controlling the sequence for the lights has Red
two requirements.
• The race controller has to enter ‘y’ on the keyboard to start the light countdown.
• When a car makes a false start it breaks a light beam. If a car breaks a light beam
the race is stopped.
The controlling sequence for the lights has three subprograms that have been
written. These are shown in the table.
Subprogram Purpose
countGridBreaks() a function that returns the number of cars breaking their light beams
a procedure that resets all lights to their initial state and informs the
stopRace()
controller that the race is stopped
24
68
*S49768A02426*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015
Write an algorithm to control the sequence for the lights. Use pseudo-code or a
programming language with which you are familiar.
(9)
25
*S49768A02526*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015
69
Turn over
(Total for Question 11 = 9 marks)
26
70
*S49768A02626*
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science – Sample assessment materials (SAMs) –
Issue 2.0 – December 2015 © Pearson Education Limited 2015