# Queue

 Question 1
Consider the queues Q1 containing four elements and Q2 containing none (shown as the Initial State in the figure). The only operations allowed on these two queues are $Enqueue(Q,element)$ and $Dequeue(Q)$. The minimum number of $Enqueue$ operations on Q1 required to place the elements of Q1 in Q2 in reverse order (shown as the Final State in the figure) without using any additional storage is A 4 B 2 C 0 D 1
GATE CSE 2022   Data Structure
Question 1 Explanation:
 Question 2
A queue is implemented using a non-circular singly linked list. The queue has a head pointer and a tail pointer, as shown in the figure. Let n denote the number of nodes in the queue. Let enqueue be implemented by inserting a new node at the head, and dequeue be implemented by deletion of a node from the tail. Which one of the following is the time complexity of the most time-efficient implementation of enqueue and dequeue, respectively, for this data structure?
 A $\Theta (1), \Theta (1)$ B $\Theta (1), \Theta (n)$ C $\Theta (n), \Theta (1)$ D $\Theta (n), \Theta (n)$
GATE CSE 2018   Data Structure
Question 2 Explanation:
 Question 3
Which of the following data structure is useful in traversing a given graph by breadth first search?
 A Stack B Queue C List D None of the above
ISRO CSE 2017   Data Structure
Question 3 Explanation:
 Question 4
A circular queue has been implemented using a single linked list where each node consists of a value and a single pointer pointing to the next node. We maintain exactly two external pointers FRONT and REAR pointing to the front node and the rear node of the queue, respectively. Which of the following statements is/are CORRECT for such a circular queue, so that insertion and deletion operation can be performed in O (1) time ?

I. Next pointer of front node points to the rear node.
II. Next pointer of rear node points to the front node.
 A I only B II only C Both I and II D Neither I nor II
GATE CSE 2017 SET-2   Data Structure
Question 4 Explanation:
 Question 5
Let Q denote a queue containing sixteen numbers and S be an empty stack. Head(Q) returns the element at the head of the queue Q without removing it from Q. Similarly Top(S) returns the element at the top of S without removing it from S. Consider the algorithm given below. The maximum possible number of iterations of the while loop in the algorithm is_________.
 A 16 B 64 C 256 D 1027
GATE CSE 2016 SET-1   Data Structure
Question 5 Explanation:
 Question 6
A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed efficiently. Which one of the following statements is CORRECT (n refers to the number of items in the queue)?
 A Both operations can be performed in O(1) time B At most one operation can be performed in O(1) time but the worst case time for the other operation will be $\Omega$(n) C The worst case time complexity for both operations will be $\Omega$(n) D Worst case time complexity for both operations will be $\Omega$(logn)
GATE CSE 2016 SET-1   Data Structure
Question 6 Explanation:
 Question 7
The queue data structure is to be realized by using stack. The number of stacks needed would be
 A It cannot be implemented B 2 stacks C 4 stacks D 1 stack
ISRO CSE 2015   Data Structure
Question 7 Explanation:
 Question 8
Consider a standard Circular Queue implementation (which has the same condition for Queue Full and Queue Empty) whose size is 11 and the elements of the queue are q,q,... q.
The front and rear pointers are initialized to point at q. In which position will the ninth element be added?
 A q B q C q D q
ISRO CSE 2014   Data Structure
Question 8 Explanation:
 Question 9
Consider the following operation along with Enqueue and Dequeue operations on queues, where k 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 n queue operations on an initially empty queue?
 A $\Theta (n)$ B $\Theta (n+k)$ C $\Theta (nk)$ D $\Theta (n^{2})$
GATE CSE 2013   Data Structure
Question 9 Explanation:
 Question 10
Suppose a circular queue of capacity (n-1) elements is implemented with an array of n elements. Assume that the insertion and deletion operations are carried out using REAR and FRONT as array index variables, respectively. Initially, REAR = FRONT = 0. The conditions to detect queue full and queue empty are
 A full: (REAR+1) mod n == FRONT empty: REAR == FRONT B full: (REAR+1) mod n == FRONT empty: (FRONT+1) mod n == REAR C full: REAR == FRONT empty: (REAR+1) mod n == FRONT D full: (FRONT+1) mod n == REAR empty: REAR == FRONT
GATE CSE 2012   Data Structure
Question 10 Explanation:
There are 10 questions to complete.

### 3 thoughts on “Queue”

1. Ques – 7; option A will be correct, not D. Kindly check.

• 2. 