Stack: 19 MCQs

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

Warm-up · 9 questions

Q1. Which principle does a stack follow?

Beginner
A Last In, First Out (LIFO)
B Priority Order
C Random Access
D First In, First Out (FIFO)

Answers and explanations are in the Veda app.

Q2. Which operation adds an element to the top of a stack?

Beginner
A peek
B pop
C push
D enqueue

Answers and explanations are in the Veda app.

Q3. Which operation removes the top element from a stack?

Beginner
A pop
B peek
C dequeue
D push

Answers and explanations are in the Veda app.

Q4. What does the 'peek' operation do on a stack?

Beginner
A Adds an element to the bottom
B Checks if the stack is empty
C Returns the top element without removing it
D Removes the top element

Answers and explanations are in the Veda app.

Q5. If you push elements 1, 2, 3 onto a stack in that order, what will be the first element popped?

Beginner
A None
B 3
C 1
D 2

Answers and explanations are in the Veda app.

Q6. Which of the following is NOT a typical stack operation?

Beginner
A push
B pop
C peek
D enqueue

Answers and explanations are in the Veda app.

Q7. Which of the following is a real-world analogy for a stack?

Beginner
A A playlist in shuffle mode
B A stack of plates
C A round-robin tournament
D A line of people waiting for a bus

Answers and explanations are in the Veda app.

Q8. A stack is a FIFO data structure.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q9. The 'peek' operation removes the top element from the stack.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Building up · 9 questions

Q10. Which of the following is a common application of a stack?

Intermediate
A Round-robin scheduling
B Undo/Redo in text editors
C Breadth-first search
D CPU scheduling

Answers and explanations are in the Veda app.

Q11. Which data structure is used to implement function calls in most programming languages?

Intermediate
A Linked list
B Stack
C Tree
D Queue

Answers and explanations are in the Veda app.

Q12. What is the time complexity of push and pop operations on a stack implemented with an array?

Intermediate
A O(n)
B O(log n)
C O(n^2)
D O(1)

Answers and explanations are in the Veda app.

Q13. In the expression '2 3 +', which notation is used?

Intermediate
A Reverse Polish
B Postfix
C Prefix
D Infix

Answers and explanations are in the Veda app.

Q14. What is the result of evaluating the postfix expression '5 3 + 2 *'?

Intermediate
A 10
B 16
C 13
D 8

Answers and explanations are in the Veda app.

Q15. Which of the following problems is commonly solved using a stack?

Intermediate
A Balanced parentheses checking
B Finding the shortest path
C Hashing
D Sorting a list

Answers and explanations are in the Veda app.

Q16. What happens if you pop from an empty stack?

Intermediate
A It throws an underflow error
B It returns 0
C It returns null
D It creates a new element

Answers and explanations are in the Veda app.

Q17. What is the space complexity of a stack with n elements?

Intermediate
A O(n^2)
B O(n)
C O(log n)
D O(1)

Answers and explanations are in the Veda app.

Q18. Which of the following is NOT a typical use of a stack?

Intermediate
A Function call management
B Depth-first search
C Breadth-first search
D Expression evaluation

Answers and explanations are in the Veda app.

Topper level · 1 questions

Q19. Which of the following is a common application of stacks in compilers?

Advanced
A Code optimization
B Memory allocation
C Garbage collection
D Syntax analysis

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