# Easy Multiple Choice QuestionsΒΆ

These problems are easier than most of those that you will usually see on the AP CS A exam.

11-6-1: Which line has the recursive call?

 1 2 3 4 5 6 public static int factorial(int n) { if (n == 0) return 1; else return n * factorial(n-1); } 
• (A) 1
• This is the method declaration. Look for a call to the same method in the body of the method.
• (B) 3
• This is a conditional, not a method call.
• (C) 4
• This is a return statement, not a method call.
• (D) 5
• This line contains a call to the same method which makes this method recursive.

11-6-2: Which line has the recursive call?

 1 2 3 4 5 6 7 8 public String starString(int n) { if (n == 0) { return "*"; } else { return starString(n - 1) + starString(n - 1); } } 
• (A) 1
• This is the method declaration. Look for a call to the same method in the body of the method.
• (B) 3
• This is a conditional, not a method call.
• (C) 4
• This is a return statement, not a method call.
• (D) 5
• This is an else which is part of a conditional, not a method call.
• (E) 6
• This line contains a call to the same method which makes this method recursive.

11-6-3: How many recursive calls does the following method contain?

 1 2 3 4 5 6 7 8 public static int fibonacci(int n) { if (n == 0) return 0; else if (n == 1) return 1; else return fibonacci(n-1) + fibonacci(n-2); } 
• (A) 0
• Look at line 7 more closely.
• (B) 1
• Many recursive methods only have one recursive call. But, this one has two.
• (C) 2
• Line 7 has two calls to fibonacci.
• (D) 3
• There are not 3 calls to fibonacci.

11-6-4: How many recursive calls does the following method contain?

 1 2 3 4 5 6 7 8 public static int multiplyEvens(int n) { if (n == 1) { return 2; } else { return 2 * n * multiplyEvens(n - 1); } } 
• (A) 0
• Look for a call to the same method in the body of the method.
• (B) 1
• Line 6 has one call to multiplyEvens.
• (C) 2
• Where do you see 2 calls to multiplyEvens?
• (D) 3
• Where do you see 3 calls to multiplyEvens?
Next Section - Medium Multiple Choice Questions