What is the primary difference between a queue and a stack?
Queues store numbers, while stacks store characters.
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).
Queues are linear data structures, while stacks are non-linear.
In an array-based queue implementation, what happens when you dequeue from an empty queue?
An underflow condition occurs.
The queue remains unchanged.
The first element is removed.
The last element is removed.
What is a potential drawback of implementing a queue using an array with a fixed size?
Risk of queue overflow if the queue reaches its maximum capacity.
Increased time complexity for enqueue and dequeue operations.
Requirement of complex algorithms for insertion and deletion.
Inability to store elements of different data types.
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?
Graph
Heap
Queue
Binary Search Tree
How do you efficiently handle the situation where the array representing the queue becomes full?
Use a linked list instead of an array.
Delete the oldest element.
Resize the array to accommodate more elements.
Stop accepting new elements.
What is the purpose of the 'front' pointer in an array implementation of a queue?
It tracks the total number of elements in the queue.
It points to the next available empty location.
It points to the most recently added element.
It points to the element that has been in the queue the longest.
What is the primary characteristic that distinguishes a queue from other linear data structures?
Elements are added at one end and removed from the other.
Elements are added and removed from the same end.
It is a sorted data structure.
It allows for random access of elements.
Which real-world scenario best exemplifies the use of a queue data structure?
Tracking the order of tasks assigned to a CPU
Finding the shortest route between two points
Storing a family tree with ancestors and descendants
Managing a list of students sorted alphabetically
What is the main advantage of using a circular array for implementing a queue compared to a regular array?
Better handling of sorted data
Faster access to individual elements
Efficient utilization of space after multiple enqueue and dequeue operations
Reduced memory consumption
In a queue data structure, what does the 'enqueue' operation perform?
Adds an element to the rear of the queue.
Checks if the queue is empty.
Removes and returns the element at the front of the queue.
Adds an element to the front of the queue.