Data Structures

Queues — Practice MCQs for CCAT

20 Questions Section B: Programming Data Structures

Practice 20 Queues multiple-choice questions designed for CDAC CCAT exam preparation. Click "Show Answer" to reveal the correct option with detailed explanation.

Q1.
Queue follows which principle?
ALIFO
BFIFO
CRandom
DPriority
Show Answer & Explanation

Correct Answer: B — FIFO

Queue follows FIFO - First In First Out principle.

Q2.
Enqueue and Dequeue operations take:
AO(1)
BO(n)
CO(log n)
DO(n²)
Show Answer & Explanation

Correct Answer: A — O(1)

Both enqueue and dequeue are O(1) operations.

Q3.
Which uses queue?
AFunction calls
BUndo
CCPU Scheduling
DRecursion
Show Answer & Explanation

Correct Answer: C — CPU Scheduling

CPU scheduling algorithms like Round Robin use queues.

Q4.
BFS traversal uses:
AStack
BQueue
CPriority Queue
DDeque
Show Answer & Explanation

Correct Answer: B — Queue

BFS uses queue to explore nodes level by level.

Q5.
In a circular queue, when rear reaches end:
AQueue is full
Brear wraps to front
CError occurs
DQueue resets
Show Answer & Explanation

Correct Answer: B — rear wraps to front

In circular queue, rear wraps around to beginning if space available.

Q6.
Priority queue differs from normal queue by:
ASize
BElements served by priority
CFIFO order
DSpeed
Show Answer & Explanation

Correct Answer: B — Elements served by priority

In priority queue, elements are served based on priority, not arrival order.

Q7.
Deque stands for:
ADelete queue
BDouble-ended queue
CDelayed queue
DDynamic queue
Show Answer & Explanation

Correct Answer: B — Double-ended queue

Deque is Double-ended queue allowing insertion/deletion at both ends.

Q8.
Which is NOT an application of queue?
APrint spooler
BKeyboard buffer
CExpression evaluation
DProcess scheduling
Show Answer & Explanation

Correct Answer: C — Expression evaluation

Expression evaluation uses stack, not queue.

Q9.
In array implementation of queue, problem of:
AOverflow only
BUnderflow only
CBoth and space wastage
DNo problems
Show Answer & Explanation

Correct Answer: C — Both and space wastage

Array queue has overflow, underflow, and space wastage when elements are dequeued.

Q10.
Circular queue solves:
AOverflow
BUnderflow
CSpace wastage in linear queue
DAll problems
Show Answer & Explanation

Correct Answer: C — Space wastage in linear queue

Circular queue reuses empty spaces at the front, solving space wastage.

Q11.
In circular queue, condition for full queue is:
Afront == rear
B(rear + 1) % size == front
Crear == size
Dfront == 0
Show Answer & Explanation

Correct Answer: B — (rear + 1) % size == front

Queue is full when the next position of rear equals front: (rear + 1) % size == front.

Q12.
Two queues can implement a:
ATree
BGraph
CStack
DHash table
Show Answer & Explanation

Correct Answer: C — Stack

Two queues can be used to implement a stack by transferring elements.

Q13.
Input-restricted deque allows:
AInsert at one end only
BDelete at one end only
CInsert and delete at both ends
DNo insertion
Show Answer & Explanation

Correct Answer: A — Insert at one end only

Input-restricted deque allows insertion at only one end but deletion at both ends.

Q14.
Output-restricted deque allows:
AInsert at one end only
BDelete at one end only
CInsert at both ends, delete at one
DNo deletion
Show Answer & Explanation

Correct Answer: C — Insert at both ends, delete at one

Output-restricted deque allows insertion at both ends but deletion at only one end.

Q15.
Priority queue is best implemented using:
AArray
BLinked list
CHeap
DStack
Show Answer & Explanation

Correct Answer: C — Heap

Heap provides O(log n) insert and O(log n) extract-min/max for priority queue.

Q16.
Sliding window maximum problem uses:
AStack
BDeque
CSimple queue
DPriority queue only
Show Answer & Explanation

Correct Answer: B — Deque

Deque (double-ended queue) efficiently solves sliding window maximum in O(n).

Q17.
In queue, if front == rear, the queue is:
AFull
BEmpty
CHas one element
DInvalid state
Show Answer & Explanation

Correct Answer: B — Empty

When front equals rear in most implementations, the queue is empty.

Q18.
First non-repeating character in stream uses:
AStack
BQueue with hash map
COnly array
DTree
Show Answer & Explanation

Correct Answer: B — Queue with hash map

Queue maintains order of characters while hash map tracks frequency.

Q19.
LRU cache can use queue because:
ALIFO property
BFIFO tracks access order
CRandom access
DFixed size
Show Answer & Explanation

Correct Answer: B — FIFO tracks access order

FIFO property helps track which element was accessed least recently.

Q20.
Josephus problem can be solved using:
AStack
BCircular queue
CBinary tree
DGraph
Show Answer & Explanation

Correct Answer: B — Circular queue

Circular queue models the circular arrangement of people in Josephus problem.