Data Structure MCQ - Queue

This section focuses on the "Queue" of the Data Structure. These Multiple Choice Questions (mcq) should be practiced to improve the Data Structure skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

1. Which one of the following is an application of Queue Data Structure?

A. When a resource is shared among multiple consumers.
B. When data is transferred asynchronously (data not necessarily received at same rate as sent) between two processes
C. Load Balancing
D. All of the above

View Answer


2. In linked list implementation of queue, if only front pointer is maintained, which of the following operation take worst case linear time?

A. Insertion
B. Deletion
C. To empty a queue
D. Both Insertion and To empty a queue

View Answer


3. Let the following circular queue can accommodate maximum six elements with the following data.What will happen after ADD O operation takes place?

 
front = 2 rear = 4
queue = _______; L, M, N, ___, ___

A. front = 2 rear = 5
   queue = ______; L, M, N, O, ___
B. front = 3 rear = 5
   queue = L, M, N, O, ___
C. front = 3 rear = 4
   queue = ______; L, M, N, O, ___
D. front = 2 rear = 4
   queue = L, M, N, O, ___

View Answer


4.How many stacks are needed to implement a queue. Consider the situation where no other data structure like arrays, linked list is available to you.

A. 1
B. 2
C. 3
D. 4

View Answer


5.In a Queue, if a user tries to remove an element from empty Queue it is called _________.

A. Underflow
B. Empty collection
C. Overflow
D. Garbage Collection

View Answer


6. If the elements "A", "B", "C" and "D" are placed in a queue and are deleted one at a time, in what order will they be removed?

A. ABCD
B. DCBA
C. DCAB
D. ABCD

View Answer


7.A priority queue can efficiently implemented using which of the following data structures? Assume that the number of insert and peek (operation to see the current highest priority item) and extraction (remove the highest priority item) operations are almost same

A. Array
B. Linked List
C. Heap Data Structures like Binary Heap, Fibonacci Heap
D. None of the above

View Answer


8. In case of insertion into a linked queue, a node borrowed from the __________ list is inserted in the queue.

A. AVAIL
B. FRONT
C. REAR
D. None of the mentioned

View Answer


9.If the MAX_SIZE is the size of the array used in the implementation of circular queue. How is rear manipulated while inserting an element in the queue?

A. rear=(rear%1)+MAX_SIZE
B. rear=rear%(MAX_SIZE+1)
C. rear=(rear+1)%MAX_SIZE
D. rear=rear+(1%MAX_SIZE)

View Answer


10.Suppose a circular queue of capacity (n – 1) elements is implemented with an array of n elements. Assume that the insertion and deletion operation 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

View Answer


11. A linear list of elements in which deletion can be done from one end (front) and insertion can take place only at the other end (rear) is known as a ?

A Queue
B Stack
C. Tree
D. Linked list

View Answer


12. The data structure required for Breadth First Traversal on a graph is?

A. Stack
B. Array
C. Queue
D. Tree

View Answer


13. A queue is a ?

A. FIFO (First In First Out) list
B. LIFO (Last In First Out) list
C. Ordered array
D. Linear tree

View Answer


14. In Breadth First Search of Graph, which of the following data structure is used?

A. Stack
B. Queue
C. Linked list
D. None of the mentioned

View Answer


15. A data structure in which elements can be inserted or deleted at/from both the ends but not in the middle is?

A. Queue
B. Circular queue
C. Dequeue
D. Priority queue

View Answer


16. A normal queue, if implemented using an array of size MAX_SIZE, gets full when

A. Rear = MAX_SIZE – 1
B Front = (rear + 1)mod MAX_SIZE
C. Front = rear + 1
D> Rear = front

View Answer


17. Queues serve major role in

A. Simulation of recursion
B. Simulation of arbitrary linked list
C. Simulation of limited resource allocation
D. All of the mentioned

View Answer


18. Which of the following is not the type of queue?

A. Ordinary queue
B. Single ended queue
C. Circular queue
D. Priority queue

View Answer


19. Which of the following properties is associated with a queue?

A. First In Last Out
B. First In First Out
C. Last In First Out
D. None of the mentioned

View Answer


20. What does the following piece of code do?

 
public Object function()
{
if(isEmpty())
return -999;
else
{
Object high;
high = q[front];
return high;
}
}

A. Dequeue
B. Enqueue
C. Return the front element
D. None of the mentioned

View Answer






Also Check :


Discussion



* You must be logged in to add comment.