Past-paper question · 2023 May-June · Paper 31 · Q11(b)

Question 11(b) 2023 · May-June · Paper 31 · 4 marks

Original past-paper question for 11(B)
Original past-paper question for 11(B)
Reveal official mark-scheme answer Official mark-scheme answer for 11(B)

Official answer for Question 11

Part (b)

✓
One mark for each correctly completed line (Max 4)

Question 4

✓
FUNCTION Dequeue RETURNS STRING
✓
DECLARE Item : STRING
✓
IF Length > 0 THEN
✓
Item Queue[FrontPointer]
✓
FrontPointer FrontPointer + 1
✓
Length Length – 1
✓
IF Length = 0 THEN
✓
CALL Initialise // procedure to reset the
✓
pointers
✓
ELSE
✓
IF FrontPointer > MaxSize THEN
✓
FrontPointer 1
✓
ENDIF
✓
ENDIF
✓
ELSE
✓
OUTPUT "The print queue was empty – error"
✓
Item ""
✓
ENDIF
✓
RETURN Item
✓
ENDFUNCTION

Mark scheme 9618_s23_ms_31.pdf →

Show text version of question

Question 11

Part (b)

Question 11

Pseudocode is to be written to implement a queue Abstract Data Type (ADT) with items of the

string data type. This will be implemented using the information in the table.

Identifier Data type Description

FrontPointer INTEGER points to the start of the queue

RearPointer INTEGER points to the end of the queue

Length INTEGER the current size of the queue

Queue STRING 1D array to implement the queue

A
constant, with identifier MaxSize, limits the size of the queue to 60 items.

Part (b)

Complete the following pseudocode for the function Dequeue to remove the front item from

the queue.

FUNCTION Dequeue RETURNS STRING DECLARE Item : STRING

......................................................................................................................... > 0 THEN

Item ← .......................................................................................................................

...................................................................................................................................... IF Length = 0 THEN CALL Initialise // reset the pointers ELSE IF FrontPointer > MaxSize THEN

....................................................................................................................... ← 1 ENDIF ENDIF ELSE OUTPUT "The print queue was empty – error!" Item ← "" ENDIF RETURN Item ENDFUNCTION

[4]
Topic relevance

Why this question appears here

71% 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 9618_s23_qp_31.pdf

Keep practising this topic