Ask Question
27 February, 21:49

How many base cases are in the functionabove?

a. 0

b. 1

c. 2

d. 3

int func2 (int m, int n) {

if (n = = 0)

return 0;

else

return m + func2 (m, n-1);

}

+1
Answers (1)
  1. 27 February, 22:16
    0
    The answer is (b). 1.

    Explanation:

    In the code there is only 1 base case.

    the base case is as following:-

    if (n==0)

    return 0;

    this is the base case.

    Base case is the most important statement in the function that uses recursion because without base case the recursion calls will keep on going and we will get a run time error.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “How many base cases are in the functionabove? a. 0 b. 1 c. 2 d. 3 int func2 (int m, int n) { if (n = = 0) return 0; else return m + func2 ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers