Recall & Review
beginner
What is a stack in simple terms?
A stack is like a pile of plates where you can only add or remove the top plate. It follows Last In, First Out (LIFO) order.
Click to reveal answer
beginner
Why do we need a stack in programming?
Stacks help manage tasks that need to be done in reverse order, like undo actions, function calls, or matching brackets.
Click to reveal answer
intermediate
What problem does a stack solve in function calls?
It keeps track of where each function should return after finishing, so functions can call others and return correctly.
Click to reveal answer
intermediate
How does a stack help in expression evaluation?
Stacks store operators and operands to evaluate expressions in the correct order, especially with parentheses and operator precedence.
Click to reveal answer
beginner
What is the main rule of stack operations?
You can only add (push) or remove (pop) items from the top of the stack, following Last In, First Out (LIFO).
Click to reveal answer
What order does a stack follow?
✗ Incorrect
A stack follows Last In, First Out (LIFO), meaning the last item added is the first to be removed.
Which problem is best solved by using a stack?
✗ Incorrect
Undo features use stacks to reverse actions in the order they were done.
In function calls, what does the stack keep track of?
✗ Incorrect
The stack stores return addresses so the program knows where to continue after a function finishes.
Which operation is NOT allowed directly on a stack?
✗ Incorrect
Stacks only allow adding or removing items from the top, not inserting at the bottom.
How does a stack help with matching parentheses?
✗ Incorrect
Stacks store opening brackets and check for matching closing brackets in correct order.
Explain why a stack is useful in managing function calls.
Think about how functions call other functions and need to return to the right place.
You got /4 concepts.
Describe how a stack helps solve problems involving reversing actions or order.
Consider situations where the last thing done must be undone first.
You got /4 concepts.
