Question 10 — your mock paper (Q10, Paper 2, 2026)
Read the full question carefully before looking at any other tab. Annotate the requirements as you read.
Read the question — annotate as you go
Every sentence in the question maps to a mark cluster. Here is what a high-scoring student underlines:
"50 parking spaces … 5-day working week"
→ Nested FOR loop: Space 1–50, Day 1–5. Two counters. These are your array bounds.
"between 1 and 12 inclusive"
→ WHILE loop. Condition: Hours < 1 OR Hours > 12. Must re-prompt — IF is not enough.
"$3.50 per hour … TotalFeePerSpace[]"
→ Accumulate inside inner loop. += pattern. Store result in 1D array indexed by space.
"space number … registration … fee … total revenue … highest hours"
→ Per-space output loop + max-finding logic + two final summary outputs. All need messages.
Ready to understand exactly how the marks are allocated? Go to tab 1 — Anatomy, then tab 3 — Q10 Mark Scheme to check your own attempt.
Why 15 marks feels like a wall
The question is structured as one paragraph. Underneath it are five independent mark clusters. Students who freeze at the opening line never claim the marks that sit further down — even though those marks are accessible without completing the earlier sections.
The five mark clusters — Q10 car park (your mock)
Space and Day.
3 marks
The six most common errors
These errors account for the majority of marks lost across the cohort on every Paper 2 session.
Mistake 1 — Treating WeeklyUsage as a 1D array typically −3 marks
WeeklyUsage[Space] ← Hours
TotalFeePerSpace[Space] ←
TotalFeePerSpace[Space] +
(WeeklyUsage[Space] * 3.50)
WeeklyUsage[Space][Day] ← Hours
TotalFeePerSpace[Space] ←
TotalFeePerSpace[Space] +
(WeeklyUsage[Space][Day] * 3.50)
WeeklyUsage stores hours for every space across every day — it needs two indices: the space number and the day number. A 1D interpretation can only hold one value per space, so it gets overwritten on every day of the inner loop and the weekly total is always wrong. The inner FOR Day loop becomes meaningless without [Day] as the second index — which is usually the point where examiners stop awarding marks for the calculation section.
Mistake 2 — Wrong loop order and wrong bounds typically −3 marks
FOR Day ← 1 TO 5
FOR Space ← 1 TO 12
FOR Space ← 1 TO 50
FOR Day ← 1 TO 5
The outer loop must iterate spaces (50) and the inner loop days (5) — this mirrors how WeeklyUsage[Space][Day] is indexed. Swapping the loops means the array is traversed in the wrong dimension. Using 1–12 for the space bound confuses the hour validation range (1–12) with the number of spaces (50) — a different part of the question entirely.
Mistake 3 — IF instead of WHILE for validation −2 marks
Hours ← USERINPUT
IF Hours < 1 OR Hours > 12
THEN OUTPUT "Invalid"
ENDIF
Hours ← USERINPUT
WHILE Hours < 1 OR Hours > 12
OUTPUT "Enter 1–12: "
Hours ← USERINPUT
ENDWHILE
Mistake 4 — Overwriting instead of accumulating the fee −2 marks
TotalFeePerSpace[Space] ←
WeeklyUsage[Space][Day] * 3.50
TotalFeePerSpace[Space] ←
TotalFeePerSpace[Space] +
(WeeklyUsage[Space][Day] * 3.50)
Mistake 5 — Output with no message −1 per bare output
OUTPUT TotalFeePerSpace[Space]
OUTPUT "Space ", Space,
" weekly fee: $",
TotalFeePerSpace[Space]
Mistake 6 — Finding the maximum inside the wrong loop −2 marks
// Correct: separate pass after fee calculation is complete
MaxHours ← 0
MaxSpace ← 0
FOR Space ← 1 TO 50
TotalHours ← 0
FOR Day ← 1 TO 5
TotalHours ← TotalHours + WeeklyUsage[Space][Day]
NEXT Day
IF TotalHours > MaxHours THEN
MaxHours ← TotalHours
MaxSpace ← Space
ENDIF
NEXT Space
OUTPUT "Highest usage: Space " , MaxSpace , " (" , RegPlate[MaxSpace] , ")"
Mark scheme — Q10 car park (your mock paper)
Cambridge IGCSE Computer Science 0478/22 · Mock 2026 · 15 marks
Full model pseudocode — car park scenario
// SECTION A — input and validate hours for all 50 spaces over 5 days
FOR Space ← 1 TO 50
FOR Day ← 1 TO 5
OUTPUT "Enter hours for space " , Space , " on day " , Day , ": "
Hours ← USERINPUT
WHILE Hours < 1 OR Hours > 12
OUTPUT "Invalid. Enter hours between 1 and 12: "
Hours ← USERINPUT
ENDWHILE
WeeklyUsage[Space][Day] ← Hours
NEXT Day
NEXT Space
// SECTION B — calculate weekly fee per space and total revenue
TotalRevenue ← 0
FOR Space ← 1 TO 50
TotalFeePerSpace[Space] ← 0
FOR Day ← 1 TO 5
TotalFeePerSpace[Space] ← TotalFeePerSpace[Space] + (WeeklyUsage[Space][Day] * 3.50)
NEXT Day
TotalRevenue ← TotalRevenue + TotalFeePerSpace[Space]
NEXT Space
// SECTION C — find space with highest hours, output all spaces, output total
MaxHours ← 0
MaxSpace ← 0
FOR Space ← 1 TO 50
TotalHours ← 0
FOR Day ← 1 TO 5
TotalHours ← TotalHours + WeeklyUsage[Space][Day]
NEXT Day
IF TotalHours > MaxHours THEN
MaxHours ← TotalHours
MaxSpace ← Space
ENDIF
OUTPUT "Space: " , Space , " | Plate: " , RegPlate[Space] , " | Fee: $" , TotalFeePerSpace[Space]
NEXT Space
OUTPUT "Highest usage — Space: " , MaxSpace, " (" , RegPlate[MaxSpace] , ") — " , MaxHours , " hours"
OUTPUT "Total weekly revenue: $" , TotalRevenue
Section A Input & validation loop 5 marks
- Outer FOR loop correctly bounded:
Space ← 1 TO 50[1] - Inner FOR loop correctly bounded:
Day ← 1 TO 5[1] - USERINPUT assigned to a named variable before validation begins [1]
- WHILE loop (not IF) used for validation with correct condition:
Hours < 1 OR Hours > 12[1] - Re-prompt inside WHILE body; input re-read; value stored in
WeeklyUsage[Space][Day][1]
Day ← 1 TO 5 instead of Space first; (b) Day ← 1 TO 12; (c) IF instead of WHILE. Correct condition inside an IF still scores 0 for the validation mark.
Section B Fee calculation 3 marks
- Correct accumulation inside inner loop:
TotalFeePerSpace[Space] ← TotalFeePerSpace[Space] + (WeeklyUsage[Space][Day] * 3.50)[1] TotalFeePerSpace[Space]initialised to 0 before the inner loop [1]TotalRevenueaccumulated outside the inner loop but inside or after the outer loop [1]
TotalFeePerSpace[Space] ← WeeklyUsage[Space][Day] * 3.50) rather than adds — this keeps only the last day's value and is a fundamental logic error.TotalFeePerSpace[Space] ← WeeklyUsage[Space][Day] * 3.50 — overwrites every iteration. Scores 0 for the accumulation mark even if the rate is correct.
Section C Max hours, per-space output & total revenue 4 marks
MaxHoursandMaxSpaceinitialised before the comparison loop [1]- Correct IF comparison
TotalHours > MaxHoursupdating bothMaxHoursandMaxSpace[1] - Each space's number, registration plate, and fee output with a suitable message [1]
- Space with highest hours output (with registration plate); total revenue output — both with suitable messages [1]
Comments & messages 3 marks
- At least one meaningful inline comment explaining a non-obvious block of code [1]
- All INPUT statements include a message that identifies the space number and day being requested [1]
- All OUTPUT statements include contextual labels — bare numeric output scores 0 for that line [1]
Mark boundary guidance
| Range | Descriptor |
|---|---|
| 13 – 15 | All three sections present and largely correct. Validation uses WHILE. Accumulation uses += pattern. All inputs and outputs carry suitable messages. Minor pseudocode syntax errors tolerated. |
| 9 – 12 | Most sections attempted. One or two structural errors (IF instead of WHILE, overwrite instead of accumulate). Most messages present. Max-finding attempted but may contain a logic error. |
| 5 – 8 | Loops attempted but bounds incorrect or one loop missing. Validation absent or IF-only. Fee calculation partially correct. Some output attempted with partial messages. |
| 0 – 4 | Only isolated fragments. Fewer than three independent correct mark-points across the whole response. No coherent section structure visible. |
Three-section planning skeleton
Draw this on your planning space before writing any code. Examiners reward structured responses even when individual lines carry minor errors.
Guided scaffold — fill in the blanks
Attempt each one on paper before revealing the answer.
FOR Room ← 1 TO 20 — 1 to 20 inclusive; not 0 to 19 or 1 to 19.FOR Night ← 1 TO 7 — matches the array declaration NightsOccupied[1:20][1:7].WHILE Guests < 0 OR Guests > 4 OUTPUT "Invalid. Enter 0 to 4: " Guests ← USERINPUT ENDWHILEMust use WHILE (not IF) to score the validation mark.
RoomFee[Room] ← RoomFee[Room] + (NightsOccupied[Room][Night] * 85)Note the
+= pattern — the right-hand side references the current value before adding to it.IF RoomFee[Room] > MaxFee THEN MaxFee ← RoomFee[Room] MaxRoom ← Room ENDIF
OUTPUT "Room " , Room , " — weekly fee: $" , RoomFee[Room]Pre-submission checklist
Complete this before putting your pen down. Aim for 8/8.
Practice question — new scenario
Hotel room occupancy tracker.
A hotel has 20 rooms. A two-dimensional array NightsOccupied stores the number of guests in each room for each of the 7 nights of the week. A 1D array RoomFee stores the total weekly fee for each room. The nightly rate is $85 per guest.
Write a program that:
- Inputs and validates the number of guests (0–4 inclusive) for every room for every night
- Calculates the total weekly fee for each room
- Finds and outputs the room with the highest total weekly revenue
- Outputs each room's number and total fee with a suitable message
- Outputs the total hotel revenue for the week
You do not need to declare arrays. You may assume they are already initialised. Add comments to explain your code.
Marks breakdown
Model answer & mark scheme
Hotel room occupancy tracker · 15 marks · Pseudocode
Full model pseudocode
// SECTION A — input and validate guest count for all rooms and nights
FOR Room ← 1 TO 20
FOR Night ← 1 TO 7
OUTPUT "Enter number of guests for room " , Room , " on night " , Night , ": "
Guests ← USERINPUT
WHILE Guests < 0 OR Guests > 4
OUTPUT "Invalid. Enter a value from 0 to 4: "
Guests ← USERINPUT
ENDWHILE
NightsOccupied[Room][Night] ← Guests
NEXT Night
NEXT Room
// SECTION B — calculate weekly fee for each room and accumulate total revenue
TotalRevenue ← 0
FOR Room ← 1 TO 20
RoomFee[Room] ← 0
FOR Night ← 1 TO 7
RoomFee[Room] ← RoomFee[Room] + (NightsOccupied[Room][Night] * 85)
NEXT Night
TotalRevenue ← TotalRevenue + RoomFee[Room]
NEXT Room
// SECTION C — find highest revenue room, output all rooms, output totals
MaxFee ← 0
MaxRoom ← 0
FOR Room ← 1 TO 20
IF RoomFee[Room] > MaxFee THEN
MaxFee ← RoomFee[Room]
MaxRoom ← Room
ENDIF
OUTPUT "Room " , Room , " — weekly fee: $" , RoomFee[Room]
NEXT Room
OUTPUT "Highest revenue room: Room " , MaxRoom , " ($" , MaxFee , ")"
OUTPUT "Total hotel revenue for the week: $" , TotalRevenue
Section A Input & validation loop 5 marks
- Outer FOR loop correctly bounded
Room ← 1 TO 20[1] - Inner FOR loop correctly bounded
Night ← 1 TO 7[1] - USERINPUT assigned to a named variable before validation [1]
- WHILE loop used (not IF) with correct condition
Guests < 0 OR Guests > 4[1] - Re-prompt inside WHILE body; input re-read; value stored in
NightsOccupied[Room][Night][1]
Section B Fee calculation 3 marks
- Correct accumulation inside inner loop:
RoomFee[Room] ← RoomFee[Room] + (NightsOccupied[Room][Night] * 85)[1] RoomFee[Room]initialised to 0 before the inner loop or at the start of the outer loop [1]TotalRevenueaccumulated outside the inner loop (inside or after the outer loop) [1]
RoomFee[Room] ← NightsOccupied[Room][Night] * 85 — this overwrites on every night and keeps only the last night's value. Zero marks for this line even if the rate is correct.
Section C Max, output & total revenue 4 marks
- MaxFee (and MaxRoom) initialised before the comparison loop [1]
- Correct IF comparison
RoomFee[Room] > MaxFeeupdating both MaxFee and MaxRoom [1] - Each room's fee output with a suitable message including room identifier [1]
- Highest-revenue room output and TotalRevenue output with suitable messages [1]
Messages & comments 3 marks
- At least one meaningful inline comment explaining a non-obvious section of code [1]
- All INPUT statements include a message identifying what data is required (room number and night number visible in prompt) [1]
- All OUTPUT statements include a message giving context to the value — bare numeric output scores 0 for that line [1]
Mark boundary guidance
Cambridge examiners apply these descriptors on the 15-mark programming question:
| Range | Descriptor |
|---|---|
| 13 – 15 | All sections present and largely correct. Validation uses WHILE. Accumulation correct. All messages present. Minor syntax errors tolerated. |
| 9 – 12 | Most sections attempted. One or two structural errors (e.g. IF instead of WHILE, accumulation overwrite). Most messages present. |
| 5 – 8 | Loops attempted but bounds wrong or missing. Validation absent or IF-only. Calculation partially correct. Some output attempted. |
| 0 – 4 | Only isolated fragments. One or two correct lines without coherent structure. |