Stacks and Queues
4. Which of the following data structures works on the principle of First In, First Out (FIFO)?
1. What are the strategies or principles used in Stacks and Queues?
2. In a standard linked implementation, how many primary reference pointers are typically used for a stack and a queue?
3. How many queues are needed to implement a stack when no other data structure, such as an array or linked list, is available?
4. Which operation adds an element to a stack?
5. Which operation removes an element from a stack?
6. If a stack contains 5, 8, and 12 from bottom to top, which sequence of operations removes 12 first and then 8?
7. A queue initially contains A, B, and C from front to rear. If D is enqueued and two dequeue operations are performed, what remains from front to rear?
8. Why is a queue generally preferred over a stack when requests must be processed in the same order in which they arrive?
9. Which statement correctly distinguishes a stack from a queue?