Exam 15: Recursion

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

The recursive algorithm must have one or more base cases,and the general solution must eventually be reduced to a(n)____________________.

(Short Answer)
4.9/5
(84)

Infinite recursions execute forever on a computer.

(True/False)
4.9/5
(86)

In a recursive function,the base case stops the recursion.

(True/False)
4.9/5
(89)

int recFunc(int num) { \quad if (num >= 10) \quad\quad return 10; \quad else \quad\quad return num * recFunc(num + 1); } -If every recursive call results in another recursive call,then the recursive function (algorithm)is said to have ____ recursion.

(Multiple Choice)
4.8/5
(79)

int recFunc(int num) { \quad if (num >= 10) \quad\quad return 10; \quad else \quad\quad return num * recFunc(num + 1); } -A recursive function in which the last statement executed is the recursive call is called a(n)____ recursive function.

(Multiple Choice)
4.8/5
(73)

The following is an example of a recursive function,where nextNum is a function such that nextNum(x)= x + 1. int recFunc(int x) { return nextNum(nextNum(x)); }

(True/False)
4.9/5
(84)

The ____________________ bit of 33 is 1.

(Short Answer)
4.8/5
(81)

int puzzle(int start, int end) { if (start > end) \quad return start - end; else if (start == end) \quad return start + end; else \quad return end * puzzle(start + 1, end - 1); } -Consider the accompanying definition of a recursive function.What is the output of the following statement? cout << puzzle(3,7)<< endl;

(Multiple Choice)
5.0/5
(78)

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

(Multiple Choice)
4.8/5
(88)

Suppose that function A calls function B,function B calls function C,function C calls function D,and function D calls function A.Function A is then ____________________ recursive.

(Short Answer)
4.9/5
(91)
Showing 41 - 50 of 50
close modal

Filters

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