Computer Science · June 2024 · Mark scheme · Paper 2
Edexcel International GCSE Computer Science mark scheme for Paper 2, June 2024 — 4CP0/02, file 4cp0-02-rms-20240822.pdf.
Text of this paper
Mark Scheme
Summer 2024
Pearson Edexcel International GCSE
In Computer Science (4CP0/02)
Paper 02: Application of Computational Thinking
Edexcel and BTEC Qualifications
Edexcel and BTEC qualifications are awarded by Pearson, the UK’s largest awarding body. We
provide a wide range of qualifications including academic, vocational, occupational and specific
programmes for employers. For further information visit our qualifications websites at
www.edexcel.com or www.btec.co.uk. Alternatively, you can get in touch with us using the
details on our contact us page at www.edexcel.com/contactus.
Pearson: helping people progress, everywhere
Pearson aspires to be the world’s leading learning company. Our aim is to help everyone
progress in their lives through education. We believe in every kind of learning, for all kinds of
people, wherever they are in the world. We’ve been involved in education for over 150 years,
and by working across 70 countries, in 100 languages, we have built an international
reputation for our commitment to high standards and raising achievement through innovation
in education. Find out more about how we can help you and your students at:
www.pearson.com/uk
Summer 2024
Question Paper Log Number P75737A
Publications Code 4CP0_02_2406_MS
All the material in this publication is copyright
© Pearson Education Ltd 2024
General Marking Guidance
•
All candidates must receive the same treatment. Examiners must mark the first
candidate in exactly the same way as they mark the last.
•
Mark schemes should be applied positively. Candidates must be rewarded for
what they have shown they can do rather than penalised for omissions.
•
Examiners should mark according to the mark scheme not according to their
perception of where the grade boundaries may lie.
•
There is no ceiling on achievement. All marks on the mark scheme should be
used appropriately.
•
All the marks on the mark scheme are designed to be awarded. Examiners
should always award full marks if deserved, i.e. if the answer matches the mark
scheme. Examiners should also be prepared to award zero marks if the
candidate’s response is not worthy of credit according to the mark scheme.
•
Where some judgement is required, mark schemes will provide the principles
by which marks will be awarded and exemplification may be limited.
•
When examiners are in doubt regarding the application of the mark scheme to
a candidate’s response, the team leader must be consulted.
•
Crossed out work should be marked UNLESS the candidate has replaced it with
an alternative response.
Question
mp
Answer
1(a)
A1
The only correct answer is D
Additional Guidance
Mark
A is not correct because it is the definition of decomposition
B is not correct because it is a task undertaken during evaluation
C is not correct because it describes a method for expressing algorithms
1
Question
mp
1b
Answer
Additional guidance
Mark
Award one mark for each of:
B1
Initialisation of myName to "" (1)
•
•
•
String myName = "";
String myName = "";
myName = ""
Allow null
Allow single space between quotes “ “
B2
Add a line to create myAge and initialise it to 0
(1)
•
•
•
int myAge = 0;
int myAge = 0;
myAge = 0
Allow any method
•
•
•
B3
Complete the test by inserting < (1)
if (myAge < 30)
if (myAge < 30)
if (myAge < 30):
Allow <=
Can award reverse test only if welcome message contained
within an ‘else’ part
B4
Add a line to display "Welcome" (1)
•
•
•
Console.WriteLine ("Welcome");
System.out.println ("Welcome");
print ("Welcome")
ignore indentation
Allow any method
4
C#
Java
Python
Question
mp
1c(i)
Answer
Additional guidance
Mark
Award one mark for any of the following:
C#:
Ignore transcription
•
// Q01c (1)
•
Q01c (1)
•
// Loop for 50 times (1)
•
Loop for 50 times (1)
errors
Java:
C1
•
// Q01c (1)
•
Q01c (1)
•
// Loop for 50 times (1)
•
Loop for 50 times (1)
Python:
•
# Q01c (1)
•
Q01c (1)
•
# Loop for 50 times (1)
Loop for 50 times (1)
1
Question
mp
1c(ii)
Answer
Additional guidance
Mark
Award one mark for any of the following:
C#:
Ignore transcription
•
int count = 0; (1)
•
int total = 0; (1)
•
int subtotal = 0; (1)
errors
Java:
C2
•
int count = 0; (1)
•
int total = 0; (1)
•
int subtotal = 0; (1)
Python:
Question
mp
1c(iii)
•
count = 0 (1)
•
total = 0 (1)
•
subtotal = 0 (1)
Answer
1
Additional guidance
Mark
Award one mark for:
Applies to all
C3
•
if (1)
programming languages
Ignore capitalisation
1
Question
mp
1c(iv)
Answer
Additional guidance
Mark
Award one mark for:
C#:
Ignore capitalisation
•
C4
&& (1)
Java:
•
&& (1)
Python:
•
and (1)
Question
mp
Answer
1(d)
D1
The only correct answer is B
1
Additional Guidance
Mark
A is not correct because the data can be stored in an array as it is all the same
data type (string)
C is not correct because the data can be stored in an array as it is all the same
data type (integer)
D is not correct because the data can be stored in an array as it is all the same
data type (real)
1
Question
mp
Answer
Additional Guidance
1(e)
E1
One mark for each correct cell:
Ignore capitalisation
E2
Mark
Do not accept string for True
Item
Data type
All programming languages:
•
real/float
•
decimal/double
C#:
45.82
Java:
•
Double/double/BigDecimal
Python:
•
True
decimal
All programming languages:
•
Question
mp
Answer
2(a)(i)
A1
The only correct answer is A
Boolean/bool
2
Additional Guidance
Mark
B is not correct because computational thinking are skills used in creating algorithms
and programs
C is not correct because decomposition is breaking down a problem into smaller parts
D is not correct because pseudocode is a notation for expressing an algorithm
1
Question
mp
Answer
Additional Guidance
2(a)(ii)
A2
Award one mark for:
Allow parameter
•
Mark
Ignore local/global
Variable (1)
1
Question
mp
Answer
Additional Guidance
2(b)(i)
B1
Award one mark for any of the following:
Do not award an example, as that is the next
Mark
question
•
•
An instruction is impossible to execute (1)
The program stops executing unexpectedly / crashes (1)
Don’t award repeat of question e.g. “Stopping
during execution” without clarifying reason or
that stop was unexpected
Question
mp
Answer
Additional Guidance
2(b)(ii)
B2
Award one mark for any of the following:
Award other examples, if they can be mapped
1
Mark
to a bullet
•
•
•
•
•
Division by zero (1)
Accessing memory outside the range of an array (1)
Attempting an operation on incompatible types (1)
File not found (1)
An exception is raised that cannot be/is not handled (1)
1
Question
mp
2(c)
Answer
Additional guidance
Mark
Award one mark for each of:
C1
Add or remove a semicolon on initialisation of
the length variable (1)
Add a comma between the arguments to the
C2
subprogram call to generate a random
number (1)
C3
Replace modulus operator (%) with
multiplication operator (*) (1)
•
•
•
int length = 4;
int length = 4;
length = 4
•
•
•
width = randGenerator.Next (1, 6);
width = randGenerator.nextInt(1, 6);
width = random.randint (1, 5)
•
•
•
perimeter = (2 * width) + (2 * length);
perimeter = (2 * width) + (2 * length);
perimeter = (2 * width) + (2 * length)
3
C#
Java
Python
Question
mp
2(d)
D1
Answer
Additional Guidance
Mark
Award any correct example (not
D2
Award one mark for any of the following up to a
maximum of two marks:
D3
D4
Erroneous
Normal
•
Contains incorrect data type (1)
•
<2 letters (1)
•
9+ letters (1)
description)
Do not award an empty cell as
equivalent to empty string
Do not accept same test twice
for erroneous
A string between 2 and 8 in length that includes
only letters (1)
Award one mark for any of the following:
Boundary
•
A string of exactly 8 letters (1)
•
A string of exactly 2 letters (1)
4
Question
mp
Answer
Additional Guidance
3(a)
A1
Award one mark for correct column (A OR B)
Award follow through on last
A2
Award one mark for correct column (NOT B)
column only
A3
Award one mark for first set of two cells in third column
A4
Award one mark for second set of two cells in third column
A
B
A OR B
NOT B
(A OR B) AND (NOT B)
0
0
0
1
0
0
1
1
0
0
1
0
1
1
1
1
1
1
0
0
Mark
5th column can be judged
•
On columns 1 and 2 for MP3
and MP4
or
•
as FT from columns 3 and 4
for MP3 and MP4
award highest mark
•
4
Question
mp
3(b)
Answer
Additional guidance
Mark
Award one mark for each of:
B1
B2
Correct output taken from array (1)
Must be from array i.e. Indexing used
Use of iteration to loop over every item in the array
Award foreach loops
(1)
Accept any array
Any appropriate step method
B3
Use of appropriate method to step accurately, i.e.
every other item starting at position 0 (1)
Not hard coded index
3
C#
Java
Python
Question
mp
3(c)
Answer
Additional guidance
Mark
Award one mark for each:
•
•
•
aString = Console.ReadLine ();
aString = myKeyboard.nextLine();
aString = input ("Enter a number: ")
Convert string to integer (1)
•
•
•
aNum = Convert.ToInt32 (aString);
aNum = Integer.parseInt (aString);
aNum = int (aString)
Any one correct set of relational operators (1)
Python
• (aNum <= 20) or (aNum >= 60)
• (aNum < 21) or (aNum > 59)
C1
Take a string input (1)
C2
Complete the selection with 'if' (1)
C3
C4
ignore logical operator
first two tests
ignore test dealing with >= 1
C5
•
•
(aNum > 30) and (aNum < 40)
(aNum >= 31) and (aNum <= 39)
Both logical operators used correctly in each test
(1)
Ignore relational operators
First test: or (must attempt to address 20 and
60 with relational, even if C4 not awarded
C# and Java
• ((aNum <= 20) || (aNum >= 60))
• (aNum < 21) || (aNum > 59))
•
•
((aNum > 30) && (aNum < 40))
((aNum >= 31) && (aNum <= 39))
Second test: and
C6
Complete the third test (1)
All Languages:
(aNum == 30)
6
C#
Java
Python
Question
mp
Answer
Additional Guidance
4(a)(i)
A1
Award one mark for:
Java and C#: allow answers that
Mark
indicate inside namespace e.g.
•
(At the highest level) in the main scope/program/file (1)
‘before main class’
1
Question
mp
Answer
4(a)(ii)
A2
Award one mark for:
•
Additional Guidance
Mark
Only from within the scope/subprogram/code block in which it is
created/declared (1)
1
Question
4(b)
mp
B1
B2
Answer
Additional guidance
Mark
Award two marks for a linked explanation such as:
•
•
Figure 4 executes fewer comparisons/tests (1), because (the use of
nested ifs/else ifs/ means that) as soon as a test evaluates to true,
all the remaining tests are skipped (1)
Figure 5 executes more comparison/tests (1), because every if
statement must be executed, even if any test before has already
evaluated to true (1)
2
Question
mp
4(c)
Answer
Additional guidance
Mark
Award one mark for each:
C1
Subprogram must attempt to use both pString and
Award attempted use, even if not correct
pNum to generate Key (1)
Can be anywhere in code (main or subprogram)
C2
1D indexing used to access chars in string (1)
Any method e.g.
• pString[0]
First 2 and last 2 characters obtained from pString
Any method
C3
C4
C5
C6
2 pairs of separated chars obtained (1)
Key concatenated correctly (1)
Subprogram must return their key to the calling line
(1)
Complete line to call new subprogram (1)
Can be anywhere in code
• pString[0] + pString[1]
• pString[2] + pString[3]
• pString[0:2]
• pString[2:4]
Key must be correct
Can be anywhere in code
Do not award return without a value
Value must be variable/value intended to be
key
Must be fully correct
myNewKey = genNewKey(myString, myNumber)
•
6
C#
Java
Python
Question
5(a)
mp
A1
Answer
Additional guidance
Mark
Award two marks for a linked explanation such as:
A2
Replacing individual variables with an array (using a single name) (1)
means that comparisons could be done in a loop (1)
The animals could be processed in a loop (1) because they could be
stored in an array (under a single name) (1)
•
•
2
Question
mp
5(b)
B1
B2
B3
B4
Answer
Additional guidance
Award one mark for each of:
Ignore contents of fourth row if given.
First row high index and low index (1)
Accept
•
9, 0
First row mid point (1)
•
4
Second row (1)
•
3, 0, 1
Third row (1)
•
0, 0, 0
•
Mark
20, 10
Accept
•
15
Accept
•
14, 10, 12
Accept
•
10, 10, 10
4
Example: Using index
highIndex
lowIndex
midPoint
9
0
4
3
0
1
0
0
0
highIndex
lowIndex
midPoint
20
10
15
14
10
12
10
10
10
Example: Using Values
Question
mp
5(c)
Answer
Additional guidance
Mark
Award one mark for each of:
C1
Opens the file for reading (1)
C2
Reads each line from the file (1)
Requires both read lines (prime, inside loop) for C# and Java.
Requires a foreach for Python.
Allow FT from C1
C3
Splits each line into individual strings (1)
Syntactically correct <anyString>.split(‘,’)
Does not need to be splitting correct line
Any method (index or foreach)
C4
Individual values cast to int for processing (1)
allow float
no FT allowed from C1 to C3 – must be full values between
commas in file
SubTotal += value
C5
Any reasonable attempt at calculating both totals
and
grandTotal += subTotal (1)
C6
All given variable and constant names used
throughout (1)
INPUT_FILE
COMMA
subTotal
grandTotal
C7
C8
Subtotals displayed / Grand total displayed
Must be accurate as shown in QP Fig 8
(1)
Not hard-coded in any way
The input file is closed, before exiting (1)
Syntactically correct
Must be file name originally opened – FT from C1
8
Q
mp Code Examples
5(c)
StreamReader theFile = new StreamReader (inputFile);
C1
BufferedReader theFile = new BufferedReader (new FileReader
(inputFile));
theFile = open (INPUT_FILE, "r")
C2
line
… …
line
line
… …
line
= theFile.ReadLine ();
// Prime loop
= theFile.ReadLine ();
= theFile.ReadLine ();
// Inside loop
// Prime loop
= theFile.ReadLine ();
// Inside loop
for line in theFile:
string[] stringSales = line.Split (comma);
C3
String[] stringSales = line.split (comma);
stringSales = line.split (COMMA)
Convert.ToInt32 (sale);
C4
Integer.parseInt (stringSales[i]);
int (sale)
C5
subTotal = subTotal + sale
subTotal = subTotal + sale
subTotal = subTotal + sale
grandTotal = grandTotal + subTotal;
grandTotal = grandTotal + subTotal;
grandTotal = grandTotal + subTotal
C6
INPUT FILE
COMMA
subtotal
grandTotal
C7
theFile.Close ();
C8
theFile.close ();
theFile.close ()