Exam 15: Recursion

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

Every call to a recursive function requires the system to allocate memory for the local variables and formal parameters.

Free
(True/False)
4.9/5
(36)
Correct Answer:
Verified

True

Consider the following code. Consider the following code.    The function fact is an example of a(n) ____________________ recursive function. The function fact is an example of a(n) ____________________ recursive function.

Free
(Short Answer)
4.8/5
(29)
Correct Answer:
Verified

tail

Consider the following definition of the recursive function print. What is the output of the following statement? Print(4); Consider the following definition of the recursive function print. What is the output of the following statement? Print(4);

Free
(Multiple Choice)
4.9/5
(38)
Correct Answer:
Verified

C

Which of the following function headings can be used for a recursive definition of a function to calculate the nth Fibonacci number?

(Multiple Choice)
4.9/5
(37)

The ____________________ Fibonacci number in a sequence is the sum of the second and third Fibonacci numbers.

(Short Answer)
4.9/5
(34)

  -Consider the accompanying definition of the recursive function mystery.Given the declaration:int beta[10] = {2, 5, 8, 9, 13, 15, 18, 20, 23, 25}; What is the output of the following statement? Cout << mystery(beta, 4, 7) << endl; -Consider the accompanying definition of the recursive function mystery.Given the declaration:int beta[10] = {2, 5, 8, 9, 13, 15, 18, 20, 23, 25}; What is the output of the following statement? Cout << mystery(beta, 4, 7) << endl;

(Multiple Choice)
4.9/5
(44)

  -Consider the accompanying definition of a recursive function.What is the output of the following statement? cout << recFunc(10) << endl; -Consider the accompanying definition of a recursive function.What is the output of the following statement? cout << recFunc(10) << endl;

(Multiple Choice)
4.9/5
(38)

Which of the following rules should you follow to solve the Tower of Hanoi problem?

(Multiple Choice)
4.8/5
(43)

The following is an example of a recursive function, where nextNum is a function such that nextNum(x) = x + 1. The following is an example of a recursive function, where nextNum is a function such that nextNum(x) = x + 1.

(True/False)
4.9/5
(41)

With recursion, the base case must eventually be reduced to a general case.

(True/False)
4.9/5
(33)

Tracing through ____ recursion is more tedious than tracing other recursive forms.

(Multiple Choice)
4.8/5
(35)

Consider the following definition of the recursive function mystery. What is the output of the following statement? Cout << mystery(6, 10) << endl; Consider the following definition of the recursive function mystery. What is the output of the following statement? Cout << mystery(6, 10) << endl;

(Multiple Choice)
4.8/5
(31)

In the Tower of Hanoi recursive program, if needle 1 contains three disks, then the number of moves required to move all three disks from needle 1 to needle 3 is 8.

(True/False)
4.8/5
(34)

The following is a valid recursive definition to determine the factorial of a non-negative integer. The following is a valid recursive definition to determine the factorial of a non-negative integer.

(True/False)
4.7/5
(47)

____ control structures use a looping structure, such as while, for, or do...while, to repeat a set of statements.

(Multiple Choice)
4.8/5
(35)

  -Consider the accompanying definition of a recursive function.Which of the statements represents the base case? -Consider the accompanying definition of a recursive function.Which of the statements represents the base case?

(Multiple Choice)
4.8/5
(35)

In the Tower of Hanoi problem, if needle 1 contains three disks, then the number of moves required to move all three disks from needle 1 to needle 3 is ____________________.

(Short Answer)
4.7/5
(39)

If every recursive call results in another recursive call, then the recursive function (algorithm) is said to have ____ recursion.

(Multiple Choice)
4.8/5
(38)

If you execute an infinite recursive function on a computer, the function executes until the system runs out of ____________________.

(Short Answer)
4.8/5
(36)

Recursive algorithms are implemented using ____________________ functions.

(Short Answer)
4.9/5
(33)
Showing 1 - 20 of 43
close modal

Filters

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