1.
Given the following method. What is the output when
m1(5) is called?
public int m1 (int a)
{
if (a == 1)
return 10;
else
return 10 + m1 (a β 1);
}
-
50
-
This is a recursive method. It will return 10 when a is equal to 1, otherwise it will do a recursive call. Each call adds 10.
-
20
-
This would be true if the call was m(2).
-
60
-
This would be true if the call was m(6).
-
10
-
This would be true if the call was m(1).
-
30
-
This would be true if the call was m(3).

