In a circular queue implemented using an array of size 5, the front is at index 3, and the rear is at index 1. What happens after two dequeue operations?
The front moves to index 0, and the rear remains at index 1.
The front moves to index 0, and the rear moves to index 4.
The queue becomes empty.
The front moves to index 1, and the rear moves to index 4.
What value does the 'isEmpty' operation on a queue return if the queue contains no elements?
-1
0
True
The first element in the queue
What is the primary difference between a queue and a stack?
Queues use LIFO (Last-In-First-Out), while stacks use FIFO (First-In-First-Out).
Queues use FIFO (First-In-First-Out), while stacks use LIFO (Last-In-First-Out).
Queues store numbers, while stacks store characters.
Queues are linear data structures, while stacks are non-linear.
What is the primary characteristic that distinguishes a queue from other linear data structures?
Elements are added and removed from the same end.
Elements are added at one end and removed from the other.
It allows for random access of elements.
It is a sorted data structure.
Which of the following operations on a queue does NOT have a time complexity of O(1) in a standard implementation?
Searching for a specific element
Enqueue
isEmpty
Dequeue
What is the worst-case time complexity of searching for an element in a queue implemented using a linked list?
O(1)
O(n)
O(log n)
O(n log n)
If you were to design a system to handle customer service requests arriving through various channels, with each request needing to be addressed in the order it was received, which data structure would be most appropriate?
Binary Search Tree
Heap
Graph
Queue
Consider an array-based queue with 'front' at index 3 and 'rear' at index 7. After two dequeue operations, what will be the new value of 'front'?
5
1
2
6
Imagine a print queue in a busy office environment. Which data structure, implemented using an array, would be most suitable for managing this print queue effectively?
Stack
Hash Table
Binary Tree
Circular Queue
In which of these scenarios is a queue data structure a suitable choice?
Managing function calls in a recursive program.
Storing a list of recently opened files in an operating system.
Implementing an undo/redo functionality in a text editor.
Handling requests in a multi-threaded environment based on their arrival order.