Solved

Consider the Recursive Square Method Shown Below

Question 103

Multiple Choice

Consider the recursive square method shown below. It takes a non-negative int argument. Then it recursively adds the number n to itself n times to produce the square of n. Complete the correct code for the square helper method. public int square(int n)
{
____________________;
}
Public int square(int c, int n)
{
If (c == 1)
{
Return n;
}
Else
{
Return n + square(c - 1, n) ;
}
}


A) return square(n, n)
B) return square(n)
C) return square(n - 1, n)
D) return square(n, n - 1)

Correct Answer:

verifed

Verified

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

Related Questions