0% found this document useful (0 votes)
130 views29 pages

GCSE L1 L2 Computer Science 2020 Sample Assessment Materials For Paper 2

The document provides instructions and questions for a computer science exam. It includes 6 programming questions that require students to fix errors, add logic, and write code to solve problems related to simulations, user input, calculations, and authentication. The total mark for the exam is 75.

Uploaded by

10ibrkha
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)
130 views29 pages

GCSE L1 L2 Computer Science 2020 Sample Assessment Materials For Paper 2

The document provides instructions and questions for a computer science exam. It includes 6 programming questions that require students to fix errors, add logic, and write code to solve problems related to simulations, user input, calculations, and authentication. The total mark for the exam is 75.

Uploaded by

10ibrkha
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/ 29

Pearson Edexcel Level 1/Level 2 GCSE (9–1)

Sample assessment material for first teaching


September 2020
Time: 2 hours Paper Reference 1CP2/02

Computer Science
Paper 2: Application of Computational Thinking

You must have:


• a computer workstation with appropriate programming language code editing software and
tools, including an IDE that you are familiar with which shows line numbers
• a ‘STUDENT CODING’ folder containing code and data files
• printed and electronic copies of the Programming Language Subset (PLS) document.

Instructions
• Answer all the questions on your computer.
• Save new or amended code using the file name provided and place it in the
‘COMPLETED CODING’ folder.
• You must not use the internet at any time during the examination.
Information
• The ‘STUDENT CODING’ folder in your user area includes all the code and
data files you need.
• The total mark for this paper is 75.
• The marks for each question are shown in brackets.
Advice
• Read each question carefully before you start to answer it.
• Save your work regularly.
• Check your answers and work if you have time at the end.

Turn over

*S67286A*
S67286A
©2020 Pearson Education Ltd.

1/1/1/1
Answer ALL questions.
Suggested time: 10 minutes
1 A program simulates the roll of a dice. The program uses a random number generator
to create a random integer, between 1 and 6, to represent the roll.

Open file Q01.

Amend the code to add or complete lines to:


• import the random library
• create one variable
• create one constant
• assign the result of a library call to a variable
• display a message and the contents of a variable on the screen.

Do not add any additional functionality.


Save your amended code file as Q01FINISHED.py

(Total for Question 1 = 7 marks)

2
S67286A
Suggested time: 20 minutes
2 A programmer has started to write a program, but it does not work correctly.
The program should ask the user, “Would you like me to sing?”. The user then
responds ‘y’ or ‘n’. If the user types ‘y’, then the computer displays the lines of a song.

Open file Q02.

Amend the code to:


• fix the syntax error on line 13
• fix the syntax error on line 15
• fix the syntax error on line 17
• change the identifier x to a more meaningful name
• display a suitable question for the user
• accept the user’s input of ‘y’ or ‘n’ (no validation is required)
• add a comment to explain the effect of the range function’s last parameter,
set to −1
• add two uses of white space to aid readability.

Do not add any additional functionality.


Save your amended code file as Q02FINISHED.py

(Total for Question 2 = 10 marks)

3
S67286A
Turn over
Suggested time: 20 minutes
3 A program is needed that must meet the following requirements:
• accept only numbers from 1 to 20, inclusive
• print ‘invalid input’ if the input is outside the permitted range. You can assume
only numbers will be entered
• print the input number followed by ‘is even’, if the number is even
• print the input number followed by ‘is odd’, if the number is odd.

Open file Q03.

Amend the code to:


• fix the runtime error caused by inputting a valid number such as 4 (no other
validation is required)
• fix the logic errors that cause incorrect or no outputs for acceptable numbers
from 1 to 20, inclusive
• fix the logic error that causes the program to execute, even if a number outside
the permitted range is entered
• make all output messages match the requirements listed above.

Do not add any additional functionality.


Save your amended code file as Q03FINISHED.py

(Total for Question 3 = 13 marks)

4
S67286A
Suggested time: 20 minutes
4 A program takes a year group as input and outputs the stage of education
the year group belongs to.
The program loops continually until the user inputs 0 to stop the program.

Input Output

0 Exits program

1, 2, 3, 4, 5, 6 Primary

7, 8, 9, 10, 11 Secondary

12, 13 College

The lines of code in the program are mixed up.

Open file Q04.

Amend the code to make the program work and produce the correct output.
You will need to rearrange the lines.
Use comments, white space, indentation and layout to make the program easier
to read and understand.
Do not change the functionality of the given lines of code.
Do not add any additional functionality.
Save your amended code file as Q04FINISHED.py

(Total for Question 4 = 15 marks)

5
S67286A
Turn over
Suggested time: 25 minutes
5 Students are collecting data about the amount of water needed to fill different sized
paper cones. Their measurements are compared to a calculated volume.
The formula to calculate the volume of a cone is:
1
V= πr2h
3
• V is volume
• π is the constant Pi
• r is the radius of the base of the cone
• h is the height of the cone.

A program and subprogram have been started to carry out the calculation.

Open file Q05.

Amend the program and subprogram to meet the following requirements:


• the subprogram must work for any values of radius and height passed as
parameters. You can assume values passed to the subprogram will always be
numbers. No validation is required
• the subprogram must calculate the volume based on the input parameters
• the main program must print the volume, formatted to show three decimal places
(e.g. 16.135).

Do not add any additional functionality.


Save your amended code as Q05FINISHED.py

(Total for Question 5 = 15 marks)

6
S67286A
Suggested time: 25 minutes
6 A program is needed to authenticate system logins consisting of a login name and
a four-digit passcode.
These items for current users are stored in a two-dimensional list with 19 records.
The list contains user number, last name, first name, login name and passcode.
The list is sorted by login name. All users have passcodes that are integers between
1000 and 9999.

7
S67286A
Turn over
Open file Q06.

Write a program to meet the following requirements:


Inputs
• Prompt for and accept a login name, no validation required
• Prompt for and accept a four-digit passcode. You can assume only numbers
will be entered
• Ensure the passcode is between 1000 and 9999, inclusive
Process
• Work with any number of users in the list
• Use a linear search to find the record with the correct combination of login name
and passcode
• Stop searching when the location of where the record should have been found is
passed. For example:
– if looking for ‘Jam118’ and find ‘Joy116’, then the record is not in the list, so the
search can stop
• Does not need to loop continuously
Outputs
• Display a welcome message, including the user’s first and last names, if the
login name and passcode are found
• Display an invalid input message, if the login name and passcode are not found.

Do not add any additional functionality.


Use comments, white space and layout to make the program easier to read and
understand.
Save your amended code as Q06FINISHED.py

(Total for Question 6 = 15 marks)

TOTAL FOR PAPER = 75 MARKS

8
S67286A
Paper 2 mark scheme
Please note the following regarding the application of this mark scheme:
• Pearson have developed the Programming Language Subset (PLS) document to specify
which parts of Python 3 students are required to learn in order to access the assessments.
Pearson will not go beyond the scope of the PLS in its assessments. However, if students
use alternative valid techniques to answer questions in the assessments, they will also be
credited.
• At the time of publication, this qualification uses Python 3 as the underlying programming
paradigm for the assessment and teaching and learning of the qualification. Python 2 will
not be supported and should not be used in the delivery of this qualification. If at some
time in the future a Python 4 is released, we will work closely with our centres before
deciding whether to remain with Python 3 or to move to the newer version of the language.
• Google are developing some Google Python library equivalents (gPython) that might be
required for Chrome-based schools. Centres that avail of these Google library functions will
also be credited.
• The AO breakdown is shown for paper 2 to give greater clarity to the skills demonstrated in
each marking point. This is necessary for this practical paper as the majority of the
marking points are interlinked in a way that is more complex than in a traditional written
paper.

Question Answer Additional guidance Mark


number
1 The following assessment objectives are • Output of print (7)
assessed: statements may
• AO2.1b appear on
separate lines
• AO3.2b
• Items in ‘< >’ do
not form part of
Award marks as shown. the response, but
provide
clarification
• import random (1)
• roll = (1) <integer> 0 (1)
• SIDES = (1) <integer> 6 (1)
• roll = random.randint(1, SIDES) (1)
• print string (1) and roll (1)
Question Answer Additional guidance Mark
number
2 The following assessment objectives are (10)
assessed:
• AO2.1a
• AO2.1b
• AO3.1
• AO3.2a
• AO3.2b
• AO3.2c

Award marks as shown.

• Add ‘:’ at end of the line:


if (choice == 'y'): (1)
• Add missing ‘)’ before ‘:’ in the line:
for num in range(5, -1, -1): (1)
• Add missing “ before end bracket in the line:
print("Goodbye") (1)
• Printing a suitable question for the user based
on context, i.e. “Do you want me to sing?” (1)
• Accept user input of ‘y’ and ‘n’ (1)
• Changing the variable name ‘x’ to a more
meaningful name (1) such as ‘choice’
throughout the code
• Addition of comment indicating reverse
stepping (1)
• One mark each for insertion of white space to
aid readability, up to a maximum of two
marks (2)
• Correct output for ‘y’ (count down 5 to 0 and
then Goodbye) and correct output for ‘n’
(Goodbye) (1)
Question Answer Additional guidance Mark
number
3 The following assessment objectives are • Fixing error with (13)
assessed: odd numbers can
• AO2.1b be done in several
different ways (see
• AO3.1 examples)
• AO3.2a • Award any
• AO3.2b accurate tests for
• AO3.2c validation range

Award marks as shown. Considerations:


• 6.1.6 Using test
data to evaluate a
• Fixing runtime error by coercion of input to program, such as
‘int’ (1) extreme data [a
• Fixing errors by using modulus (1) character], normal
• Use of at least one appropriate ‘if’ statement data [1...20] and
in the solution (1) boundary data [0,
21]
• Adding validation for input numbers using:
• 6.2.2 Appropriate
o relational operator (<=20) (1) use of sequencing,
o relational operator (>=1) (1) selection and
o correct Boolean operator (and/or) (1) repetition
• Corrects output message for even numbers • 6.1.1 Use analysis
and odd numbers (1) to solve problems
• 6.1.6 Use logical
reasoning to
Levels-based mark scheme to a maximum of 6, evaluate efficiency
from: (i.e. reduce tests)
• Solution design (3)
• Functionality (3)
Solution design (levels-based mark scheme)

0 1 2 3 Max.

• There has been little attempt to • There has been some attempt to • The problem has been decomposed 3
decompose the problem. decompose the problem. clearly into component parts.
• Some of the component parts of • Most of the component parts of the • The component parts of the
the problem can be seen in the problem can be seen in the problem can be seen clearly in the
No rewardable material

solution, although this will not be solution. solution.


complete. • Most parts of the logic are clear • The logic is clear and appropriate
• Some parts of the logic are clear and appropriate to the problem. to the problem.
and appropriate to the problem. • The use of variables and data • The choice of variables and data
• The use of variables and data structures is mostly appropriate. structures is appropriate to the
structures, appropriate to the • The choice of programming problem.
problem, is limited. constructs is mostly appropriate to • The choice of programming
• The choice of programming the problem. constructs is accurate and
constructs, appropriate to the appropriate to the problem.
problem, is limited.
Functionality (levels-based mark scheme)

0 1 2 3 Max.

Functionality (when the code Functionality (when the code Functionality (when the code 3
is run) is run) is run)
• The component parts of the • The component parts of the • The component parts of the
program are incorrect or program are complete, providing a program are complete, providing a
No rewardable material

incomplete, providing a program of functional program that meets functional program that fully meets
limited functionality that meets most of the stated requirements. the given requirements.
some of the given requirements. • Program outputs are mostly • Program outputs are accurate,
• Program outputs are of limited accurate and informative. informative, and suitable for the
accuracy and/or provide limited • Program responds predictably to user.
information. most of the anticipated input. • Program responds predictably to
• Program responds predictably to • Solution may not be robust within anticipated input.
some of the anticipated input. the constraints of the problem. • Solution is robust within the
• Solution is not robust and may constraints of the problem.
crash on anticipated or provided
input.
Question Answer Additional guidance Mark
number
4 The following assessment objectives are (15)
assessed:
• AO2.1b
• AO3.1
• AO3.2a
• AO3.2b
• AO3.2c

Award marks as shown.

• Use of comments, white space and layout to


aid readability (1)
• Initial input done outside loop, to handle first
entry is ‘0’ (1)
• Repetition (while) used as outermost loop (1)
• ‘elif (year > 13)’ is placed later in the logic
than ‘if (year < 1)’ (1)
• ‘elif (year < 12)’ is placed later in the logic
than ‘elif (year < 7)’ (1)
• Accepting next round of input done inside loop
(1)
• Validation messages match validation tests:
o Year too small (1)
o Year too big (1)
• Institution messages match tests:
o Primary (1)
o Secondary (1)
o College (1)
• Correct outputs for each set of test data:
o 0 = exiting (1)
o 1 and 6 = Primary (1)
o 7 and 11 = Secondary (1)
o 12 = College (1)
Question Answer Additional guidance Mark
number
5 The following assessment objectives are Considerations: (15)
assessed: • 6.1.1 Be able to
• AO2.1b use
• AO3.1 decomposition to
analyse
• AO3.2a requirements
• AO3.2b • 6.1.2 Be able to
• AO3.2c write in a high-
level language

Award marks as shown. • 6.6.1 Be able to


perform
generalisations
• Import of math library (1) • Default printing
• Two parameters in first line of subprogram will drop trailing
definition (1) with names ‘pRadius’ and 0s, even if
‘pHeight’, in any order (1) rounded, so string
• Accurate translation of the formula to code formatting should
(1) be used
• Use of math.pi constant in formula
translation (1)
• Two passed-in parameters (‘pRadius’ and
‘pHeight’) used in the calculation (1)
• Assignment of calculation to ‘theVolume’ (1)
• One return statement with ‘theVolume’ in
brackets (1)
• Parameters in call to subprogram are
‘baseRadius’ and ‘coneHeight’, in any order
(1)
• Order of parameters matches order in first
line of subprogram definition (1)
• Capture of returned value in main program,
in ‘coneVolume’ (1)
• Format volume to three decimal places for
outputting only (1)

Levels-based mark scheme to a maximum of 3,


from:
• Functionality (3)
Functionality (levels-based mark scheme)

0 1 2 3 Max.

Functionality (when the code Functionality (when the code Functionality (when the code 3
is run) is run) is run)
• The component parts of the • The component parts of the • The component parts of the
program are incorrect or program are complete, providing a program are complete, providing a
No rewardable material

incomplete, providing a program of functional program that meets functional program that fully meets
limited functionality that meets most of the stated requirements. the given requirements.
some of the given requirements. • Program outputs are mostly • Program outputs are accurate,
• Program outputs are of limited accurate and informative. informative, and suitable for the
accuracy and/or provide limited • Program responds predictably to user.
information. most of the anticipated input. • Program responds predictably to
• Program responds predictably to • Solution may not be robust within anticipated input.
some of the anticipated input. the constraints of the problem. • Solution is robust within the
• Solution is not robust and may constraints of the problem.
crash on anticipated or provided
input.
Question Answer Additional guidance Mark
number
6 The following assessment objectives are Considerations: (15)
assessed: • 6.1.1 Use
• AO2.1b decomposition and
• AO3.1 abstraction to
analyse a problem
• AO3.2a (inputs, outputs,
• AO3.2b processing,
• AO3.2c initialisation,
design)
• 6.6.1 Decompose
Award marks as shown. into subproblems
• 6.1.2 Write in a
Points-based mark scheme: high-level language
Inputs • 6.2.2 Use
• Accepts and responds to user input (1) sequencing and
selection
• Validation with range check using relational components
operators >=1000, <=9999 (1)
Process
• Use of library subprograms len() (1) to
work with any number of users in the list
• Use of Boolean (1) to stop loop when found
or passed over
• Use of 2-dimensional indexing (1) in user
list
Outputs
• Display of appropriate messages (1)

Levels-based mark scheme to a maximum of


9, from:
• Solution design (3)
• Good programming practices (3)
• Functionality (3)
Solution design (levels-based mark scheme)

0 1 2 3 Max.

• There has been little attempt to • There has been some attempt to • The problem has been decomposed 3
decompose the problem. decompose the problem. clearly into component parts.
• Some of the component parts of • Most of the component parts of the • The component parts of the
the problem can be seen in the problem can be seen in the problem can be seen clearly in the
No rewardable material

solution, although this will not be solution. solution.


complete. • Most parts of the logic are clear • The logic is clear and appropriate
• Some parts of the logic are clear and appropriate to the problem. to the problem.
and appropriate to the problem. • The use of variables and data • The choice of variables and data
• The use of variables and data structures is mostly appropriate. structures is appropriate to the
structures, appropriate to the • The choice of programming problem.
problem, is limited. constructs is mostly appropriate to • The choice of programming
• The choice of programming the problem. constructs is accurate and
constructs, appropriate to the appropriate to the problem.
problem, is limited.
Good programming practices (levels-based mark scheme)

0 1 2 3 Max.

• There has been little attempt to lay • There has been some attempt to • Layout of code is effective in 3
out the code into identifiable lay out the code to aid readability, separating sections, e.g. putting all
sections to aid readability. although sections may still be variables together, putting all
No rewardable material

• Some use of meaningful variable mixed. subprograms together as


names. • Uses mostly meaningful variable appropriate.

• Limited or excessive commenting. names. • Meaningful variable names and


• Some use of appropriate subprogram interfaces are used
• Parts of the code are clear, with where appropriate.
limited use of appropriate spacing commenting, although may be
and indentation. excessive. • Effective commenting is used to
• Code is mostly clear, with some use explain logic of code blocks.
of appropriate white space to aid • Code is clear, with good use of
readability. white space to aid readability.
Functionality (levels-based mark scheme)

0 1 2 3 Max.

Functionality (when the code Functionality (when the code Functionality (when the code 3
is run) is run) is run)
• The component parts of the • The component parts of the • The component parts of the
program are incorrect or program are complete, providing a program are complete, providing a
No rewardable material

incomplete, providing a program of functional program that meets functional program that fully meets
limited functionality that meets most of the stated requirements. the given requirements.
some of the given requirements. • Program outputs are mostly • Program outputs are accurate,
• Program outputs are of limited accurate and informative. informative, and suitable for the
accuracy and/or provide limited • Program responds predictably to user.
information. most of the anticipated input. • Program responds predictably to
• Program responds predictably to • Solution may not be robust within anticipated input.
some of the anticipated input. the constraints of the problem. • Solution is robust within the
• Solution is not robust and may constraints of the problem.
crash on anticipated or provided
input.

You might also like