pop() without index removes last element, not front as queue requires.
Step 2: Check queue correctness
Queue must remove front element, so pop(0) should be used instead of pop().
Final Answer:
pop() removes last element, not front -> Option A
Quick Check:
Queue removal = pop(0) front [OK]
Hint: Use pop(0) to dequeue from front [OK]
Common Mistakes:
Using pop() removes last, not front
Confusing append usage
Thinking queue is a dictionary
5. Given a fixed-size array of length 3, what happens if you try to enqueue 4 elements in a queue implemented using this array without resizing or circular logic?
hard
A. The queue automatically resizes to fit 4 elements
B. The 4th element replaces the first element
C. The queue overflows and cannot add the 4th element
D. The queue removes the last element to add the 4th
Solution
Step 1: Understand fixed-size array limits
An array of length 3 can hold only 3 elements; no extra space for 4th.
Step 2: Check enqueue behavior without resizing
Without resizing or circular logic, adding 4th element causes overflow error or failure.
Final Answer:
The queue overflows and cannot add the 4th element -> Option C