Recall & Review
beginner Click to reveal answer
What does the push operation do in a stack?
It adds a new item to the top of the stack.
beginner Click to reveal answer
In a stack, where is the new element placed during a push operation?
At the top of the stack, above all existing elements.
intermediate Click to reveal answer
What happens if you try to push an element onto a full stack?
It causes a stack overflow error because there is no space to add the new element.
intermediate Click to reveal answer
Explain the time complexity of the push operation on a stack.
The push operation runs in O(1) time because it adds an element directly to the top without traversing the stack.
beginner Click to reveal answer
Show the result of pushing elements 1, then 2, then 3 onto an empty stack.
The stack will look like: 3 -> 2 -> 1 -> null (3 is at the top).
What is the position of the new element after a push operation on a stack?
✗ Incorrect
The push operation always adds the new element to the top of the stack.
What is the time complexity of the push operation on a stack?
✗ Incorrect
Push operation takes constant time O(1) because it adds the element directly on top.
What error occurs if you push onto a full stack?
✗ Incorrect
Pushing onto a full stack causes a stack overflow error.
If you push 5, then 10, then 15 onto an empty stack, what is the top element?
✗ Incorrect
The last pushed element (15) is at the top of the stack.
Which data structure principle does push operation follow?
✗ Incorrect
Stack follows Last In First Out (LIFO) principle, so push adds to the top.
Describe the push operation on a stack and what happens to the stack after pushing an element.
Think about where the new element goes and how the stack changes.
You got /4 concepts.
Explain what happens if you try to push an element onto a stack that is already full.
Consider the stack's capacity and what pushing means in that context.
You got /4 concepts.
