Stack Basics: 22 MCQs
All 22 multiple-choice questions from this kit, free and with no sign-up.
Warm-up · 13 questions
Q1. What is the fundamental principle followed by a stack data structure?
BeginnerAnswers and explanations are in the Veda app.
Q2. In an array-based stack, which end is used as the top of the stack?
BeginnerAnswers and explanations are in the Veda app.
Q3. What does the 'top' variable in an array-based stack represent?
BeginnerAnswers and explanations are in the Veda app.
Q4. What is the time complexity of the push operation in an array-based stack (without resizing)?
BeginnerAnswers and explanations are in the Veda app.
Q5. What condition indicates that an array-based stack is empty?
BeginnerAnswers and explanations are in the Veda app.
Q6. In an array-based stack, what does the pop operation do?
BeginnerAnswers and explanations are in the Veda app.
Q7. Which operation returns the top element without removing it?
BeginnerAnswers and explanations are in the Veda app.
Q8. What is the time complexity of the peek operation in an array-based stack?
BeginnerAnswers and explanations are in the Veda app.
Q9. In an array-based stack, what is the initial value of the top pointer?
BeginnerAnswers and explanations are in the Veda app.
Q10. In an array-based stack, the pop operation removes the element at the top of the stack.
BeginnerAnswers and explanations are in the Veda app.
Q11. The peek operation in a stack removes the top element from the stack.
BeginnerAnswers and explanations are in the Veda app.
Q12. In an array-based stack, what is the sequence of steps to perform a push operation? Include the overflow check.
BeginnerAnswers and explanations are in the Veda app.
Q13. Describe a real-world application of a stack and explain how the LIFO principle is used in that application.
BeginnerAnswers and explanations are in the Veda app.
Building up · 8 questions
Q14. What happens if you try to push onto a full array-based stack?
IntermediateAnswers and explanations are in the Veda app.
Q15. Which of the following is a common limitation of a fixed-size array-based stack?
IntermediateAnswers and explanations are in the Veda app.
Q16. What is the result of the expression: push(5), push(10), pop(), peek()?
IntermediateAnswers and explanations are in the Veda app.
Q17. Which of the following applications uses a stack?
IntermediateAnswers and explanations are in the Veda app.
Q18. What is the main advantage of an array-based stack over a linked-list stack?
IntermediateAnswers and explanations are in the Veda app.
Q19. Given an array-based stack with capacity 5, initially empty. Perform the following operations and show the final state of the stack (elements from bottom to top) and the value of `top`: push(3), push(7), pop(), push(9), push(2), pop(), peek().
IntermediateAnswers and explanations are in the Veda app.
Q20. Explain why the time complexity of all stack operations (push, pop, peek, isEmpty) is O(1) in an array-based implementation.
IntermediateAnswers and explanations are in the Veda app.
Q21. What are the consequences of not checking for stack overflow before a push and stack underflow before a pop in an array-based stack? Provide a specific example of each.
IntermediateAnswers and explanations are in the Veda app.
Topper level · 1 questions
Q22. Analyze the trade-offs between an array-based stack and a linked-list stack in terms of memory usage, performance, and flexibility. Under what conditions would you prefer the array-based version?
AdvancedAnswers and explanations are in the Veda app.
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