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.

Host this setFree Play

The 20 questions

  1. What memory structure stores execution data for a single subroutine call?

    • Heap block
    • Vector array
    • Stack pointer
    • Stack frame
  2. Which item is stored in a stack frame alongside local variables and parameters?

    • Global variables
    • Heap pointers
    • Machine code
    • Return address
  3. 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
  4. Which operation adds a new stack frame when a subroutine is called?

    • Dequeue
    • Pop
    • Peek
    • Push
  5. What happens to a subroutine's stack frame when execution finishes?

    • It is popped
    • It is expanded
    • It is duplicated
    • It is saved
  6. 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
  7. 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
  8. Where are parameter values stored while a subroutine executes?

    • In global memory
    • In heap space
    • In stack frame
    • On hard disk
  9. Which memory access order makes a stack suitable for nested subroutine calls?

    • First-in, first-out
    • Random access
    • Direct access
    • Last-in, first-out
  10. Which structure automatically reclaims local variable memory when a subroutine ends?

    • Heap manager
    • Garbage collector
    • Operating system
    • Call stack
  11. What is stored in a stack frame alongside local variables and parameters?

    • Return address
    • Source code
    • Global variable
    • Heap pointer
  12. 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
  13. What structure stores return addresses, parameters, and local variables for subroutine calls?

    • Queue
    • Call stack
    • Hash table
    • Binary tree
  14. What error occurs when a recursive subroutine calls itself indefinitely?

    • Syntax error
    • Division by zero
    • Stack overflow
    • Type error
  15. 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
  16. Which register typically tracks the current top of the subroutine call stack?

    • Stack pointer
    • Base register
    • Program counter
    • Accumulator
  17. Where are local variables stored during a subroutine call?

    • Stack frame
    • Global memory
    • Hard drive
    • Disk storage
  18. Which value in a stack frame indicates where execution should continue after a subroutine ends?

    • Local variable
    • Return address
    • Passed parameter
    • Frame pointer
  19. A stack has frames for main, A and B. B returns. How many frames remain on the stack?

    • 3
    • 1
    • 0
    • 2
  20. What directly causes a stack overflow error during execution?

    • Excessive call depth
    • Syntax error
    • Missing output
    • Unused variables

All AQA Computer Science quizzes