What is the worst-case time complexity of searching for an element in a queue implemented using a linked list?
O(n)
O(1)
O(log n)
O(n log n)
How does an array-based queue handle the underflow condition?
By overwriting the existing elements.
By dynamically resizing the array.
By using a circular array to reuse the empty spaces.
By raising an exception or returning an error value when attempting to dequeue from an empty queue.
What is the time complexity of enqueue and dequeue operations in a well-implemented array-based queue?
It depends on the size of the array.
O(n), where n is the number of elements in the 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'?
2
6
5
1
What data structure is used to implement a priority queue?
Stack
Array
Heap
Linked List
What is the primary disadvantage of using an array to implement a queue?
High memory usage
Inefficient search operations
Fixed size limitation
Complex implementation
What is the primary difference between a queue and a stack?
Queues store numbers, while stacks store characters.
Queues are linear data structures, while stacks are non-linear.
Queues use FIFO (First-In-First-Out), while stacks use LIFO (Last-In-First-Out).
Queues use LIFO (Last-In-First-Out), while stacks use FIFO (First-In-First-Out).
In which of these scenarios is a queue data structure a suitable choice?
Handling requests in a multi-threaded environment based on their arrival order.
Implementing an undo/redo functionality in a text editor.
Managing function calls in a recursive program.
Storing a list of recently opened files in an operating system.
Which of the following real-world scenarios can be effectively modeled using a queue?
Handling customer service requests in a first-come, first-served manner.
Storing the browsing history in a web browser.
Managing a priority-based task list.
What value does the 'isEmpty' operation on a queue return if the queue contains no elements?
The first element in the queue
0
True
-1