Services
Discover
Homeschooling
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Java Programming
Quiz 13: Recursion
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 21
True/False
The overhead associated with iterative methods is greater in terms of both memory space and computer time compared to the overhead associated with executing recursive methods.
Question 22
True/False
A recursive solution is always a better alternative to an iterative solution.
Question 23
Multiple Choice
Which of the following is an invalid call to the method in the accompanying figure?
Question 24
Multiple Choice
What is the output of exampleRecursion(3) ?
Question 25
Multiple Choice
What is the output of exampleRecursion(0) ?
Question 26
True/False
Recursive algorithms are implemented using while loops.
Question 27
Multiple Choice
Given the code in the accompanying figure, which of the following method calls would result in the value 1 being returned?
Question 28
Multiple Choice
Consider the following definition of a recursive method. public static int foo(int n) //Line 1 { //Line 2 if (n == 0) //Line 3 return 0; //Line 4 else //Line 5 return n + foo(n - 1) ; //Line 6} Which of the statements represent the base case?
Question 29
Multiple Choice
What precondition must exist in order to prevent the code in the accompanying figure from infinite recursion?
Question 30
Multiple Choice
What is the limiting condition of the code in the accompanying figure?
Question 31
Multiple Choice
Which of the following statements about the code in the accompanying is always true?
Question 32
True/False
There are two base cases in the recursive implementation of generating a Fibonacci sequence.
Question 33
Multiple Choice
How many base cases are in the code in the accompanying figure?
Question 34
Multiple Choice
Which of the following statements describe the base case of a recursive algorithm? (i) F(0) = 0; (ii) F(x) = 2 * F(x - 1) ; (iii) if (x == 0) F(x) = 5 + x;
Question 35
Multiple Choice
What is the limiting condition of the code in the accompanying figure?
Question 36
Multiple Choice
What is the output of func2(2, 3) ?
Question 37
True/False
The limiting condition for a recursive method using a list might be the number of elements in the list.
Question 38
Multiple Choice
Which of the following statements is NOT true about infinite recursion?
Question 39
Multiple Choice
Consider the following definition of a recursive method. public static int recFunc(int num) {if (num >= 10) return 10; else return num * recFunc(num + 1) ;} What is the output of the following statement? System.out.println(recFunc(8) ) ;