Solved

Consider the Recursive Square Method Shown Below That Takes a Non-Negative

Question 18

Multiple Choice

Consider the recursive square method shown below that takes a non-negative int argument. public int square(int n)
{
Return square(n, n) ;
}
Public int square(int c, int n)
{
If (c == 1)
{
Return n;
}
Else
{
Return n + square(c - 1, n) ;
}
}
Assume that the last return statement is changed to this:
Return n * square(c - 1, n) ;
What would a call to square(4) return?


A) 4
B) 16
C) 64
D) 256

Correct Answer:

verifed

Verified

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

Related Questions