Question : What is a Stack?
Solution :
Correct Answer : Linear data structure following LIFO
Description -
Question : Which operation inserts an element into a stack?
Solution :
Correct Answer : Push
Description -
Question : Which operation removes the top element from a stack?
Solution :
Correct Answer : Pop
Description -
Question : Which element can be accessed directly in a stack?
Solution :
Correct Answer : Top element
Description -
Question : What is the time complexity of Push operation?
Solution :
Correct Answer : O(1)
Description -
Question : What is the time complexity of Pop operation?
Solution :
Correct Answer : O(1)
Description -
Question : Which condition occurs when attempting to pop from an empty stack?
Solution :
Correct Answer : Underflow
Description -
Question : Which condition occurs when pushing into a full array stack?
Solution :
Correct Answer : Overflow
Description -
Question : In an array implementation of stack, the top pointer initially is usually:
Solution :
Correct Answer : -1
Description -
Question : Which notation uses stacks for evaluation?
Solution :
Correct Answer : All of these
Description -
Question : If stack contains [10, 20, 30] (30 at top), after one pop?
Solution :
Correct Answer : [10,20]
Description -
Question : What will be the top element after pushing 5, 10, 15?
Solution :
Correct Answer : 15
Description -
Question : Which function returns the top element without removing it?
Solution :
Correct Answer : Peek/Top
Description -
Question : In linked list implementation of stack, insertion occurs at:
Solution :
Correct Answer : Head
Description -
Question : What is the space complexity of a stack containing n elements?
Solution :
Correct Answer : O(n)
Description -
Question : Which data structure is used in function call management?
Solution :
Correct Answer : Stack
Description -
Question : What is the output?
Push(1)
Push(2)
Pop()
Push(3)
Top element = ?
Solution :
Correct Answer : 3
Description -
Question : Which application uses stack?
Solution :
Correct Answer : All of these
Description -
Question : Linked list stack avoids:
Solution :
Correct Answer : Overflow due to fixed size
Description -
Question : In array stack of size 5, if top = 4:
Solution :
Correct Answer : Full stack
Description -
Question : What is the postfix expression of A + B * C?
Solution :
Correct Answer : ABC*+
Description -
Question : Evaluate postfix:
5 2 + 3 *
Solution :
Correct Answer : 21
Description -
Question : Which stack application checks balanced parentheses?
Solution :
Correct Answer : Parenthesis Matching
Description -
Question : For array stack:
Push(10)
Push(20)
Push(30)
Pop()
Push(40)
Top element?
Solution :
Correct Answer : 40
Description -
Question : In linked-list stack, push operation complexity is:
Solution :
Correct Answer : O(1)
Description -
Question : What is the output?
Push(1)
Push(2)
Push(3)
Pop()
Pop()
Remaining top?
Solution :
Correct Answer : 1
Description -
Question : Which traversal of a binary tree can be implemented using a stack?
Solution :
Correct Answer : DFS
Description -
Question : Maximum number of elements in an array stack of size n is:
Solution :
Correct Answer : n
Description -
Question : Consider stack operations:
Push(5)
Push(10)
Push(15)
Pop()
Push(20)
Pop()
Current top?
Solution :
Correct Answer : 10
Description -
Question : What is the postfix form of:
(A+B)*(C-D)
Solution :
Correct Answer : AB+CD-*
Description -