Department of Computer Science 1 Chapter 6 Questions Quick Quiz True or False: Every (recursive)...

6
Department of Computer Science 1 Chapter 6 Questions Quick Quiz True or False: Every (recursive) call also has its own set of parameters and local variables. Answer: True If every recursive call results in another recursive call, then the recursive function (algorithm) is said to have ____ recursion. Answer: infinite

Transcript of Department of Computer Science 1 Chapter 6 Questions Quick Quiz True or False: Every (recursive)...

Page 1: Department of Computer Science 1 Chapter 6 Questions Quick Quiz True or False: Every (recursive) call also has its own set of parameters and local variables.

Department of Computer Science 1

Chapter 6 QuestionsQuick Quiz

 True or False: Every (recursive) call also has its own set of parameters and local variables.Answer: True If every recursive call results in another recursive call, then the recursive function (algorithm) is said to have ____ recursion.Answer: infinite

Page 2: Department of Computer Science 1 Chapter 6 Questions Quick Quiz True or False: Every (recursive) call also has its own set of parameters and local variables.

Department of Computer Science 2

Questions

Every recursive definition must have at least ____ base case(s).Answer: one True or False: If a recursive solution to a problem exists, a programmer should always opt to use it over any iterative solution that exists.Answer: False

Page 3: Department of Computer Science 1 Chapter 6 Questions Quick Quiz True or False: Every (recursive) call also has its own set of parameters and local variables.

Department of Computer Science 3

Questions

____ control structures use a looping structure to repeat a set of statements. Answer: Iterative

 Every ____ call requires that the system allocate memory space for its formal parameters and local variables and then deallocate the memory space when the function exits. Answer: recursive

Page 4: Department of Computer Science 1 Chapter 6 Questions Quick Quiz True or False: Every (recursive) call also has its own set of parameters and local variables.

Department of Computer Science 4

Questions

True or False: It is difficult to construct an iterative solution for the Tower of Hanoi problem.

Answer: True The ____ algorithm attempts to find solutions to a problem by constructing partial solutions and then making sure that any partial solution does not

violate the problem requirements. Answer: backtracking

Page 5: Department of Computer Science 1 Chapter 6 Questions Quick Quiz True or False: Every (recursive) call also has its own set of parameters and local variables.

Department of Computer Science 5

Questions

 A function is called ____ recursive if it calls itself.Answer: directly

Page 6: Department of Computer Science 1 Chapter 6 Questions Quick Quiz True or False: Every (recursive) call also has its own set of parameters and local variables.

Department of Computer Science 6

Text

 

True or False: There are usually two ways to solve a particular problem:

iteration and recursion.Answer: True