Skip to content
ExamSpine

Lesson 5.17 · Answer it

Messages sent offline

5 marksYou mark it yourself against the marking points

Ravi's phone has no signal on a train. Each message Ravi sends meanwhile waits in an outbox. When the signal comes back, the outbox sends the waiting messages one at a time. The outbox is a queue: a new message joins at the back.

On the train, Ravi sends three messages to a friend, in this order:

  1. "The train has stopped in a tunnel"
  2. "It could be an hour"
  3. "So start dinner without me"

(a) State the messages in the outbox, front first, just before the signal comes back. [1]

(b) The signal comes back. State which message is sent first, and name the queue operation that takes it out of the outbox. [2]

(c) Suppose the outbox were a stack instead. State the order in which the friend would get the three messages, and explain, using what the messages say, why that order is a problem. [2]

[5]