Queue Basics and Stack Mix MCQs: 12 Solved Questions with Explanations
Practise 12 published queue and stack MCQs with exact options, correct answers, compact traces and fresh explanations from FIFO through aggregate analysis.
KnowledgeGate Team
Exam prep & CS education

Queue MCQs mix front and rear, stack transfers, recursive reversal and cost analysis. The main constraint is direction: write each queue from front to rear and mark the stack top before checking an explanation. For a wider path through the subject, use the CS Fundamentals for Exams and Placements category.
Related reading: Stack and queue MCQs and Circular queues and deques.
Calibrate FIFO, LIFO and the two-stack queue with one trace
A queue inserts at the rear and removes from the front (FIFO); a stack uses one top (LIFO). See Stacks and Queues: Operations and Uses for a refresher.
Always write a queue from front to rear. Start with Q = [14, 27, 35], where front = 14 and rear = 35. Then:
enqueue(42)gives[14, 27, 35, 42].dequeue()returns14, leaving[27, 35, 42].enqueue(51)gives[27, 35, 42, 51].dequeue()returns27, leaving[35, 42, 51].
The removal sequence is 14, 27, not 42, 51.
Let S_in receive 14, 27, 35, with 35 on top. When S_out is empty, pop 35, 27, 14 from S_in and push them in that order to S_out. Its top becomes 14, so its pop returns the oldest value. Keep S_out intact until it empties.

MCQs 1-3: FIFO, queue ends and the stack-versus-queue distinction
Question 1 (RSSB 2022)
Which of the following principle does Queue use?
A. LIFO principle
B. FIFO principle
C. Linear tree
D. Ordered array
Correct answer: B. FIFO principle.
14 leaving before 27, 35 and 42 demonstrates FIFO. LIFO describes a stack.
Question 2 (DSSSB 2018)
A queue is a _____ data structure in which elements can be inserted only at one end called _____ and deleted only at the other end called _____.
A. Linear, Front, Rear
B. Non-linear, Rear, Front
C. Non-linear, Front, Rear
D. Linear, Rear, Front
Correct answer: D. Linear, Rear, Front.
A queue is linear; enqueue uses rear and dequeue uses front. In [14, 27, 35], these are 35 and 14.
Question 3 (UP Police 2018)
Which of the following statements is TRUE with respect to differences between stacks and queues?
A. Queues use two ends of the structure but stacks use only one
B. Queues require linked lists but stacks do not
C. Stacks use two ends of the structure but queues use only one
D. Stacks require linked lists but queues do not
Correct answer: A. Queues use two ends of the structure but stacks use only one.
A queue uses two ends; a stack uses one. Both support arrays or linked lists, eliminating B and D; C reverses their usage.
MCQs 4-5: trace removals before choosing an implementation
Question 4 (UP Police 2016)
If the following operations are performed on a Queue, what will be the sequence in which the elements are removed?
push(2) , push(5) , pop() , pop() , push(8) , push(6) , pop() , pop()
A. 6, 8, 5, 2
B. 5, 2, 6, 8
C. 5, 2, 8, 6
D. 2, 5, 8, 6
Correct answer: D. 2, 5, 8, 6.
This question uses push and pop for queue insertion and removal. Follow the intended queue semantics: push(2) -> [2]; push(5) -> [2,5]; the first two pops return 2, then 5. Next, push(8), push(6) -> [8,6]; the final pops return 8, then 6.
Question 5 (GATE 2001)
What is the minimum number of stacks of size n required to implement a queue of size n?
A. One
B. Two
C. Three
D. Four
Correct answer: B. Two.
Enqueue into S_in; dequeue from S_out. When S_out empties, transfer S_in. For 14, 27, 35, 14 reaches the top. One stack cannot expose the oldest item while retaining the others.
MCQs 6-8: implement one structure with another and reverse a queue
Question 6 (DSSSB 2018)
State whether the following statements are true or false.
Statements:
(i) A queue can be implemented using two stacks.
(ii) A stack can be implemented using two queues.
A. (i) True, (ii) True
B. (i) True, (ii) False
C. (i) False, (ii) True
D. (i) False, (ii) False
Correct answer: A. (i) True, (ii) True.
Both work. For (i), enqueue in S_in and dequeue from S_out, transferring every item only when S_out is empty. For (ii), keep the newest item at the front: after Q1 holds [14,27], transfer those items to Q2, enqueue 35 in Q1, and transfer 14,27 back. Q1 becomes [35,14,27], so dequeue returns 35. The transfers raise the cost but do not invalidate either construction.
Question 7 (UGC NET 2017)
The seven elements A, B, C, D, E, F and G are pushed onto a stack in reverse order, i.e., starting from G. The stack is popped five times and each element is inserted into a queue. Two elements are deleted from the queue and pushed back onto the stack. Now, one element is popped from the stack. The popped item is ________.
A. A
B. B
C. F
D. G
Correct answer: B. B.
Step | Stack, bottom to top | Queue, front to rear |
|---|---|---|
Push |
| empty |
Pop five into queue |
|
|
Delete |
|
|
Delete |
|
|
B is now on top, so the next stack pop returns B.
Question 8 (GATE 2007)
Suppose you are given an implementation of a queue of integers
Consider the following function:
void f(queue Q)
{
int i;
if (!isEmpty(Q))
{
i = delete (Q);
f(Q);
insert(Q, i);
}
}What operation is performed by the above function f ?
A. Leaves the queue Q unchanged
B. Reverses the order of the elements in the queue Q
C. Deletes the element at the front of the queue Q and inserts it at the rear keeping the other elements in the same order
D. Empties the queue Q
Correct answer: B. Reverses the order of the elements in the queue Q.
For Q = [10,20,30], recursion deletes 10, 20, 30; returning inserts 30, 20, 10, producing [30,20,10]. The call stack holds the values while the base case empties the queue.
MCQs 9-10: constant-time queue operations in linked lists and arrays
Question 9 (TPSC 2024)
In a standard linked-list implementation of a queue that maintains both front and rear pointers, compare the time complexity of enqueue and dequeue operations.
A. Enqueue : O(n), Dequeue : O(1)
B. Enqueue : O(1), Dequeue : O(n)
C. Both : O(1)
D. Both : O(n)
Correct answer: C. Both : O(1).
Enqueue links after rear; dequeue removes front. Neither traverses n nodes. Removing the sole node sets both pointers to empty, still in constant time.
Question 10 (GATE 2016)
A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed efficiently. Which one of the following statements is CORRECT ( refers to the number of items in the queue)?
A. Both operations can be performed in time
B. At most one operation can be performed in time but the worst case time for the other operation will be
C. The worst case time complexity for both operations will be
D. Worst case time complexity for both operations will be
Correct answer: A. Both operations can be performed in time.
In a circular array of size 5 (indices 0..4), front=1, rear=3: dequeue reads 1 and advances front to 2; enqueue writes 4 and advances rear to 4. Fixed work without shifts makes both O(1).
MCQs 11-12: aggregate cost and priority keys that reproduce LIFO
Question 11 (GATE 2013)
Consider the following operation along with and operations on queues, where is a global parameter.
MultiDequeue(Q){
m = k
while (Q is not empty) and (m > 0) {
Dequeue(Q)
m = m – 1
}
}What is the worst case time complexity of a sequence of queue operations on an initially empty queue?
A.
B.
C.
D.
Correct answer: A. .
Give one credit to each enqueued item. Each item is removed at most once, so across n operations, successful inner-loop deletions cannot exceed earlier enqueues and are at most n. Thus total loop work is linear even if one MultiDequeue removes up to k items: Θ(n).
Question 12 (GATE 1997)
A priority queue Q is used to implement a stack S that stores characters. PUSH(C) is implemented as INSERT(Q, C, K) where K is an appropriate integer key chosen by the implementation. POP is implemented as DELETEMIN(Q). For a sequence of operations, the keys chosen are in
A. Non-increasing order
B. Non-decreasing order
C. Strictly increasing order
D. Strictly decreasing order
Correct answer: D. Strictly decreasing order.
DELETEMIN removes the smallest key, so each new item needs a smaller key. Push A with K=-1, B with K=-2, and C with K=-3. DELETEMIN returns C, then B: LIFO. Strict decrease prevents ties.
Short version: four checks to carry into the next set
Write queue states from front to rear.
Mark the top after each push or pop.
Count reversals before implementation cost.
For long sequences, count each element's moves instead of multiplying the largest single-call bound.
Redo Questions 4, 7, 8 and 11 without the options, using [2,5], stack order G,F,E,D,C,B,A, recursive queue [10,20,30], and one credit per enqueue. Questions 5, 10 and 11 also appear in Stacks and Queues MCQs: 12 Solved (GATE), where they sit in a broad stacks-and-queues survey; here they test a queue-first progression: two-stack construction, circular-array constant-time operations and aggregate MultiDequeue analysis.
For GATE, continue with GATE Guidance by Sanchit Sir. For placements, use Computer Science Fundamentals for Placements by Sanchit Sir. Repeat the traces until direction errors disappear.
Keep learning

Stack Basics and Operations MCQs: 12 Solved Questions with Step-by-Step Explanations
Test stack fundamentals through 12 exam MCQs on LIFO, TOP, array bounds, queue transfers and permutations. Complete traces make every state and answer checkable.

Evaluation of Expressions MCQs: 12 Solved Questions with Stack Traces
Solve 12 expression MCQs step by step. Trace postfix and prefix evaluation, nesting depth, precedence and notation conversion without reversing operands.

Priority Queue MCQs: 12 Solved Questions on Heaps, Deques and Variants
Attempt 12 verified priority queue and queue-variant MCQs, then learn from concise heap, array, circular queue and deque traces.

Infix, Postfix and Prefix MCQs: 12 Solved Questions with Step-by-Step Explanations
Solve 12 expression-notation MCQs in increasing difficulty, from basic stack use to conversions, associativity and maximum operand-stack depth.