Lesson 4.1.1.15
4.1.1.15 Stack frames in subroutine calls Quiz: AQA Computer Science, Unit 1
20 questions
In partnership with Revision Ninja
Lesson 4.1.1.15, Stack frames in subroutine calls: 20 multiple choice questions for the AQA Computer Science (7517), Unit 1: Fundamentals of programming, written with Revision Ninja.
Host it live on the board and students join with a game code on their own devices, or revise alone with Free Play. The answers are revealed in the game.
The 20 questions
-
What memory structure stores execution data for a single subroutine call?
- Heap block
- Vector array
- Stack pointer
- Stack frame
-
Which item is stored in a stack frame alongside local variables and parameters?
- Global variables
- Heap pointers
- Machine code
- Return address
-
Why is a return address saved in a stack frame during a subroutine call?
- To pass arguments
- To store globals
- To resume execution
- To allocate heap
-
Which operation adds a new stack frame when a subroutine is called?
- Dequeue
- Pop
- Peek
- Push
-
What happens to a subroutine's stack frame when execution finishes?
- It is popped
- It is expanded
- It is duplicated
- It is saved
-
A main program calls A, and A calls B. How many frames are on the stack while B is executing, including the main program's frame?
- 1
- 4
- 2
- 3
-
A recursive subroutine is called once from the main program. It then calls itself 4 more times before reaching its base case, with no other calls. How many stack frames exist at the deepest point, counting the main program?
- 5
- 7
- 6
- 4
-
Where are parameter values stored while a subroutine executes?
- In global memory
- In heap space
- In stack frame
- On hard disk
-
Which memory access order makes a stack suitable for nested subroutine calls?
- First-in, first-out
- Random access
- Direct access
- Last-in, first-out
-
Which structure automatically reclaims local variable memory when a subroutine ends?
- Heap manager
- Garbage collector
- Operating system
- Call stack
-
What is stored in a stack frame alongside local variables and parameters?
- Return address
- Source code
- Global variable
- Heap pointer
-
Main calls subroutine P, which calls subroutine Q. Which stack frame is popped first?
- All simultaneously
- Frame for Main
- Frame for Q
- Frame for P
-
What structure stores return addresses, parameters, and local variables for subroutine calls?
- Queue
- Call stack
- Hash table
- Binary tree
-
What error occurs when a recursive subroutine calls itself indefinitely?
- Syntax error
- Division by zero
- Stack overflow
- Type error
-
A subroutine has three local variables and two parameters. How many values does its stack frame hold for those items alone?
- 3
- 6
- 2
- 5
-
Which register typically tracks the current top of the subroutine call stack?
- Stack pointer
- Base register
- Program counter
- Accumulator
-
Where are local variables stored during a subroutine call?
- Stack frame
- Global memory
- Hard drive
- Disk storage
-
Which value in a stack frame indicates where execution should continue after a subroutine ends?
- Local variable
- Return address
- Passed parameter
- Frame pointer
-
A stack has frames for main, A and B. B returns. How many frames remain on the stack?
- 3
- 1
- 0
- 2
-
What directly causes a stack overflow error during execution?
- Excessive call depth
- Syntax error
- Missing output
- Unused variables
Related quizzes
- Data types Quiz · 4.1.1.1 · 20 questions
- Programming concepts: sequence, selection and iteration Quiz · 4.1.1.2 · 20 questions
- Arithmetic operations Quiz · 4.1.1.3 · 20 questions
- Relational and Boolean operations Quiz · 4.1.1.4 · 20 questions
- Constants and variables Quiz · 4.1.1.6 · 20 questions
- String-handling operations Quiz · 4.1.1.7 · 20 questions
- Random numbers and exception handling Quiz · 4.1.1.8 · 20 questions
- Subroutines Quiz · 4.1.1.10 · 20 questions
- Parameters and returning values Quiz · 4.1.1.11 · 20 questions
- Local and global variables Quiz · 4.1.1.13 · 20 questions