0% found this document useful (0 votes)
95 views32 pages

Specimen MS - Paper 2 Edexcel Computer Science IGCSE

Uploaded by

Priyanka R.D
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)
95 views32 pages

Specimen MS - Paper 2 Edexcel Computer Science IGCSE

Uploaded by

Priyanka R.D
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/ 32

PMT

Paper 2: Application of Computational Thinking

Question Answer Additional guidance Mark


number
1(a)(i) myNumbers Candidates are required to open the
file Q01a in the code editor.
(1)

Question Answer Additional guidance Mark


number
1(a)(ii) Python Candidates are required to open the
Lines 3–8/3 file Q01a in the code editor.

Java
Lines 7–14/7
C#
Lines 10–17/10 (1)

Question Answer Additional guidance Mark


number
1(a)(iii) Python Candidates are required to open the
Lines 5–8/5 file Q01a in the code editor.

Java
Lines 10–14/10
C#
Lines 13–16/13
(1)

Question Answer Additional guidance Mark


number
1(a)(iv) myNumbers/i/total Candidates are required to open the
file Q01a in the code editor.
(1)

Pearson Edexcel International GCSE in Computer Science 55


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Question Answer Additional guidance Mark


number
1(b)(i) Any one from: Candidates are required to open the
file Q01b in the code editor.
• comments/annotations
• descriptive variable names.
(1)

Question Answer Additional guidance Mark


number
1(b)(ii) Any one from:

• another programmer could understand it


• future maintenance would be easier
• easier for another programmer to fix bugs/make amendments
• less likely to introduce bugs yourself.
(1)

Question Answer Additional guidance Mark


number
1(c)(i) Any one from:

• an error in following the rules of the programming language


• not following the grammar rules of the programming language
• not being able to translate a line of code because of an error in using
the language
• misspelling command words in the programming language.
(1)

56 Pearson Edexcel International GCSE in Computer Science


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Question Answer Additional guidance Mark


number
1(c)(ii) Python Candidates are required to open the
• Total is undefined/need to add initialisation for variable total (1). file Q01c in the code editor. Amended
• Equals symbol in If statement needs to be replaced with ‘==’ (1). code should be saved as
• Print (“Odd”) needs to be indented (1). Q01cFINISHED.

Do not penalise logic errors such as


initialising total inside loop.

(3)

Pearson Edexcel International GCSE in Computer Science 57


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Java
• Total is undefined/need to add initialisation for variable total (1).
• Equals symbol in If statement needs to be replaced with ‘==’ (1).
• Missing closed } after Print (“Odd”) (1).

58 Pearson Edexcel International GCSE in Computer Science


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

C#
• Total is undefined/need to add initialisation for variable total (1).
• Equals symbol in If statement needs to be replaced with ‘==’ (1).
• Missing End If after Console.WriteLine (“Odd”) (1).

Pearson Edexcel International GCSE in Computer Science 59


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Question Answer Additional guidance Mark


number
2(a) Award 1 mark for each of: Candidates are required to open the file
Q02a in the code editor. Amended code
• attempting to input country and print country (1) should be saved as Q02aFINISHED.
• printing string plus country (1)
• attempting to input number of children and number of adults (1) Logic of algorithm must be followed as
• coercion of at least one data type (1) set out. Alternatives must address each
• attempting to calculate and print a total (1) point.
• calculating a total using the addition operator (1)
• using two variables (1) Do not penalise candidates who
• printing a string plus an integer (1) attempt more than the stated
• compiling without syntax errors (1) requirements.
• executing and producing the correct output (1).

Python

(10)

60 Pearson Edexcel International GCSE in Computer Science


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Java

Pearson Edexcel International GCSE in Computer Science 61


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

C#

62 Pearson Edexcel International GCSE in Computer Science


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Question Answer Additional guidance Mark


number
2(b) For up to two tests

Award 1 mark for an appropriate validation test and 1 mark for an item of test
data that would fail the given test.

Validation test Invalid data

Is length = 5? ABC-123

Is hyphen in the middle? AB1-2

Are characters 1 and 2 letters? 12-34

Are characters 4 and 5 digits? AB-MP

(4)

Pearson Edexcel International GCSE in Computer Science 63


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Question Answer Additional guidance Mark


number
2(c) Award 1 mark for each logical test. Candidates are required to open the
file Q02c in the code editor. Amended
code should be saved as
Condition Output message Logical test
Q02cFINISHED.
Attendance is at least Sufficient profit made this
(attendance >= Do not penalise candidates who
1500 week
1500) or (income >= attempt more than the stated
Income is at least Sufficient profit made this
45000) requirements.
45000 week
Attendance is at least (attendance >= 750)
Income in line with
750; income is at least and (income >=
attendance this week
22500 22500)
Attendance is very low this
Attendance is fewer
week (attendance < 500)
than 500
Contact fan club
The print statement
All other inputs Possible accounting error needs to be in the
‘else’ block

Python

Java

(4)

64 Pearson Edexcel International GCSE in Computer Science


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

C#

Question Answer Additional guidance Mark


number
3(a) Any one from:

• a subprogram can be written once (1) and called many times (1)
• a subprogram can be debugged once (1) and called many times (1)
• subprograms can be collected into libraries (1), which can be used by other
programs (1).
(2)

Question Answer Additional guidance Mark


number
3(b)(i) Python Candidates are required to open the
time.sleep/print file Q03b in the code editor.
Java
Accept clear reference to sleep and
Thread.sleep/System.out.println
print built-in subprograms.
C#
System.Threading.Thread.Sleep/Console.WriteLine
(1)

Pearson Edexcel International GCSE in Computer Science 65


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Question Answer Additional guidance Mark


number
3(b)(ii) toCelsius/toFahrenheit/waitTenSeconds/waitTime Candidates are required to open the
file Q03b in the code editor.

These are the same across all


languages.

Accept clear reference to subprogram


name. (1)

Question Answer Additional guidance Mark


number
3(b)(iii) Python Candidates are required to open the
inTemp/inSeconds file Q03b in the code editor.
Java and C#
Accept clear reference to parameter
inTemp/inMilliseconds
name. (1)

Question Answer Additional guidance Mark


number
3(b)(iv) waitTenSeconds Candidates are required to open the
file Q03b in the code editor.

This is the same across all languages.

Accept clear reference to subprogram


name.
(1)

66 Pearson Edexcel International GCSE in Computer Science


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Question Answer Additional guidance Mark


number
3(b)(v) Python Candidates are required to open the
inTemp/celsius/fahrenheit/inSeconds file Q03b in the code editor.
Java and C#
Accept clear reference to variable
inTemp/celsius/fahrenheit/inMilliseconds
name.
(1)

Question Answer Additional guidance Mark


number
3(b)(vi) theDate Candidates are required to open the
file Q03b in the code editor.

This is the same across all languages.

Accept clear reference to variable


name. (1)

Question Answer Additional guidance Mark


number
3(b)(vii) The subprogram (being called on this line) is missing a return statement. Candidates are required to open the
file Q03b in the code editor.
(1)

Pearson Edexcel International GCSE in Computer Science 67


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Question Answer Do not Additional Mark


number accept guidance
3(c) Award one mark for each of: Data Candidates are
structures required to open the
• opening ‘Cities.txt’ for reading only (1) such as an file Q03c in the code
• opening/creating ‘Numbered.txt’ for writing only (1) array or a list. editor. Amended code
• using for-each/while not EOF to read each line into variable ‘theLine’ (1) should be saved as
• incrementing the count of lines read (1) Q03cFINISHED.
• constructing the output string/coercion as required (1)
• writing new lines to the output file (1)
• closing at least one of the text files (1).

Python

(7)

68 Pearson Edexcel International GCSE in Computer Science


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Java

Pearson Edexcel International GCSE in Computer Science 69


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

C#

70 Pearson Edexcel International GCSE in Computer Science


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Question Answer Additional guidance Mark


number
4(a) Any one from:

• a step-by-step procedure (which if followed precisely with a given input


produces a predictable output)
• a list of instructions followed in sequence (to solve a problem)
• a process or set of rules to be followed (to achieve a predictable result).
(1)

Question Answer Additional guidance Mark


number
4(b)(i)
7 26 21 28 18 16 9 34
(1)

Question Answer Additional guidance Mark


number
4(b)(ii) 7 (1)

Question Answer Additional guidance Mark


number
4(b)(iii) 6 (1)

Question Answer Additional guidance Mark


number
4(c)(i) Any one from:

• requires many passes to complete the sort


• requires many comparisons/every number is compared every single pass.
(1)

Question Answer Additional guidance Mark


number
4(c)(ii) Top/highest/right-most/last
(1)

Pearson Edexcel International GCSE in Computer Science 71


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Question Answer Additional guidance Mark


number
5(a) Award 1 mark for each correct pass of the loop. Candidates are required to open the
file Q05a in the code editor.

Penalise each mathematical error


target rs rm r
once and then follow through.

4 0 0 1 (1)
4 1 0 1
4 1 1 1
4 1 1 2 (1)
4 4 1 2
4 4 2 2
4 4 2 3 (1)
4 9 2 3
4 9 3 3
4 9 3 4 (1)
4 16 3 4
4 16 0 4
4 16 0 5 (1)

(5)

72 Pearson Edexcel International GCSE in Computer Science


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Question Answer Additional guidance Mark


number
5(b) • Accept user input of total spend (1) Candidates are required to open the
• Coercion of input (to a numerical data type) (1) file Q05b in the code editor. Amended
• Correct logic for totalSpend greater than 300 leads to printing correct code should be saved as
output message (1) Q05bFINISHED.
• Correct logic for totalSpend greater than 0 leads to printing correct output
message (1)
• Correct logic for all other input leads to printing correct output message.
(1)
(5)
Python

Pearson Edexcel International GCSE in Computer Science 73


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Java

74 Pearson Edexcel International GCSE in Computer Science


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

C#

Pearson Edexcel International GCSE in Computer Science 75


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Question Answer Additional guidance Mark


number
6 Award one mark for each of the following points up to a maximum of 11
marks:

• Initialise ‘make artist label’ loop (1)


• Initialise ‘find youngest person’ loop to cycle through all artists given
(1)
• Identify / extract initials of artist (1)
• Combine/concatenate initials with year of birth to create label (1)
• Add the label to the theLabels data structure (1)
• Display the label for the artist (1)
• Initialise the year of birth variable (for finding youngest artist e.g.
maxDate) or initialise oldest person variable (to hold oldest person e.g.
maxPerson) (1)
• Check date of birth with year of birth variable (1)
• Assign younger year to maxDate if necessary (1) (11)
• Assign older year to maxPerson if necessary (1)
• Display the name and year of birth of artist identified (1)

76 Pearson Edexcel International GCSE in Computer Science


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Award up to a maximum of nine marks using the levels-based mark scheme below.

Band 0 Band 1 (1-3 marks) Band 2 (4-6 marks) Band 3 (7-9 marks) Mark
Little attempt to decompose the Some attempt to decompose the The problem has been decomposed into
No rewardable content

problem into component parts problem into component parts component parts
Some parts of the logic are clear Most parts of the logic are clear and The logic is clear and appropriate to the
and appropriate to the problem mostly appropriate to the problem problem
Some appropriate use and The use and manipulation of data
The use and manipulation of data types,
manipulation of data types, types, variables and data structures
variables and data structures and program
variables, data structures and and program constructs is mostly
constructs is appropriate
program constructs appropriate
Parts of the code are clear and Code is mostly clear and readable Code is clear and readable
readable
Finished program will not be flexible Finished program will function with Finished program could be used with other
enough with other data sets or some but not all other data sets or data sets or input
input input
The program meets some of the The program meets most of the given The program fully meets the given
given requirements requirements requirements (9)

Pearson Edexcel International GCSE in Computer Science 77


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Example solutions

Python

Java

78 Pearson Edexcel International GCSE in Computer Science


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

C#

Pearson Edexcel International GCSE in Computer Science 79


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Pseudocode reference
Questions in the written examination that involve code will use this pseudocode for
clarity and consistency. However, students may answer questions using any valid
method.

Data types
INTEGER
REAL
BOOLEAN
CHARACTER

Type coercion
Type coercion is automatic if indicated by context. For example 3 + 8.25 = 11.25
(integer + real = real)
Mixed mode arithmetic is coerced like this:

INTEGER REAL
INTEGER INTEGER REAL
REAL REAL REAL

Coercion can be made explicit. For example, RECEIVE age FROM (INTEGER) KEYBOARD
assumes that the input from the keyboard is interpreted as an INTEGER, not a STRING.

Constants
The value of constants can only ever be set once. They are identified by the keyword
CONST. Two examples of using a constant are shown.

CONST REAL PI
SET PI TO 3.14159
SET circumference TO radius * PI * 2

Data structures
ARRAY
STRING

Indices start at zero (0) for all data structures.


All data structures have an append operator, indicated by &.
Using & with a STRING and a non-STRING will coerce to STRING. For example, SEND
‘Fred’ & age TO DISPLAY, will display a single STRING of ‘Fred18’.

Pearson Edexcel International GCSE in Computer Science 81


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Identifiers
Identifiers are sequences of letters, digits and ‘_’, starting with a letter, for example:
MyValue, myValue, My_Value, Counter2

Functions
LENGTH()
For data structures consisting of an array or string.
RANDOM(n)
This generates a random number from 0 to n.

Comments
Comments are indicated by the # symbol, followed by any text.
A comment can be on a line by itself or at the end of a line.

Devices
Use of KEYBOARD and DISPLAY are suitable for input and output.
Additional devices may be required, but their function will be obvious from the context.
For example, CARD_READER and MOTOR are two such devices.

Notes
In the following pseudocode, the < > indicates where expressions or values need to be
supplied. The < > symbols are not part of the pseudocode.

82 Pearson Edexcel International GCSE in Computer Science


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Variables and arrays

Syntax Explanation of syntax Example

Assigns a value to a SET Counter TO 0


SET Variable TO <value>
variable. SET MyString TO ‘Hello world’

Computes the value of an


SET Sum TO Score + 10
SET Variable TO <expression> expression and assigns to
SET Size to LENGTH(Word)
a variable.

Assigns a value to an
SET ArrayClass[1] TO ‘Ann’
SET Array[index] TO <value> element of a
SET ArrayMarks[3]TO 56
one-dimensional array.

Initialises a
SET Array TO [<value>, …] one-dimensional array with SET ArrayValues TO [1, 2, 3, 4, 5]
a set of values.

Assigns a value to an
SET Array [RowIndex,
element of a SET ArrayClassMarks[2,4] TO 92
ColumnIndex] TO <value>
two-dimensional array.

Selection

Syntax Explanation of syntax Example

IF <expression> THEN If <expression> is true IF Answer = 10 THEN


<command> then command is SET Score TO Score + 1
END IF executed. END IF

IF <expression> THEN If <expression> is true IF Answer = ‘correct’ THEN


<command> then first SEND ‘Well done’ TO DISPLAY
ELSE <command> is executed, ELSE
<command> otherwise second SEND ‘Try again’ TO DISPLAY
END IF <command> is executed. END IF

Pearson Edexcel International GCSE in Computer Science 83


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Repetition

Syntax Explanation of syntax Example

Pre-conditioned loop.
WHILE <condition> DO WHILE Flag = 0 DO
Executes
<command> SEND ‘All well’ TO DISPLAY
<command> whilst
END WHILE END WHILE
<condition> is true.

Post-conditioned loop.
Executes
REPEAT REPEAT
<command> until
<command> SET Go TO Go + 1
<condition> is true. The
UNTIL <expression> UNTIL Go = 10
loop must execute at least
once.

Count controlled loop. The


REPEAT <expression> TIMES number of times REPEAT 100-Number TIMES
<command> <command> is executed is SEND ‘*’ TO DISPLAY
END REPEAT determined by the END REPEAT
expression.

FOR <id> FROM <expression>


Count controlled loop. FOR Index FROM 1 TO 10 DO
TO
Executes SEND ArrayNumbers[Index] TO
<expression> DO
<command> a fixed DISPLAY
<command>
number of times. END FOR
END FOR

FOR <id> FROM <expression>


TO FOR Index FROM 1 TO 500 STEP
<expression> STEP Count controlled loop using 25 DO
<expression> DO a step. SEND Index TO DISPLAY
<command> END FOR
END FOR

SET WordsArray TO [‘The’, ‘Sky’,


‘is’, ‘grey’]
FOR EACH <id> FROM SET Sentence to ‘‘
Count controlled loop.
<expression> DO FOR EACH Word FROM
Executes for each element
<command> WordsUArray DO
of an array.
END FOREACH SET Sentence TO Sentence &
Word & ‘ ‘
END FOREACH

84 Pearson Edexcel International GCSE in Computer Science


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Input/output

Syntax Explanation of syntax Example

SEND <expression> TO Sends output to the SEND ‘Have a good day.’ TO


DISPLAY screen. DISPLAY

RECEIVE <identifier> FROM Reads input of specified RECEIVE Name FROM (STRING)
(type) type. KEYBOARD
<device> RECEIVE LengthOfJourney FROM
(INTEGER) CARD_READER
RECEIVE YesNo FROM
(CHARACTER) CARD_READER

File handling

Syntax Explanation of syntax Example

READ <File> <record> Reads in a record from a READ MyFile.doc Record


<file> and assigns to a
<variable>.
Each READ statement
reads a record from the
file.

WRITE <File> <record> Writes a record to a file. WRITE MyFile.doc Answer1,


Each WRITE statement Answer2, ‘xyz 01’
writes a record to the file.

Subprograms

Syntax Explanation of syntax Example

PROCEDURE <id> Defines a procedure. PROCEDURE CalculateAverage


(<parameter>, …) (Mark1, Mark2, Mark3)
BEGIN PROCEDURE BEGIN PROCEDURE
<command> SET Avg to (Mark1 + Mark2 +
END PROCEDURE Mark3)/3
END PROCEDURE

FUNCTION <id> Defines a function. FUNCTION AddMarks (Mark1,


(<parameter>, …) Mark2, Mark3)
BEGIN FUNCTION BEGIN FUNCTION
<command> SET Total to (Mark1 + Mark2 +
RETURN <expression> Mark3)/3
END FUNCTION RETURN Total
END FUNCTION

Pearson Edexcel International GCSE in Computer Science 85


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Subprograms

Syntax Explanation of syntax Example

<id> (<parameter>, …) Calls a procedure or a Add (FirstMark, SecondMark)


function.

86 Pearson Edexcel International GCSE in Computer Science


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019
PMT

Arithmetic operators

Symbol Description
+ Add
- Subtract
/ Divide
* Multiply
^ Exponent
MOD Modulo
DIV Integer division

Relational operators

Symbol Description
= equal to
<> not equal to
> greater than
>= greater than or equal to
< less than
<= less than or equal to

Logical operators

Symbol Description
AND Returns true if both
conditions are true.
OR Returns true if any of the
conditions are true.
NOT Reverses the outcome of
the expression; true
becomes false, false
becomes true.

Pearson Edexcel International GCSE in Computer Science 87


Sample Assessment Materials - Issue 3 – May 2019 © Pearson Education Limited 2019

You might also like