Past-paper question · 2025 October-November · Paper 43 · Q2(b)

Question 2(b) 2025 · October-November · Paper 43 · 5 marks

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

Official answer for Question 2

Part (b)

Question 1

mark each

Question 5

  • Function header (and end where appropriate) taking one (string) parameter and checking full and returning FALSE
  • (otherwise) Storing parameter in QueueTail + 1
  • Incrementing QueueTail and NumberItems
  • (Dealing with first element) If QueueHead = –1 store 0 in QueueHead / increment QueueHead
  • Return TRUE in all cases when inserted
✓
Example program code.
✓
Java
✓
public static Boolean Enqueue(String TheData){
✓
if(QueueHead == -1){
✓
Queue[0] = TheData;
✓
QueueHead = 0;
✓
QueueTail = 0;
✓
NumberItems++;
✓
return true;
✓
}else if(QueueTail >= 99){
✓
Queue[QueueTail+1] = TheData;
✓
QueueTail++;
✓
NumberItems++;
✓
return true;
✓
}else{
✓
return false;
✓
}
✓
}
✓
9618/43
✓
Cambridge International AS & A Level – Mark Scheme
✓
October/November 2025
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9618_w25_ms_43.pdf →

Show text version of question

Question 2

Part (b)

Question 2

A
program reads string data from a text file into a linear queue and then compresses the data.

The queue is created using the global 1D array Queue. The queue can store up to 100 elements. Each element is initialised to the empty string "" The queue has two pointers that are global to the program: • QueueHead that points to the index of the first element in the queue, initialised to –1 • QueueTail that points to the index of the last element in the queue, initialised to –1 The global variable NumberItems stores the number of elements stored in the queue, initialised to 0

Part (b)

The function Enqueue() takes a string as a parameter. The function checks if the queue is

full, and returns Boolean FALSE if the queue is full. If the queue is not full, the parameter is inserted into the next position in Queue. The function updates the appropriate pointer(s), updates NumberItems and then returns Boolean TRUE Write program code for Enqueue() Save your program. Copy and paste the program code into part 2(b) in the evidence document.

[5]
Topic relevance

Why this question appears here

82% assigned-topic match · Programming › Structured programming

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_w25_qp_43.pdf

Keep practising this topic