Solved

Consider the Following Definition of a Recursive Method

Question 11

Multiple Choice

Consider the following definition of a recursive method. public static int foo(int n) //Line 1
{ //Line 2
If (n == 0) //Line 3
Return 0; //Line 4
Else //Line 5
Return n + foo(n - 1) ; //Line 6
}Which of the statements represent the base case?


A) Statements in Lines 3 and 4
B) Statements in Lines 5 and 6
C) Statements in Lines 3, 4, and 5
D) None of these

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions