Exam 13: Recursion

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

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)

Recursive algorithms are implemented using while loops.

(True/False)
4.9/5
(38)

Every recursive definition can have zero or more base cases.

(True/False)
4.7/5
(25)

____ is NOT an iterative control structure.

(Multiple Choice)
4.9/5
(44)

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
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)