Computer Science · Programming and pseudocode
I wrote working Python and got half marks. Why?
Because the paper asked for pseudocode and marks the structure, not whether the code would run. A correct Python answer can miss several structural marks while producing exactly the right output.
Where the marks actually sit
A typical algorithm question worth six marks distributes them roughly like this:
- Declaring variables with sensible names and types
- Correct input or initialisation
- The right loop construct, correctly bounded
- The condition inside the loop
- Updating the accumulator or result
- Output, and handling the edge case
Notice that only two or three of those are what a programmer would call "the logic". The rest is bookkeeping that Python either does invisibly or does not require at all.
The same algorithm, twice
Find the largest of 10 numbers entered by the user.
Python, which runs:
nums = []
for i in range(10):
nums.append(int(input()))
print(max(nums))
That is correct, idiomatic, and would score poorly. max() does the assessed
work, so the marks for initialising a maximum, comparing, and updating have
nowhere to land.
Pseudocode, which scores:
DECLARE Numbers : ARRAY[1:10] OF INTEGER
DECLARE Index, Largest : INTEGER
FOR Index <- 1 TO 10
INPUT Numbers[Index]
NEXT Index
Largest <- Numbers[1]
FOR Index <- 2 TO 10
IF Numbers[Index] > Largest THEN
Largest <- Numbers[Index]
ENDIF
NEXT Index
OUTPUT Largest
Longer, and every extra line is a mark: the declarations, the initialisation of
Largest to the first element rather than zero, the comparison, the update, the
ENDIF and NEXT.
The specific habits that cost marks
Using a library function that does the assessed work. max(), sort(),
sum(), in. If a built-in performs the exact task the question set, you have
answered a different question.
Initialising a maximum to zero. It looks harmless and fails on all-negative data. Initialise to the first element. Examiners test this with negative inputs.
Missing block terminators. ENDIF, ENDWHILE, NEXT, ENDPROCEDURE.
Python uses indentation, so the habit never forms, and each omission is a
structure mark gone.
No declarations. Python does not need them. The mark scheme does.
Paper 4 is the opposite problem
The practical paper flips this. There you write real code in Java, VB.NET or Python, and the marks include evidence of testing: screenshots, test data chosen to exercise the edge cases, and the actual outputs.
Students who have spent months producing tidy code submit a perfect program with no test evidence and lose a substantial block of marks. The code was never the whole task.
How to fix it before the exam
Get the Cambridge pseudocode guide. It is short, it is published alongside the specification, and most students have never opened it.
Then rewrite five of your own Python solutions as pseudocode, by hand, on paper. The first one will feel absurdly verbose. That verbosity is the mark scheme, and after five it stops feeling like translation and starts feeling like the language you answer in.
Working from a past paper? Mark your attempt against the published mark scheme before reading an answer like this one. Finding out where you lost the marks is worth more than seeing a correct solution, because the correct solution rarely tells you what you did instead.
Related questions
Ordered by how close they are to this one: same topic first, then the same subject.
Why does my trace table always go wrong on the last iteration?
Because you are almost certainly checking the condition at the wrong moment, and the last row is the only place that difference shows up.
How do I write a negative number in two's complement without getting confused?
There is a two-step method that always works, and most of the confusion comes from students half-remembering a third step that does not exist.
How do I know whether to use the chain rule, product rule or quotient rule?
Look at how the expression is built, not at what functions appear in it. The rule you need is decided by the structure, and there is a three-question test that…
What is the actual difference between 'describe' and 'explain' in a biology answer?
Describe says what happens. Explain says why it happens. The difference is worth more marks in this subject than almost any piece of content, and it is the most…
How do I predict which way an equilibrium shifts when conditions change?
Le Chatelier's principle: the system shifts to oppose the change imposed on it. The principle is easy. The marks are in saying why the shift happens in the terms of…
If a firm raises its price, does revenue go up or down?
It depends entirely on price elasticity of demand, and that is the whole point of the question. An answer that picks a direction without naming elasticity has…