Multiple Choice
What does the following method compute? Assume the method is called initially with i = 0
Public int question9(String a, char b, int i)
{
If (i = = a.length( ) ) return 0;
Else if (b = = a.charAt(i) ) return question9(a, b, i+1) + 1;
Else return question9(a, b, i+1) ;
}
A) the length of String a
B) the length of String a concatenated with char b
C) the number of times char b appears in String a
D) returns 1 if char b appears in String a at least once, and 0 otherwise
E) the char which appears at location i in String a
Correct Answer:

Verified
Correct Answer:
Verified
Q15: For the Towers of Hanoi problem, show
Q19: Some problems are easier to solve recursively
Q28: Demonstrate how factorial(4) is computed given the
Q35: Provide a definition for the terms as
Q36: Recursion is a popular programming tool but
Q38: Rewrite the following iterative method as a
Q39: For the questions below, use the following
Q39: Since iterative solutions often use loop variables
Q45: Describe the difference(s) between the following two
Q54: Traversing a maze is much easier to