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 problem of arranging matchsticks so as to form a row of squares, as shown below for three squares and ten matchsticks.

(Multiple Choice)
4.8/5
(39)
When a recursive method is called correctly, and it does not perform recursion, what must be true?
(Multiple Choice)
4.8/5
(43)
Complete the code for the calcPower recursive method shown below, which is intended to raise the base number passed into the method to the exponent power passed into the method:

(Multiple Choice)
4.9/5
(44)
Given the following code snippet:
What value will be returned when this code is executed with a call to newCalc(15)?

(Multiple Choice)
4.9/5
(44)
Consider the code for the recursive method riddle shown in this code snippet:
To avoid infinite recursion, which of the following lines of code should replace the current terminating case?

(Multiple Choice)
4.9/5
(35)
Given the following class code:
What values will be printed?

(Multiple Choice)
4.8/5
(40)
Consider the fib method from the textbook shown below.
Calling fib(3) will trigger ___ recursive call(s) and execute the terminating condition ___ time(s), respectively.

(Multiple Choice)
4.9/5
(31)
Complete the code for the calcPower recursive method shown below, which is intended to raise the base number passed into the method to the exponent power passed into the method:

(Multiple Choice)
4.9/5
(37)
Consider the square method shown below that takes a non-negative int argument.
What would a call to square(4) return?

(Multiple Choice)
4.8/5
(33)
Complete the following code snippet, which is intended to be a recursive method that reverses a String value:

(Multiple Choice)
4.9/5
(44)
A recursive method without a special terminating case would _________
(Multiple Choice)
4.7/5
(39)
Consider the following recursive code snippet:
}
Identify the terminating condition(s) of method mystery?

(Multiple Choice)
4.8/5
(40)
Consider the recursive method myPrint:
What is printed for the call myPrint(8)?

(Multiple Choice)
4.9/5
(43)
Consider the permutations method from the textbook, which is intended to return all permutations of the word passed in as a parameter.Which line contains the terminating condition in the permutations recursive method?

(Multiple Choice)
5.0/5
(38)
Which statement(s) about recursion are true?
i.Recursion is faster than iteration.
II.Recursion is often easier to understand than iteration.
III.Recursive design has an economy of thought.
(Multiple Choice)
5.0/5
(35)
Consider the problem of displaying a pattern of asterisks that form a triangle of height h, as shown below for h = 4:

(Multiple Choice)
4.7/5
(29)
Consider the permutations method from the textbook, which is intended to return all permutations of the word passed in as a parameter.What special cases for the simplest values are used by the permutations method to terminate the recursion?

(Multiple Choice)
4.9/5
(34)
Complete the code for the myFactorial recursive method shown below, which is intended to compute the factorial of the value passed to the method:

(Multiple Choice)
4.8/5
(44)
Recursion will take place if any of the following happen:
i.method A calls method B, which calls method C
II.method A calls method B, which calls method A
III.method A calls method A
(Multiple Choice)
4.9/5
(47)
Showing 21 - 40 of 99
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)