# Project #89158 - Data structures ASsignment Help SET 1

1 set 10 \$

1  of 10
When writing a recursive algorithm, what is the FIRST step?
 Determining the size Getting an exact problem definition Choosing the base case Choosing the recursive case

2  of 10
When you have an exact definition of a recursive problem, what is the next step?
 Determining the size Choosing the base case Choosing the recursive case None of the above

3  of 10
All of the following are stored on an activation record EXCEPT
 parameters local variables register values return address

4  of 10
Which of the following statements could describe the general (recursive) case of a recursive algorithm?
 F(x) = x - F(x - 1) F(0) = 27 If the array length is 100, do nothing. All parameters are integers.

5  of 10
You are using a language that does not support recursion. What data structure would you use to traverse a binary search tree in order?
 Queue List Stack Can't traverse a tree in order without recursion

of 10
Choose the simple recursive function that will raise a number to an exponential power by multiplication operations.

7  of 10
In the following recursive function, which line(s) represent the base case?

void PrintIt( /* in */ int n )        // Line 1
{                                       // Line 2
if (n == 0)                        // Line 3
cout << n << endl;            // Line 4
else                              // Line 5
{                                  // Line 6
cout << "Again" << endl;      // Line 7
PrintIt(n - 1);               // Line 8
}
}
 line 4 lines 4-7 lines 4-8 lines 7-8

8  of 10
In the following recursive function, which line(s) represent the general (recursive) case?

void PrintIt( /* in */ int n )       // Line 1
{                                      // Line 2
if (n == 0)                       // Line 3
cout << n << endl;           // Line 4
else                             // Line 5
{                                 // Line 6
cout << "Again" << endl;     // Line 7
PrintIt(n - 1);              // Line 8
}
}
 line 4 lines 4-7 lines 4-8 lines 7-8

9  of 10
Given the recursive function

int Func( /* in */ int n )
{
if (n == 5)
return 5;
else
return 2 * Func(n + 1);
}

what is the value of the expression Func(2) ?
 5 20 40 80

10  of 10

If the following function is called with a value of 3 for n, what is the resulting output?

void TapDance( /* in */ int n )
{
if (n > -1)
{
TapDance(n - 1);
cout << "Flap";
}
else
cout << "Shuffle";
}

 ShuffleFlapFlapFlapFlap ShuffleFlapFlap FlapFlapFlapFlapShuffle FlapFlapShuffle

 Subject Computer Due By (Pacific Time) 10/25/2015 12:00 am
TutorRating
pallavi

Chat Now!

out of 1971 reviews
amosmm

Chat Now!

out of 766 reviews
PhyzKyd

Chat Now!

out of 1164 reviews
rajdeep77

Chat Now!

out of 721 reviews
sctys

Chat Now!

out of 1600 reviews

Chat Now!

out of 770 reviews
topnotcher

Chat Now!

out of 766 reviews
XXXIAO

Chat Now!

out of 680 reviews