Examlex

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?


Definitions:

Related Questions