Queue Operations – Data Structure Questions and Answers

Computer Science & Engineering Data Structures & Algorithms

This set of Data Structure Multiple Choice Questions & Answers (MCQs) focuses on “Queue Operations”.

1. 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)ABDC

Explanation: The FIFO method is used in the queue. i.e. the “First in, First Out” technique. As a result, the elements should be omitted in the following order: ABCD.

2. A data structure in which elements can be inserted or deleted at/from both ends but not in the middle is?
A) Queue
B) Circular queue
C) Dequeue
D) Priority queue

Explanation: We can insert and remove elements from both ends in dequeuer. For insertion and deletion of elements in the queue, we can use the first in, first out theory. In a priority queue, the element with the lowest priority will be removed.

3. 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

Explanation: When Rear = MAX SIZE – 1, there isn’t enough space in the queue for the elements to be included. As a consequence, the queue fills up.

4. Queues serve major role in ______________
A) Simulation of recursion
B) Simulation of arbitrary linked list
C) Simulation of limited resource allocation
D) Simulation of heap sort

Explanation: The stack data structure is used to simulate recursion. Linked lists are used to simulate arbitrary linked lists. Since the first entered data needs to be given first priority during resource allocation, simulations of resource allocation use queues. Heap data structure is used to simulate heap sort.

5. Which of the following is not the type of queue?
A) Ordinary queue
B) Single ended queue
C) Circular queue
D) Priority queue

Explanation: There are often two ends of a queue. As a consequence, a single-ended queue is not the sort of queue to use.

6. 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) Queue
B) Stack
C) Tree
D) Linked list

Explanation: Queue is a linear array of elements in which deletion occurs at the front and insertion occurs at the back. In stack, the last element entered will be removed first.

7. The data structure required for Breadth First Traversal on a graph is?
A) Stack
B) Array
C) Queue
D) Tree

Explanation: BFS, or Breadth First Search Traversal, takes the starting vertex first, followed by adjacent unvisited vertices. To add further unvisited vertices to the graph, the first vertex that was added as an unvisited adjacent vertex list will be considered once more. The First In First Out theory must be observed to achieve the first unvisited vertex. The FIFO theory is used in the queue.

8. A queue follows __________
A) FIFO (First In First Out) principle
B) LIFO (Last In First Out) principle
C) Ordered array
D) Linear tree

Explanation: The first element added to the queue would be removed first, according to the FIFO principle.

9. Circular Queue is also known as ________
A) Ring Buffer
B) Square Buffer
C) Rectangle Buffer
D) Curve Buffer

Explanation: Ring Buffer is another name for Circular Queue. A circular queue is a linear data structure in which the first and last positions are connected to form a circle. It takes the shape of a bell.

A queue is a linear structure in which operations are carried out in a given order. First in, first out is the order (FIFO). Any queue of customers for a resource where the customer who arrived first is served first is a good example of a queue. Stacks and queues vary in how they are extracted. A queue is an abstract data form that is widely used in computing. It is based on the first-in-first-out (FIFO) principle. Queues are useful for situations where you want things to happen in the order they were called but the machine can’t keep up.

Leave a Reply

Your email address will not be published. Required fields are marked *