Question:

Consider the following sequence of operations on an empty stack and an empty queue.
Stack:
push(54); push(52); pop(); push(55); push(62); s = pop();
Queue:
enqueue(21); enqueue(24); dequeue(); enqueue(28); enqueue(32); q = dequeue();
The value of \( s + q \) is \(\underline{\hspace{2cm}}\).

Show Hint

Stacks follow LIFO order, while queues follow FIFO order.
Updated On: Jan 30, 2026
Hide Solution
collegedunia
Verified By Collegedunia

Correct Answer: 86

Solution and Explanation

Stack operations:
push(54) → [54]
push(52) → [54, 52]
pop() → removes 52
push(55) → [54, 55]
push(62) → [54, 55, 62]
pop() → removes 62
\[ s = 62 \] Queue operations:
enqueue(21) → [21]
enqueue(24) → [21, 24]
dequeue() → removes 21
enqueue(28) → [24, 28]
enqueue(32) → [24, 28, 32]
dequeue() → removes 24
\[ q = 24 \] \[ s + q = 62 + 24 = 86 \] Final Answer: \[ \boxed{86} \]
Was this answer helpful?
0
0