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 can a business be profitable and still run out of cash?
Because profit and cash are measured on different clocks. Profit counts a sale when you make it. Cash counts it when the money arrives. A business can do everything…
Questions ask me to criticise a sampling method. What am I supposed to look for?
One question answers almost all of these: who could not have been chosen?
Straight line or reducing balance: how do I know which depreciation method a question wants?
The question almost always tells you, but it tells you in the scenario rather than in the instruction. Read for how the asset loses its value, and the method…
My induction proofs lose marks even when the algebra is right. What is missing?
Almost certainly the structure rather than the algebra. Induction is marked as a logical argument, and a proof with perfect working but no statement of the…