Question Detail

COS 102 test topic Objective Question

Question

In programming fundamentals, what is recursion?
Options
A A loop that executes indefinitely
B A function calling itself directly or indirectly
Correct Answer
C Dynamic memory allocation at runtime
D Passing multiple arguments into a subroutine
Correct Answer

Option B is the correct answer.

Detailed Explanation

Recursion occurs when a subroutine solves a problem by invoking an instance of itself on a smaller subproblem.

Hint

No hint available

Question Info