Multiple Choice
For the questions below, use the following recursive method.
public int question1_2(int x, int y)
{
if (x == y) return 0;
else return question1_2(x-1, y) + 1;
}
-The following method should return True if the int parameter is even and either positive or 0, and false otherwise. Which set of code should you use to replace ... so that the method works appropriately?
Public boolean question3(int x) { ... }
A) if (x = = 0) return True;else if (x < 0) return false;else return question3(x - 1) ;
B) if (x = = 0) return false;else if (x < 0) return True;else return question3(x - 1) ;
C) if (x = = 0) return True;else if (x < 0) return false;else return question3(x - 2) ;
D) if (x = = 0) return false;else if (x < 0) return True;else return question3(x - 2) ;
E) return(x = = 0) ;
Correct Answer:

Verified
Correct Answer:
Verified
Q18: We can define a list of int
Q20: Which of the following methods would properly
Q23: The difference between direct and indirect recursion
Q24: As identified in the text, some algorithms
Q26: For the questions below, refer to the
Q27: Which of the following recursive methods would
Q28: The following method recognizes whether a String
Q29: Rewrite the following iterative method as a
Q33: It always is possible to replace a
Q37: A Koch snowflake of order = 1