Activity 01
Simulation Game: The Call Stack in Action
Assign each student a function name written on a card (main, calculate, validate, format). As the teacher narrates a recursive scenario, students stack their cards on a central pile when their function is called and retrieve them when the function returns. Students see firsthand how the call stack grows and shrinks and what a stack overflow looks like when the pile gets too large.
Explain how stack structures facilitate undo mechanisms or expression parsing.
Facilitation TipDuring the Call Stack simulation, have students physically stand up and sit down to represent function calls entering and exiting the stack, reinforcing the temporal sequence of the LIFO principle.
What to look forPresent students with a sequence of push and pop operations for a stack (e.g., push(A), push(B), pop(), push(C), pop(), pop()). Ask them to write down the state of the stack after each operation and the final element returned by the last pop.