Past-paper question · 2016 May-June · Paper 21 · Q3
Question 3 2016 · May-June · Paper 21 · 0 marks
Reveal official mark-scheme answer
Official answer for Question 3
Part (a)
PROCEDURE TakeBooking
[11]
✓
DECLARE NumberOfCustomers, TableNumber : INTEGER
✓
(1)
✓
DECLARE Found : BOOLEAN
✓
(1)
✓
INPUT NumberOfCustomers
✓
// initialise search for a suitable table
✓
Found ← FALSE
✓
TableNumber = 0
✓
(1)
✓
REPEAT
✓
// find a table with enough seats
✓
TableNumber ← TableNumber + 1
✓
IF TableSeats[TableNumber] >= NumberOfCustomers
✓
(1+1)
✓
AND Booked[TableNumber] = FALSE
✓
(1)
✓
THEN
✓
Found ← TRUE
✓
ENDIF
✓
UNTIL Found = TRUE OR TableNumber = 12
✓
(1+1)
✓
IF Found = FALSE
✓
THEN
✓
// no tables left with enough seats
✓
OUTPUT "Sorry no tables with enough seats"
✓
(1)
✓
ELSE...// make the booking
✓
Booked[TableNumber] ← TRUE
✓
(1)
✓
GroupSize[TableNumber] ← NumberOFCustomers
✓
(1)
✓
OUTPUT "Table number booked: ", TableNumber
✓
ENDIF
✓
ENDPROCEDURE
Show text version of question
Question 3
City Centre
Topic relevance
Why this question appears here
82% assigned-topic match · Programming › Constructs
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9691_s16_qp_21.pdf
