Exam 13: Recursion
Exam 1: An Overview of Computers and Programming Languages50 Questions
Exam 2: Basic Elements of Java50 Questions
Exam 3: Introduction to Objects and Input/output50 Questions
Exam 4: Control Structures I: Selection50 Questions
Exam 5: Control Structures II: Repetition50 Questions
Exam 6: Graphical User Interface GUI and Object-Oriented Design OOD50 Questions
Exam 7: User-Defined Methods50 Questions
Exam 8: User-Defined Classes50 Questions
Exam 9: Arrays46 Questions
Exam 10: Inheritance and Polymorphism50 Questions
Exam 11: Handling Exceptions and Events50 Questions
Exam 12: Advanced Guis and Graphics48 Questions
Exam 13: Recursion50 Questions
Exam 14: Applications of Arrays Searching and Sorting and Strings50 Questions
Select questions type
Which of the following statements is NOT true about infinite recursion?
(Multiple Choice)
4.8/5
(45)
The body of a recursive method contains a statement that causes the same method to execute before completing the current call.
(True/False)
4.8/5
(47)
public static int func1(int m, int n)
{
If (m == n || n == 1)
Return 1;
Else
Return func1(m - 1, n - 1) + n * func1(m - 1, n);
}Given the code in the accompanying figure, which of the following method calls would result in the value 1 being returned?
(Multiple Choice)
4.7/5
(33)
public static int func1(int m, int n)
{
If (m == n || n == 1)
Return 1;
Else
Return func1(m - 1, n - 1) + n * func1(m - 1, n);
}What precondition must exist in order to prevent the code in the accompanying figure from infinite recursion?
(Multiple Choice)
4.8/5
(38)
To design a recursive method, you must determine the limiting conditions.
(True/False)
4.9/5
(45)
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(10));
(Multiple Choice)
4.8/5
(32)
The recursive implementation of the factorial method is an example of a tail recursive method.
(True/False)
4.9/5
(34)
Showing 41 - 50 of 50
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)