The purpose of this objective questions is to test how well you understand the concept of stack and queue.
Stack vs Queue
1. Stack and Queue both are linear data structure. In Stack insertions and deletions are allowed only at one end that is why it also called as LIFO (Last In First Out).
In queue insertion are performed on one end (Rear) and deletion is performed on other end (Front) it is also known as FIFO (First In First Out).
2. In Stack, insertion operation is known as Push whereas deletion operation is known as Pop.
In queue, insertion operation is known as Enqueue whereas deletion operation is known as Dequeue.
Application of Stack
a) In recursive function.
b) When function is called.
c) Expression conversion such as – Infix to Postfix ,Infix to Prefix, Postfix to Infix,Prefix to Infix.
Application of Queue
1) Serving requests of a single shared resource (printer, disk, CPU).
2) Transferring data asynchronously (data not necessarily received at same rate as sent) between two processes (IO buffers), e.g., pipes, file IO, sockets.
3) In consumer producer problem. When a resource is shared among multiple consumers. Examples include CPU scheduling, Disk Scheduling.
Stack and Queue MCQ
In stack push means insert an element in a stack. Pop means delete an element. Stack Implementation
push(5) push(8) pop push(2) push(5) pop pop pop push(1) pop
8 5 2 5 1
Stack worked on LIFO (Last in First out) principle.
8 5 5 2 1
8 2 5 5 1
8 1 2 5 5
In queue element is inserted at one end called rear and deleted at other end called front. Queue Implementation
Array and Binary Tree
Linked List and Graph
Array and Linked List
Queue and Linked List
D + (E * F)
EF * D+
DEF * +
Push and Pop
Enqueue and Dequeue
Insert and Delete
Implementation of Recursive Function
Allocation Resources and Scheduling
Evaluation of string in postfix form