0% found this document useful (0 votes)
53 views4 pages

Stack MCQs

The document contains multiple choice questions related to stacks in data structures, covering definitions, operations, time complexities, and applications. Key concepts include the LIFO structure of stacks, operations like push and pop, and the advantages of different implementations. It also addresses common issues like underflow and overflow, as well as the use of stacks in recursion and expression evaluation.

Uploaded by

chanchalmajhi69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views4 pages

Stack MCQs

The document contains multiple choice questions related to stacks in data structures, covering definitions, operations, time complexities, and applications. Key concepts include the LIFO structure of stacks, operations like push and pop, and the advantages of different implementations. It also addresses common issues like underflow and overflow, as well as the use of stacks in recursion and expression evaluation.

Uploaded by

chanchalmajhi69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Multiple Choice Questions on Stack

1. 1. What is a stack in data structures?


A) A FIFO (First In First Out) structure
B) A LIFO (Last In First Out) structure
C) A FILO (First In Last Out) structure
D) Both B and C
Answer: D) Both B and C

2. 2. Which of the following operations is not performed on a stack?


A) Push
B) Pop
C) Peek
D) Enqueue
Answer: D) Enqueue

3. 3. What is the time complexity of the push and pop operations in a stack (assuming no resizing)?
A) O(1)
B) O(n)
C) O(log n)
D) O(n²)
Answer: A) O(1)

4. 4. What happens when you pop from an empty stack?


A) Underflow
B) Overflow
C) The stack resets
D) A new stack is created
Answer: A) Underflow

5. 5. What is the result of the following sequence of operations? Push(10), Push(20), Pop(),
Push(30), Peek()
A) 10
B) 20
C) 30
D) Stack is empty
Answer: C) 30

6. 6. What data structure can be used to convert infix expressions to postfix expressions?
A) Queue
B) Stack
C) Tree
D) Linked List
Answer: B) Stack

7. 7. Which data structure is used in function call recursion?


A) Queue
B) Stack
C) Heap
D) Linked List
Answer: B) Stack

8. 8. What does the 'peek' operation do in a stack?


A) Removes the top element
B) Returns the top element without removing it
C) Checks if the stack is empty
D) Returns the bottom element
Answer: B) Returns the top element without removing it

9. 9. What is the maximum number of elements that can be stored in a stack of size n?
A) n-1
B) n
C) n+1
D) 2n
Answer: B) n

10. 10. Which condition indicates that a stack is full?


A) Top == -1
B) Top == size - 1
C) Top == size + 1
D) Top == 0
Answer: B) Top == size - 1

11. 11. In which case does a stack overflow occur?


A) When too many elements are popped
B) When a stack is empty
C) When more elements are pushed than its size
D) When accessing an element out of range
Answer: C) When more elements are pushed than its size

12. 12. A stack can be implemented using which data structure?


A) Array
B) Linked List
C) Both A and B
D) None of the above
Answer: C) Both A and B

13. 13. Which type of memory is typically used for implementing stacks in function calls?
A) Heap
B) Stack memory
C) Queue
D) Registers
Answer: B) Stack memory

14. 14. Which of the following applications use stacks?


A) Undo/Redo feature in text editors
B) Expression evaluation
C) Backtracking (Maze solving, Sudoku, etc.)
D) All of the above
Answer: D) All of the above

15. 15. What is the main advantage of using a linked list to implement a stack instead of an array?
A) Dynamic size adjustment
B) Faster operations
C) Requires less memory
D) Simple implementation
Answer: A) Dynamic size adjustment

16. 16. Which of the following is not an application of a stack?


A) Reversing a string
B) Managing function calls
C) Implementing a queue
D) Depth-first search (DFS)
Answer: C) Implementing a queue

17. 17. What is the postfix expression for the infix expression (A + B) * C?
A) AB + C *
B) A B + C *
C) A B C * +
D) A + B * C
Answer: B) A B + C *

18. 18. In the implementation of a stack using an array, where is the top of the stack initialized?
A) 0
B) 1
C) -1
D) Size of the array
Answer: C) -1

19. 19. What is the main drawback of implementing a stack using an array?
A) Stack overflow can occur if the array is full
B) Stack underflow can occur if the stack is empty
C) Both A and B
D) None of the above
Answer: C) Both A and B

20. 20. What is the advantage of a circular stack over a linear stack?
A) More efficient memory utilization
B) Faster access times
C) Easier implementation
D) More memory required
Answer: A) More efficient memory utilization

You might also like