Which structure allows you to reverse a string by pushing each character and then popping them sequentially?
A. Recursion
B. Array
C. Queue
D. Stack
D. Stack
What happens when you push to a full stack?
A. Returns -999
B. Throws exception
C. Stack expands
D. Clears stack
B. Throws exception
Which of the following is not a valid stack operation?
A. Peek
B. Push
C. Sort
D. Pop
C. Sort
Which of the following is a postfix expression?
A. + A B
B. A B +
C. A * (B + C)
D. A + B
B. A B +
Which method checks if the stack is empty?
A. peek
B. isFull
C. clear
D. isEmpty
D. isEmpty
What is the result of popping all elements from a stack?
A. Empty stack
B. Overflow
C. Segmentation fault
D. Full stack
A. Empty stack
Which operation removes the top item from the stack?
A. delete
B. peek
C. remove
D. pop
D. pop
Which data structure is used to reverse a string using stack logic?
A. Tree
B. Graph
C. Queue
D. Stack
D. Stack
What does the term LIFO stand for in stack operations?
A. Least Important First Out
B. Last Item First Out
C. Last In First Out
D. Last In Fast Out
C. Last In First Out
What is the time complexity of push and pop operations in a stack?
A. O(n)
B. O(log n)
C. O(1)
D. O(n²)
C. O(1)
What is the default top value when a new stack is created?
A. 0
B. null
C. -1
D. 1
C. -1
Which application uses stacks?
A. Hashing
B. Breadth-first search
C. Priority queue
D. Undo feature
D. Undo feature
Which of the following is true about postfix notation?
A. Operators come before operands
B. Operators come after operands
C. It’s ambiguous
D. Parentheses are required
B. Operators come after operands
Which of the following is true about stack ADT?
A. It allows random access
B. It has fixed size
C. It follows FIFO
D. It allows access only to the top
D. It allows access only to the top
What is the result of peek() on an empty stack?
A. null
B. -999
C. 0
D. top
A. null
Which Java class is used for predefined stack operations?
A. java.util.Array
B. java.util.List
C. java.util.Stack
D. java.util.Queue
C. java.util.Stack
What does the peek operation do in a stack?
A. Removes top
B. Views top
C. Clears stack
D. Adds top
B. Views top
Which data structure is typically used to implement a stack?
A. Queue
B. Array
C. Tree
D. Graph
B. Array
Which of the following is NOT a valid stack operation?
A. peek
B. push
C. delete
D. pop
C. delete
Which operation adds an item to the top of the stack?
A. pop
B. peek
C. insert
D. push
D. push
Which of the following is true about stack in system memory?
A. It stores static data
B. It stores heap
C. It stores global variables
D. It stores function calls
D. It stores function calls
In which of the following scenarios would the use of multiple stacks be a valid and common approach?
A. Binary Search
B. Expression Conversion and Evaluation
C. Hashing
D. Bubble Sort
B. Expression Conversion and Evaluation
What is the output of pushing 1, 2, 3 and popping once?
A. 3
B. 1
C. 0
D. 2
A. 3
Which of the following is true about linked list-based stack?
A. Dynamic size
B. Fixed size
C. Slower than array
D. Requires sorting
A. Dynamic size