Specimen MS - Paper 2 Edexcel Computer Science IGCSE
Specimen MS - Paper 2 Edexcel Computer Science IGCSE
Java
Lines 7–14/7
C#
Lines 10–17/10 (1)
Java
Lines 10–14/10
C#
Lines 13–16/13
(1)
(3)
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).
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).
Python
(10)
Java
C#
Award 1 mark for an appropriate validation test and 1 mark for an item of test
data that would fail the given test.
Is length = 5? ABC-123
(4)
Python
Java
(4)
C#
• 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)
Python
(7)
Java
C#
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)
Java
C#
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)
Example solutions
Python
Java
C#
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
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.
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
Repetition
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.
Input/output
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
Subprograms
Subprograms
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.