Solved

Consider the Following Definition of a Recursive Method

Question 1

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

Related Questions