C++ Recursion

C++ Recursion

8th - 12th Grade

12 Qs

quiz-placeholder

Similar activities

Looping in java

Looping in java

9th Grade

7 Qs

Operators in C

Operators in C

9th - 12th Grade

10 Qs

Recursivitate 2

Recursivitate 2

1st - 12th Grade

9 Qs

С++ введение

С++ введение

10th Grade

15 Qs

8.12 C++ Test on Classes

8.12 C++ Test on Classes

9th - 12th Grade

15 Qs

C++ - Loops and Random Numbers

C++ - Loops and Random Numbers

9th - 12th Grade

14 Qs

quiz vòng lặp nhập môn lập trình

quiz vòng lặp nhập môn lập trình

1st - 10th Grade

15 Qs

Java Recursion

Java Recursion

9th - 12th Grade

10 Qs

C++ Recursion

C++ Recursion

Assessment

Quiz

Science, Computers, Mathematics

8th - 12th Grade

Medium

Created by

Natalia Fumero

Used 172+ times

FREE Resource

12 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

The process of defining a problem (or the solution to a problem) in terms of (a simpler version of) itself is known as:

repetition

recursion

reapparition

reversing

2.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

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

A method that iterates itself exactly 5 times.

A method that invokes itself by name within the method.

A method that will never iterate infinitely.

A method that cannot be called more than once.

3.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Recursion is similar to which of the following?

if-else

switch-case

loops

none of the above

4.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Name the condition at which the recursive method will stop calling itself.

Base case

Worst Case

Best Case

None of the above

5.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

The following function finds the factorial of any number


int factorial(int n)

{

if(n == 0 || n == 1) return 1;


return n * factorial(n-1);

}


What would calling factorial(4) output?

24

16

8

64

6.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

The following function finds the factorial of any number


int factorial(int n)

{

if(n == 0 || n == 1) return 1;


return n * factorial(n-1);

}


What would calling factorial(2) output?

12

2

0

22

7.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Make the following function return the following number in the fibonacci sequence


int fibo(int n)

{

if(n == 0 || n == 1) return n;

return _________________;

}

fib (n-1)+fib (n-2)

fibo(n-1)+fibo(n-2)

fibo(n*2)

fibo(n+1)+fibo(n+2)

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?