Table of Contents
- The indentation rule nobody teaches
- Identifiers, and the four ways to lose a mark
- Types, literals and the arrow
- Arrays, declared with both bounds
- The three loops, and choosing the right one
- If you answer in Python instead
- Ten rules to read on the morning of the paper
- How we teach the algorithm questions
- Frequently asked questions
There is a document most IGCSE Computer Science students never open, and it contains the answer to almost every argument they have ever had with a classmate about how to write an algorithm. It is the pseudocode section of the 0478 syllabus, and it sets out exactly how pseudocode appears in the examinations. Not a house style. The house style, published by the people who write the paper.
This matters because pseudocode at 0478 is not one thing. It is a specific, tightly defined notation with rules about capital letters, indentation, arrows, quote marks and function calls. A student who writes something that reads perfectly clearly but ignores those conventions is writing an answer the mark scheme was not designed to reward.
What the syllabus permits
Where a question requires an algorithm, candidates may answer in pseudocode, or in Python, Visual Basic or Java. It is a genuine choice and neither route is worth more. What is not a choice is doing pseudocode approximately: if a student picks pseudocode, it is worth doing in the notation the paper is written in.
The indentation rule nobody teaches
Start with the one that surprises even good students. Lines are indented by four spaces to show they sit inside a statement above. But the THEN and ELSE clauses of an IF statement are indented by only two, and so are the branches of a CASE statement. The syllabus explains why: they are continuations of the IF, rather than statements in their own right.
IF ChallengerScore > ChampionScore
THEN
IF ChallengerScore > HighestScore
THEN
OUTPUT ChallengerName, " is champion and highest scorer"
ELSE
OUTPUT Player1Name, " is the new champion"
ENDIF
ELSE
OUTPUT ChampionName, " is still the champion"
ENDIF
Count the spaces. THEN sits two in from its IF. The statement under THEN sits two further. When IF statements nest, that two space step continues. Written this way, a nested selection stays readable at a glance, which is the entire point of the convention, and it is also the difference between an answer a marker can follow and one they have to reconstruct.
Identifiers, and the four ways to lose a mark
Identifiers are the names given to variables, constants, procedures and functions, and the rules for them are strict.
- Pascal case. Mixed case with a capital at the start of each word, so
NumberOfPlayersandTotalToPay. - Letters and digits only. No underscores. A student who has learned Python naming habits will reach for
number_of_playerswithout thinking about it. - Start with a capital letter, never a digit. The single letter conventions survive, so
iandjfor array indices andXandYfor coordinates are fine, because convention makes them clear. - No accented characters. Worth saying plainly for the many 0478 candidates whose first language uses them.
One more, easy to miss and occasionally fatal: identifiers are treated as case insensitive. Countdown and CountDown are the same variable, so an algorithm that uses both as if they were two is broken, however tidy it looks.
Types, literals and the arrow
Five data types are used: INTEGER, REAL, CHAR, STRING and BOOLEAN. Variables are declared, constants are declared differently, and assignment uses a left arrow rather than an equals sign, which frees the equals sign to mean comparison and nothing else.
DECLARE Counter : INTEGER
DECLARE TotalToPay : REAL
DECLARE GameOver : BOOLEAN
CONSTANT HourlyRate <- 6.50
CONSTANT DefaultText <- "N/A"
Counter <- 0
Counter <- Counter + 1
TotalToPay <- NumberOfHours * HourlyRate
Two literal rules that catch people out
A REAL literal always has at least one digit on each side of the decimal point, so 4.0 and 0.0 rather than 4. and .0. And a CONSTANT can only be given a literal value, never a variable, another constant, or an expression. Writing CONSTANT DoubleRate as HourlyRate times 2 is not a small liberty, it is outside the notation.
In the real syllabus that arrow is a genuine left arrow character. Handwritten in an exam, draw it as an arrow. Typed, most students write it as a less-than sign followed by a hyphen, which is what the code above does and which no examiner has ever objected to.
Arrays, declared with both bounds
Arrays are fixed length and declared with an explicit lower and upper bound, which removes the perennial argument about whether counting starts at 0 or 1. The syllabus says the lower bound should be stated explicitly, and that a lower bound of 1 will generally be used.
DECLARE StudentNames : ARRAY[1:30] OF STRING
DECLARE NoughtsAndCrosses : ARRAY[1:3, 1:3] OF CHAR
StudentNames[1] <- "Ali"
NoughtsAndCrosses[2,3] <- 'X'
FOR Index <- 1 TO 30
StudentNames[Index] <- ""
NEXT Index
Note the last three lines. A FOR loop ends with NEXT followed by the loop identifier, not with a bare NEXT and not with ENDFOR. Small, and it appears in almost every algorithm question on the paper.
The three loops, and choosing the right one
Questions that say how many times something happens want FOR. Questions about validating an input want REPEAT, because the user must be asked at least once. Questions where the work might not be needed at all want WHILE, because a pre condition loop can run zero times. Choosing wrongly rarely makes an algorithm incorrect, and it frequently makes it clumsy enough to lose a mark for efficiency.
Watch the shapes. WHILE puts DO at the end of its first line and closes with ENDWHILE. REPEAT has no opening condition at all and closes with UNTIL. FOR closes with NEXT and the identifier.
If you answer in Python instead
Plenty of strong candidates answer the algorithm questions in Python, and the syllabus explicitly allows it. The translation is mostly mechanical, with one genuine trap.
text = "Happy Days"
# LENGTH(Text)
print(len(text))
# SUBSTRING(Text, 1, 5), where 1 is the FIRST character
print(text[0:5])
# UCASE and LCASE
print(text.upper(), text.lower())
# DIV(10, 3) and MOD(10, 3)
print(10 // 3, 10 % 3)
# ROUND(Value, 2)
print(round(3.14159, 2))
10
Happy
HAPPY DAYS happy days
3 1
3.14
There it is on the second line. SUBSTRING(Text, 1, 5) starts at the first character, because 0478 pseudocode counts from 1. Python counts from 0, so the equivalent slice starts at 0. A student who translates the position across unchanged gets an answer that is off by one character every time, and because the output still looks like a plausible piece of text, they will not notice.
The rest behaves. DIV becomes floor division and MOD becomes the remainder operator, and both give the same answers. Which raises the other thing worth knowing: at IGCSE, DIV and MOD are written as functions, so DIV(10, 3) and MOD(10, 3). Students who move on to A Level will find them written as operators there instead, and students who arrive at IGCSE from an A Level textbook write them the wrong way round.
Ten rules to read on the morning of the paper
None of these are difficult. All of them are the sort of thing that evaporates under exam pressure, which is exactly why a two minute read on the morning is worth more than another practice paper.
How we teach the algorithm questions
The pattern we see in students who arrive already studying 0478 is nearly always the same. They can describe what an algorithm should do, out loud, correctly. What they cannot do is write it in the notation the paper expects, so the marker sees a rough sketch instead of an answer. That gap closes in a few weeks of writing algorithms by hand and having them read back critically, and it does not close by reading about it.
Our IGCSE Computer Science tuition is live, one to one or in a batch of five to eight students, taught from India to students worldwide. We teach the pseudocode notation and the chosen programming language side by side, because the paper permits either and a student who can move between them is never stuck. The first class is free, and the most useful thing to bring is a past paper algorithm question the student found hard.
A student who writes clear pseudocode is usually one who thinks clearly. The notation is not the point of it, but learning the notation is what forces the thinking to become explicit.
, Why we start algorithms early rather than late
Frequently asked questions
Either. The syllabus lets candidates answer algorithm questions in pseudocode or in Python, Visual Basic or Java, and neither is worth more marks. The advice we give is to pick one and become genuinely fluent in it, rather than switching between them depending on the question.
Draw an arrow and no examiner will mind. What does matter is not using an equals sign for assignment, because the equals sign means comparison in this notation and using it for both makes conditions ambiguous.
It is unlikely to lose a mark on its own for a short algorithm. On a long nested one it can, because an examiner who cannot see which statements sit inside which branch cannot award the logic marks. The two space rule for THEN and ELSE is worth learning simply because it makes nesting legible.
Similar but not identical, and the differences are the sort that cause errors. DIV and MOD are functions at IGCSE and operators at A Level, and the A Level notation adds structures that IGCSE does not use. A student moving up should read the A Level pseudocode section fresh rather than assume.
Python for most students, because the code stays short and the syntax does not get in the way of showing the algorithm. Java suits a student already heading toward AP Computer Science A or A Level, and Visual Basic is worth choosing only if that is what the school teaches.
Enough that it decides grades. The algorithm and programming content sits in section 8 of the subject content and appears across the papers, so a candidate weak on it is capped well below the top grades no matter how strong they are on hardware and networks.
In the 0478 syllabus document published by Cambridge, in the section headed Pseudocode within the details of the assessment. Make sure the copy you read covers the right examination years, because the conventions are stable but not frozen.