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

A student is interested in whether students who study with music playing devote as much attention to their studies as do students who study under quiet conditio
how to convert a scientific notation into percent??
How do charges move through an insulated wire connected across a battery? Use the terms potential difference, current, conductor, and insulator in answer.
Describe the policy of appeasement and it emboldened Hitler leading up to World War II
what makes volcanoes violent?
Solve for X in y=12x-5
Angle kl bisects angle vkw. Classify angle vkw if measure of angle lkw is 25°
What is the correct order of stages in the life cycle of a salamander? A. egg --> pupa --> adult                      B. tadpole --> larva --> adult
what was the main idea of Martin Luther king jr I have a dream speech
The atomic mass of an element is 32.07 u and its atomic number is 16. The element forms a simple ion. The ion will most likely have a charge of (A) 1– (B) 2–