In a stack implemented using a singly linked list, which end of the list typically represents the top of the stack?
Head
It can be either the head or the tail, depending on the implementation.
Tail
Middle
You need to implement a stack that can store a large number of items and the maximum number of items is unknown. Which implementation would be more suitable?
Stack using a doubly linked list
Stack using a singly linked list
Stack using a dynamic array
Stack using a fixed-size array
What is the time complexity of the 'peek' operation in a well-implemented stack?
O(n log n)
O(log n)
O(1)
O(n)
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 entire stack is cleared.
The stack remains unchanged.
The corresponding function call is popped from the stack.
If you represent an arithmetic expression in postfix notation using a stack, what operation would you perform when encountering an operand (a number)?
Pop the top two elements from the stack, perform the operation, and push the result back onto the stack.
Ignore the operand.
Check if the stack is empty.
Push the operand onto the stack.
In a linked list-based stack implementation, what does the 'isEmpty()' operation typically check?
If the head pointer is pointing to NULL
If the stack has reached its maximum capacity
If the stack contains any elements with a value of zero
If the tail pointer is pointing to NULL
What key advantage does a Deque (Double-ended Queue) offer over a Stack?
Deque allows deletions only at one end.
Deque is more memory-efficient than a Stack.
Deque allows insertions and deletions at both ends.
Deque allows insertions only at one end.
What is the primary role of a stack in expression evaluation?
Storing the variables used in the expression.
Converting infix expressions to postfix.
Evaluating the precedence of operators.
Performing arithmetic calculations on operands.
What is the primary difference between 'pop' and 'peek' operations on a stack?
'Pop' retrieves the top element's value, while 'peek' removes it from the stack.
'Pop' is used for stacks, while 'peek' is used for queues.
'Pop' removes the top element, while 'peek' only retrieves its value without removing it.
'Pop' and 'peek' are interchangeable terms for the same operation.
What is the primary disadvantage of implementing a stack using a fixed-size array?
Inability to handle stacks larger than the predetermined size
Higher memory usage compared to dynamic arrays
Increased time complexity for push and pop operations
Complex implementation requiring advanced pointer manipulation