16) What does the following recursive method determine?
public boolean question16(int[ ]a, int[ ] b, int j)
{
if (j = = a.length) return false;
else if (j = = b.length) return true;
else return question16(a, b, j+1);
}
A) returns true if a and b are equal in size, false otherwise
B) returns true if a is larger than b, false otherwise
C) returns true if b is larger than a, false otherwise
D) returns true if a and b have no elements
E) returns the length of array a + length of array b
17) Why is the following method one which has infinite recursion?
public int infiniteRecursion(int n)
{
if (n > 0) return infiniteRecursion(n) + 1;
else return 0;
}
A) Because there is no base case
B) Because the base case will never be true
C) Because the recursive call does not move the parameter closer to the base case
D) Because the recursive call moves the problem further away from the base case
E) None of the above, there is no infinite recursion in this method
18) If there are 2 disks to move from one Tower to another, how many disk movements would it
take to solve the problem using the recursive solution?
A) 0
B) 1
C) 2
D) 3
E) 4