Question: 1.A recursive definition is a definition (choose the best answer): A.where a base case is defined. B.that is recursive. C.that repeats itself. D.which uses a

1.A recursive definition is a definition (choose the best answer):

A.where a base case is defined.

B.that is recursive.

C.that repeats itself.

D.which uses a mathematical equation.

F.in which something is defined in smaller terms of itself.

2.If a recursive method does not have a base case:

A.a syntax error is identified.

B.an exception will be thrown.

C.it will operate more efficiently.

D.it will run forever.

E.it must have two recursive cases.

3.As one method calls another which calls another, their corresponding activation records are stored:

A.on a stack.

B.in a queue.

C.in static memory.

D.on a disk.

E.None of these is correct.

4.Factors to consider when deciding whether to use a recursive approach include:

A.time efficiency.

B.space efficiency.

C.clarity.

D.amount of recursive overhead.

E.All of these are correct.

5.The following code is supposed to return n!, for positive n. An analysis of the code using our "Three Question" approach reveals that:

int factorial (int n){

if (n > 0)

return (n * factorial(n - 1));

}

A.it fails the base-case question.

B.it fails the smaller-caller question.

C.it fails the general-case question.

D.it passes on all three questions and is a valid algorithm.

E.None of these is correct.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!