OA. free
Free
Qualcomm Embedded Systems & Hardware Embedded Systems & Hardware Medium

QUESTION 51 Which of the following data structures is used to implement recursion?

Qualcomm technical mcq question, verified with a worked answer. Free to practise - no sign-up.

QUESTION 51

Which of the following data structures is used to implement recursion?

Choose one option.
Show answer & explanation
Answer: A. Stack

Recursion is implemented using a stack data structure, commonly called the call stack or function call stack. When a function is called recursively, its parameters, local variables, and return address are pushed onto the stack. When the function returns, these values are popped off the stack in LIFO (Last-In-First-Out) order, which is exactly how stack operations work. The other options (Circular Queue, Queue, Array) do not provide the LIFO behavior needed for proper recursive function management.

Step-by-step Derivation:
Recursion works through the following mechanism: 1) When a recursive function is invoked, a new stack frame is created and pushed onto the call stack containing the function's parameters, local variables, and return address. 2) If the function calls itself recursively, another frame is pushed on top. 3) When a base case is reached and the innermost function returns, its frame is popped, restoring the previous function's context. 4) This continues until all recursive calls complete, unwinding the stack in reverse order. This LIFO (Last-In-First-Out) behavior is fundamental to how stacks work and is why they are used for recursion. Queues (FIFO), Circular Queues, and plain Arrays do not naturally support this behavior.