Stack Data Structure: 17 MCQs

All 17 multiple-choice questions from this kit, free and with no sign-up.

Warm-up · 7 questions

Q1. Which principle governs the order of operations in a stack?

Beginner
A LILO — Last In, Last Out
B FIFO — First In, First Out
C Random access order
D LIFO — Last In, First Out

Answers and explanations are in the Veda app.

Q2. At which position does a stack allow insertion and deletion?

Beginner
A At any index
B At both ends
C At the bottom only
D At the top only

Answers and explanations are in the Veda app.

Q3. Which operation returns the top element without removing it?

Beginner
A peek
B pop
C enqueue
D push

Answers and explanations are in the Veda app.

Q4. What is the time complexity of the push operation on a stack?

Beginner
A $O(\log n)$
B $O(n)$
C $O(1)$
D $O(n^2)$

Answers and explanations are in the Veda app.

Q5. A stack is called an abstract data type (ADT) because it:

Beginner
A allows random access to all elements
B must be implemented with an array
C defines behaviour without fixing the storage method
D stores only integers

Answers and explanations are in the Veda app.

Q6. Calling pop on an empty stack causes:

Beginner
A automatic resizing
B stack underflow
C stack overflow
D a segmentation fault

Answers and explanations are in the Veda app.

Q7. A stack enforces LIFO order, meaning the most recently pushed element is the first to be popped.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Building up · 5 questions

Q8. In a linked-list implementation of a stack, which node acts as the top?

Intermediate
A The middle node
B A randomly chosen node
C The head node
D The tail node

Answers and explanations are in the Veda app.

Q9. A fixed-size array stack of capacity 5 already holds 5 elements. What happens on the next push?

Intermediate
A The stack silently wraps around
B The stack reports overflow
C The oldest element is discarded
D The top index resets to 0

Answers and explanations are in the Veda app.

Q10. Why does a stack suit balanced-bracket checking?

Intermediate
A It matches the most recent unmatched opening bracket first
B It allows random access to any bracket
C It sorts brackets alphabetically
D It stores brackets in a queue

Answers and explanations are in the Veda app.

Q11. Which statement about a stack's access pattern is correct?

Intermediate
A Any element can be read by index in $O(1)$
B Elements are always sorted
C Both ends are directly reachable
D Only the top element is directly reachable

Answers and explanations are in the Veda app.

Q12. A program calls function f, which calls g, which calls h. Which function's frame is popped first when returns begin?

Intermediate
A h
B g
C All three are popped together
D f

Answers and explanations are in the Veda app.

Topper level · 5 questions

Q13. Which situation is a genuine advantage of a linked-list stack over a fixed-size array stack?

Advanced
A It offers faster random access to middle elements
B It removes the need for a top pointer
C It uses less memory per element
D It grows dynamically without a fixed capacity limit

Answers and explanations are in the Veda app.

Q14. A recursive function has no base case and keeps calling itself. What is the most likely outcome?

Advanced
A The program silently returns 0
B The stack automatically converts to a queue
C The call stack grows until a stack overflow occurs
D The stack underflows immediately

Answers and explanations are in the Veda app.

Q15. You need a structure where the most recently added item is processed first, and you also need to inspect that item before removing it. Which combination fits best?

Advanced
A A sorted array with binary search
B A hash table with key lookup
C A queue with enqueue and dequeue
D A stack with push, peek, and pop

Answers and explanations are in the Veda app.

Q16. Consider a stack implemented using a linked list. If you push three elements onto the stack, then pop two elements and finally push one more element, what will be the top element of the stack?

Advanced
A The last element pushed
B The stack will be empty
C The second element pushed
D The first element pushed

Answers and explanations are in the Veda app.

Q17. You have a stack that can hold a maximum of 10 elements. If you perform a series of operations: push 5 elements, pop 2 elements, push 4 elements, and then pop 1 element, what will be the current size of the stack?

Advanced
A 5
B 7
C 4
D 6

Answers and explanations are in the Veda app.

Make your own

Your notes can be a kit like these

Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free to start, in more than 40 languages.

  • Chapter notes
  • Flashcards
  • Practice MCQs
  • Scored tests
  • Paper Solver

Get Veda free See what students get

Free to start · Android app and web · More than 40 languages