In: Computer Science
Q1:
Recursion is implemented by the system:
Group of answer choices:
using compile time storage allocation.
using run time storage allocation.
using static storage allocation.
using a single static "stack frame".
Solutions:-
Recursion is implemented by the system:-Ans:-b)using run time storage allocation.
There will be four options but option b) is the correct because of few reasons.I will expain below.
Let's come to the point-
Correct Answer:-
b)using run time storage allocation.
Wrong Answer:-
a)using compile time storage allocation.
c)using static storage allocation.
d)using a single static "stack frame".
Reasons:-
a)using compile time storage allocation:-
We know that compile time storage allocation is also known as a static memory allocation.Compile time memory allocation or storage allocation means reserving memory for constants,variables during the copilation process. Recursion can only be implemented dynamic memory allocaton that's why this option is wrong.
b)using run time storage allocation:-
Run time stroge allocation is known as dynamic memory allocation.Memory allocated runtime either calloc() ,malloc() or realloc() is called run time memory allocation or dynamic memory allocation.Recursion can only be implemented dynamic memory allocation. so, This option is correct option.
c)using static storage allocation:-
Previously i wrote anout static storage allocation .check option a) . Recursion can only be implemented dynamic memory allocaton that's why this option is wrong.
d)using a single static "stack frame":-
stack frame is nothing but it is known as activation record is the collection of all data on the stack associated with one subprogram call. It is Single static stack frame. It is not applicable for dynamic memory and Recursion can only be implemented dynamic memory allocation. so, This option is wrong option.