Stephon Allison

Stephon Allison (username: sallison4)

Attempt 1

Just $7 Welcome
Order Now

Written: Jun 7, 2021 9:48 PM – Jun 7, 2021 9:50 PM

Submission View

Question 1   0 / 1.5 points

In recursion, the condition for which the function will stop calling itself is

Question options:

 
1) Base case

 

 
2) Worst case

 

 
3) Best case

 

 
4) There is no such condition

 

Question 2   0 / 1.5 points

Is this method recursive?

Question options:

 
1) It depends on what n is

 

 
2) YES

 

 
3) NO

 

Question 3   0 / 1.5 points

Consider the following code snippet:

Question options:

 
1) The code will be executed successfully and random output will be generated

 

 
2) The code will show a compile time error

 

 
3) The code will run for some time and stop when the stack overflows

 

 
4) The code will be executed successfully and no output will be generated

 

Question 5   0 / 1.5 points

Recursion is a method in which the solution of a problem depends on

Question options:

 
1) Smaller instances of different problems

 

 
2) Larger instances of different problems

 

 
3) Larger instances of the same problem

 

 
4) Smaller instances of the same problem

 

Question 6   0 / 1.5 points

Which of the following statements are true?

Question options:

 
1) Recursive functions usually take more memory space than non-recursive functions.

 

 
2) A recursive function can always be replaced by a non-recursive function.

 

 
3) In some cases, however, using recursion enables you to give a natural, straightforward, simple solution to a program that would otherwise be difficult to solve.

 

 
4) all of the above

 

Question 7   0 / 1.5 points

Which of the following is the best definition of a recursive method?

Question options:

 
1) A method that invokes itself by name within the method.

 

 
2) A method that cannot be called more than once.

 

 
3) A method that iterates itself exactly 5 times.

 

 
4) A method that will never iterate infinitely.

 

Question 8   0 / 1.5 points

Which of the following statements is true?

Question options:

 
1) Recursion uses less memory compared to iteration

 

 
2) Iteration is always better and simpler than recursion

 

 
3) Recursion uses more memory compared to iteration

 

 
4) Recursion is always better than iteration

 

Question 9   0 / 1.5 points

Recursion is similar to which of the following?

Question options:

 
1) If-else

 

 
2) Switch Case

 

 
3) None of the mentioned

 

 
4) Loop

 

Question 10   0 / 1.5 points

Which of the following problems can be solved using recursion?

Question options:

 
1) Factorial of a number

 

 
2) Nth fibonacci number

 

 
3) Length of a string

 

 
4) All of the mentioned

 

   
 

 

Attempt Score:

1.5 / 15 – 10 %

Overall Grade (highest attempt):

1.5 / 15 – 10 %

 

 

 

 

Done