What happens when you perform an enqueue operation on a queue that is not full?
Think about where new items go in a queue.
In a queue, the enqueue operation adds a new element to the back (end) of the queue, preserving the order of elements.
If a queue has 5 elements and you perform one dequeue operation, how many elements remain in the queue?
Dequeue removes one element from the front.
Dequeue removes the front element, so the queue size decreases by one.
Consider an empty queue. You perform these operations in order: enqueue(10), enqueue(20), dequeue(), enqueue(30), dequeue(). What is the front element now?
Track the queue step-by-step after each operation.
After enqueue(10) and enqueue(20), queue is [10, 20]. Dequeue removes 10, queue is [20]. Enqueue(30) adds 30, queue is [20, 30]. Dequeue removes 20, queue is [30]. So front is 30.
What error or condition occurs if you try to dequeue from an empty queue?
Think about removing from an empty container.
Trying to remove an element from an empty queue causes an underflow error because there is nothing to remove.
Which statement correctly compares the enqueue operation in a queue implemented with a linked list versus an array?
Consider how elements are added in both implementations.
In a linked list, enqueue adds a node at the end without shifting. In arrays, enqueue may require shifting elements if not using circular buffer, making linked list enqueue generally faster.