In a linked list-based stack implementation, what does the 'isEmpty()' operation typically check?
If the stack contains any elements with a value of zero
If the head pointer is pointing to NULL
If the stack has reached its maximum capacity
If the tail pointer is pointing to NULL
What is the purpose of the 'top' pointer in an array-based stack implementation?
To track the index of the next available position for insertion
To point to the bottom element of the stack
To store the value of the top element in the stack
To store the maximum size of the stack
What is the primary role of a stack in expression evaluation?
Converting infix expressions to postfix.
Storing the variables used in the expression.
Performing arithmetic calculations on operands.
Evaluating the precedence of operators.
In postfix evaluation, what action is taken when an operand is encountered?
It triggers the evaluation of operators on the stack.
It is ignored.
It is pushed onto the stack.
It is immediately evaluated.
Imagine a stack is used to track function calls in a recursive program. What happens to the stack when a function returns?
The corresponding function call is pushed onto the stack.
The stack remains unchanged.
The corresponding function call is popped from the stack.
The entire stack is cleared.
What is the primary disadvantage of implementing a stack using a fixed-size array?
Inability to handle stacks larger than the predetermined size
Complex implementation requiring advanced pointer manipulation
Increased time complexity for push and pop operations
Higher memory usage compared to dynamic arrays
Which of the following stack operations has a time complexity of O(1) in both array-based and linked list-based implementations?
Push
Peek
Pop
All of the above
What is the result of evaluating the prefix expression '-+5*234'?
7
-17
17
-7
What is the time complexity of the 'peek' operation in a well-implemented stack?
O(log n)
O(n)
O(1)
O(n log n)
Consider the scenario of undoing actions in a text editor. Which data structure would be most suitable for implementing an 'undo' feature?
Queue
Linked List
Binary Tree
Stack