Exam 13: Recursion
Exam 1: Introduction76 Questions
Exam 2: Using Objects82 Questions
Exam 3: Implementing Classes108 Questions
Exam 4: Fundamental Data Types124 Questions
Exam 5: Decisions119 Questions
Exam 6: Loops107 Questions
Exam 7: Arrays and Array Lists117 Questions
Exam 8: Designing Classes88 Questions
Exam 9: Inheritance99 Questions
Exam 10: Interfaces100 Questions
Exam 11: Input/Output and Exception Handling108 Questions
Exam 12: Object-Oriented Design104 Questions
Exam 13: Recursion99 Questions
Exam 14: Sorting and Searching100 Questions
Exam 15: The Java Collections Framework102 Questions
Exam 16: Basic Data Structures102 Questions
Exam 17: Tree Structures102 Questions
Exam 18: Generic Classes75 Questions
Exam 19: Stream Processing85 Questions
Exam 20: Graphical User Interfaces75 Questions
Exam 21: Advanced Input/Output90 Questions
Exam 22: Multithreading81 Questions
Exam 23: Internet Networking74 Questions
Exam 24: Relational Databases75 Questions
Exam 25: XML74 Questions
Select questions type
Consider the getArea method from the textbook shown below.
What will be the result?

Free
(Multiple Choice)
4.7/5
(32)
Correct Answer:
D
Consider the following recursive code snippet:
What parameter values for n would cause an infinite recursion problem in the following method?

Free
(Multiple Choice)
4.8/5
(48)
Correct Answer:
A
Consider the getArea method from the textbook shown below:
If line #1 was eliminated from the method, what would be the result when calling getArea?

Free
(Multiple Choice)
4.8/5
(35)
Correct Answer:
D
Consider the following code snippet for calculating Fibonacci numbers recursively:
Identify the terminating condition in this recursive method.

(Multiple Choice)
4.8/5
(37)
Consider the mutually recursive methods below.Select the method call that could be used to generate the output sequence: A5 B4 A3 B2 A1

(Multiple Choice)
4.9/5
(28)
How many recursive calls to the fib method shown below would be made from an original call to fib(4)? (Do not count the original call)

(Multiple Choice)
5.0/5
(45)
Consider the permutations method from the textbook, which is intended to return all permutations of the word passed in as a parameter.
If line #8 is changed to add the removed character to the end of each permutation of the shorter word, which change best describes the returned list?
result.add(s + word.charAt(i)); // line #8 revised

(Multiple Choice)
4.8/5
(45)
Consider the method powerOfTwo shown below:
How many recursive calls are made from the original call powerOfTwo(63) (not including the original call)?

(Multiple Choice)
4.8/5
(35)
Complete the following code snippet, which is intended to determine if a value is even or odd using mutual recursion:

(Multiple Choice)
4.8/5
(43)
In recursion, the non-recursive case is analogous to a loop ____.
(Multiple Choice)
4.8/5
(32)
A palindrome is a word or phrase that reads the same forward or backward.Consider the following code snippet:
What is the purpose of the palindrome method?

(Multiple Choice)
4.8/5
(40)
Which problem-solving technique examines partial solutions, abandons unsuitable ones, and returns to consider other candidate solutions.
(Multiple Choice)
4.9/5
(41)
Consider the iterative version of the fib method from the textbook shown below:
How many iterations of the for loop will there be for the call fib(6)?

(Multiple Choice)
4.9/5
(33)
In recursion, the recursive call is analogous to a loop ____.
(Multiple Choice)
4.9/5
(47)
Given the following code snippet:
What value will be returned when this code is executed with a call to newCalc(5)?

(Multiple Choice)
4.7/5
(37)
Consider the getArea method from the textbook shown below:
This would cause infinite recursion for ____.

(Multiple Choice)
4.9/5
(33)
Consider the method below, which displays the characters from a String in reverse order.Each character appears on a separate line.Select the statement that should be used to complete the method so that it performs a recursive method call correctly.

(Multiple Choice)
4.8/5
(44)
Consider the recursive version of the fib method from the textbook shown below:
How many total recursive calls (not counting the original call) to fib will be made from the original call of fib(7)?

(Multiple Choice)
4.8/5
(31)
Given the following class code:
What values will be printed when this code is executed?

(Multiple Choice)
4.7/5
(39)
Showing 1 - 20 of 99
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)