← Back to ExamEdge tutorials

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.

This is the question your cohort sat. Most students either left it blank or stopped after the first few lines. Work through tabs 0–3 to understand exactly why — then use tabs 4 - 8 for the hotel practice question and its mark scheme.
QUESTION 10 CAMBRIDGE IGCSE COMPUTER SCIENCE 0478/22 · MOCK 2026

A city car park has 50 parking spaces. The management wants a program to record and analyse the usage of these spaces over a 5-day working week (Monday to Friday).

The following data structures are used:

  • A one-dimensional (1D) array RegPlate[] contains the registration numbers of the cars assigned to the 50 spaces.
  • A two-dimensional (2D) array WeeklyUsage[] is used to store the number of hours each space was occupied for each of the five days.
  • A 1D array TotalFeePerSpace[] is used to store the total weekly parking fee calculated for each space.

Write a program that meets the following requirements:

  1. Allows the number of hours parked to be input and validated for every space for each of the five days.
    The validation must ensure the number of hours is between 1 and 12 inclusive for any single day.
  2. Calculates the total weekly fee for each space based on a rate of $3.50 per hour and stores it in the TotalFeePerSpace[] array.
  3. Calculates the total weekly revenue collected by the car park for all 50 spaces over the 5 days.
  4. Finds and outputs the space number and registration number of the car(s) that had the highest total number of hours parked for the week.
  5. Outputs for each space: the space number, the registration number, the total weekly fee calculated, with a suitable message.
  6. Outputs the total weekly revenue for the entire car park.

You do not need to declare any arrays or variables as you may assume they have already been initialised.

You must use pseudocode or program code and add comments to explain how your code works. All inputs and outputs must contain suitable messages.

Total marks for this question [15]

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:

LOOP TRIGGER

"50 parking spaces … 5-day working week"

→ Nested FOR loop: Space 1–50, Day 1–5. Two counters. These are your array bounds.

VALIDATION TRIGGER

"between 1 and 12 inclusive"

→ WHILE loop. Condition: Hours < 1 OR Hours > 12. Must re-prompt — IF is not enough.

CALCULATION TRIGGER

"$3.50 per hour … TotalFeePerSpace[]"

→ Accumulate inside inner loop. += pattern. Store result in 1D array indexed by space.

OUTPUT TRIGGER × 3

"space number … registration … fee … total revenue … highest hours"

→ Per-space output loop + max-finding logic + two final summary outputs. All need messages.

Exam technique: Before writing any code, spend 2 minutes writing three headings on your answer page — Section A: Input, Section B: Calculate, Section C: Output. This structure signals to the examiner that you understand the question, and it keeps you from losing marks by writing output code before your calculation loop is complete.

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.

15
marks available
5
independent clusters
~45
minutes recommended
Cambridge marking is point-based, not holistic. Each bullet in the mark scheme is independent. A student who skips the input loop entirely can still score 7–8 marks by writing correct calculation and output code. Never leave sections blank.

The five mark clusters — Q10 car park (your mock)

Nested loops
FOR each of 50 spaces → FOR each of 5 days → input hours. Two counters: Space and Day. 3 marks
Validation
Hours between 1 and 12 inclusive. WHILE hours < 1 OR hours > 12 → reject and re-prompt until valid. 2 marks
Fee calculation
Accumulate WeeklyUsage[Space][Day] across all 5 days × $3.50 into TotalFeePerSpace[Space]. Also accumulate TotalRevenue. 3 marks
Find max & output
Track highest total hours. Output space number + registration plate. Output each space's details. Output total revenue. 4 marks
Comments & messages
Every INPUT and OUTPUT must include a suitable message. At least 2–3 inline comments explaining logic sections. 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

✗ Wrong — 1D access; only one index used
WeeklyUsage[Space] ← Hours

TotalFeePerSpace[Space] ←
  TotalFeePerSpace[Space] +
  (WeeklyUsage[Space] * 3.50)
✓ Correct — 2D access; Space and Day both indexed
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

✗ Wrong — Day loop is outer; Space bound is 1–12
FOR Day ← 1 TO 5
  FOR Space ← 1 TO 12
✓ Correct — Space is outer; Day is inner; bounds match array
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

✗ Checks once — fails if user enters bad data twice
Hours ← USERINPUT
IF Hours < 1 OR Hours > 12
  THEN OUTPUT "Invalid"
ENDIF
✓ Keeps re-asking until valid
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

✗ Overwrites — only keeps the last day's fee
TotalFeePerSpace[Space] ←
  WeeklyUsage[Space][Day] * 3.50
✓ Accumulates all 5 days
TotalFeePerSpace[Space] ←
  TotalFeePerSpace[Space] +
  (WeeklyUsage[Space][Day] * 3.50)

Mistake 5 — Output with no message  −1 per bare output

✗ Bare — fails the "suitable message" criterion
OUTPUT TotalFeePerSpace[Space]
✓ Message + identifier + value
OUTPUT "Space ", Space,
  " weekly fee: $",
  TotalFeePerSpace[Space]

Mistake 6 — Finding the maximum inside the wrong loop  −2 marks

You need a second pass after all fees are calculated. Students who try to find the max inside the input loop compare partially-calculated values — the result is wrong.
// 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

Total available
15
Input & validation loop5
Fee calculation3
Max, output & total revenue4
Comments & suitable messages3

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

MARKSCHEME

Section A Input & validation loop 5 marks

Award [5 max]
  • 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]
Accept REPEAT…UNTIL or DO…WHILE with logically equivalent condition. Accept any valid variable names. Do not award the validation mark for an IF-only check — a single conditional cannot guarantee valid data on repeated bad input.
Examiner note — most commonly dropped marks: (a) 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

Award [3 max]
  • 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]
  • TotalRevenue accumulated outside the inner loop but inside or after the outer loop [1]
Rate must be 3.50 as stated in the question. Do not award the accumulation mark if the assignment overwrites (TotalFeePerSpace[Space] ← WeeklyUsage[Space][Day] * 3.50) rather than adds — this keeps only the last day's value and is a fundamental logic error.
Common 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

Award [4 max]
  • MaxHours and MaxSpace initialised before the comparison loop [1]
  • Correct IF comparison TotalHours > MaxHours updating both MaxHours and MaxSpace [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]
The max-hours comparison requires summing hours across all 5 days per space — not comparing TotalFeePerSpace directly (though that would produce the same ranking). Accept max-finding in a separate loop or combined with the output loop if logically correct. MaxHours initialised to −1 or to the first element are both acceptable.

Comments & messages 3 marks

Award [3 max]
  • 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]
These 3 marks are frequently the easiest in the question and the most often missed. A structurally correct response with no messages or comments is capped at 12/15.

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.
Point-based marking reminder: each bullet above is an independently awardable mark. A student who writes only Section C correctly — and leaves Sections A and B blank — can still earn 4 marks. Partial attempts always outscore blank pages.

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.

SECTION A — Input loop: all 20 rooms × 7 nights FOR Room ← 1 TO 20 FOR Night ← 1 TO 7 Guests ← INPUT("Room " , Room , " night " , Night) WHILE Guests < 0 OR Guests > 4 → re-prompt | NightsOccupied[Room][Night] ← Guests SECTION B — Fee calculation loop 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] SECTION C — Find max · output all rooms · total revenue FOR Room ← 1 TO 20 → IF RoomFee[Room] > MaxFee THEN update MaxFee, MaxRoom OUTPUT "Room " , Room , " weekly fee: $" , RoomFee[Room] NEXT Room OUTPUT "Highest revenue: Room " , MaxRoom , " — $" , MaxFee OUTPUT "Total hotel revenue: $" , TotalRevenue
Use this diagram as your 30-second plan at the start of the question. Even just labelling three boxes on your answer sheet shows the examiner you understand the structure — and that earns marks even if subsequent code has errors.

Guided scaffold — fill in the blanks

Attempt each one on paper before revealing the answer.

4a — outer loop
Write the outer FOR loop that iterates through all 20 hotel rooms.
FOR Room ← 1 TO 20 — 1 to 20 inclusive; not 0 to 19 or 1 to 19.
4b — inner loop
Write the inner FOR loop that iterates through all 7 nights.
FOR Night ← 1 TO 7 — matches the array declaration NightsOccupied[1:20][1:7].
4c — validation loop
Write the WHILE loop that validates the number of guests is between 0 and 4 inclusive.
WHILE Guests < 0 OR Guests > 4
  OUTPUT "Invalid. Enter 0 to 4: "
  Guests ← USERINPUT
ENDWHILE
Must use WHILE (not IF) to score the validation mark.
4d — fee accumulation
Write the single assignment that accumulates the weekly fee for a room. Rate = $85 per guest per night.
RoomFee[Room] ← RoomFee[Room] + (NightsOccupied[Room][Night] * 85)

Note the += pattern — the right-hand side references the current value before adding to it.
4e — max tracker
Write the IF statement that updates MaxFee and MaxRoom when a new highest is found.
IF RoomFee[Room] > MaxFee THEN
  MaxFee ← RoomFee[Room]
  MaxRoom ← Room
ENDIF
4f — output with message
Write an OUTPUT that displays the room number and its total weekly fee with a suitable message.
OUTPUT "Room " , Room , " — weekly fee: $" , RoomFee[Room]

Pre-submission checklist

Complete this before putting your pen down. Aim for 8/8.

0 / 8 checked

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.

Plan the three sections on paper first (see tab 3). Write pseudocode. Then check against tab 5. The model answer and full mark scheme are in tab 7.

Marks breakdown

Loops & input
Nested FOR loops (Room 1–20, Night 1–7). Input read and stored in 2D array. 3 marks
Validation
WHILE loop. Condition 0–4 inclusive. Re-prompt inside loop. 2 marks
Fee calculation
Accumulate RoomFee[Room]. Rate $85. Accumulate TotalRevenue. Initialisation. 3 marks
Max & output
MaxFee initialised. Correct IF comparison. Per-room output. Total revenue output. 4 marks
Messages & comments
All inputs/outputs have messages. At least 2 inline comments. 3 marks

Model answer & mark scheme

Hotel room occupancy tracker · 15 marks · Pseudocode

Total available
15
Input & validation loop5
Fee calculation3
Max, output & revenue4
Comments & messages3

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

MARKSCHEME
Award [5 max]
  • 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]
Accept REPEAT…UNTIL or DO…WHILE with logically equivalent condition. Accept any valid variable names. Do not award validation mark for IF-only check — a single-check IF cannot guarantee valid data.

Section B Fee calculation 3 marks

MARKSCHEME
Award [3 max]
  • 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]
  • TotalRevenue accumulated outside the inner loop (inside or after the outer loop) [1]
Rate must be 85 (not 3.50 — that was the car park scenario). Do not award accumulation mark if assignment overwrites rather than adds. Accept initialisation of RoomFee[Room] inside either loop as long as it occurs before the accumulation line.
Common error: 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

MARKSCHEME
Award [4 max]
  • MaxFee (and MaxRoom) initialised before the comparison loop [1]
  • Correct IF comparison RoomFee[Room] > MaxFee updating 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]
Accept finding the max inside the same loop as per-room output if the logic is structurally correct. MaxFee initialised to -1 or to RoomFee[1] are acceptable alternatives to 0. Do not require a separate pass if max-finding and output coexist correctly in one loop.

Messages & comments 3 marks

MARKSCHEME
Award [3 max]
  • 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]
These 3 marks are often the easiest 3 in the question and the most frequently missed. A response with correct logic but no messages or comments cannot score more than 12/15.

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.
Cambridge marking is point-based, not holistic. Each bullet above is independently awardable. A student who skips Section A entirely but writes correct Sections B and C can still score 7–8 marks. Never leave any section blank.