Bxbigboy7845 Bxbigboy7845
  • 19-07-2019
  • Computers and Technology
contestada

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);

}

Respuesta :

ExieFansler ExieFansler
  • 23-07-2019

Answer:

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.

Answer Link

Otras preguntas

If you were an advisor to the Mexican government, what would you suggest to alleviate the water problem
Steps in the transmission of monetary policy are question 67 options: a.the federal reserve increases government expenditures on goods and services, leading to
The baker combined all of the dry ingredients into a mixing bowl. he slowly added the wet ingredients, stirring consistently as he created the dough. which opti
what was the being in the army like for African Americans?
Evaluate 8 − 12 ÷ 2 + 3. 1 −1 4 5
What two factors determine the desirability of food? Explain.
True or false: most drugs are eliminated by the kidneys in urine although some are excreted in saliva, sweat, or exhalation. a. True b. False
Constitution assembly was a galaxy of best Indian justify by giving examples
How do you factor 9x^3 + 64 (Please show steps)
To place and as in a newspaper, it cost $8 plus $0.75 for each line. Write and evaluate an expression to find the total cost for an ad that has 6 lines. Then ma