No student devices needed. Know more
20 questions
A recursive function is
A function that calls other functions in a recursive way.
Any function that calls itself is called recursive
A function that has a base case or termination condition
None of the above
Recursion is:
is a computer programming technique involving the use of a procedure, subroutine, function, or algorithm that calls itself in a step having a termination condition.
is a computer programming technique involving the use of a procedure, subroutine, function, or algorithm that calls other function in a step.
is a computer programming technique involving the use of a procedure, subroutine, function, or algorithm that calls itself in a step having no termination condition.
None of the above
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.
What is the definition of recursion?
Recursion is a programming technique you can use to allow a method to have numerous fields in its argument.
Recursion is programming technique you can use in which a method calls itself to solve a problem.
Recursion is a programming language model organized around objects rather than "actions" and data rather than logic
Recursion is a program that translates a source program written in some high-level programming language into machine code.
Name the condition at which the recursive method will stop calling itself.
Base case
Worst Case
Best Case
None of the above
The program may run out of memory in a
non-recursive function call
recursive function call
condition when too many variables are declared
none of the above
Which of the following condition is true?
Recursion is always better than iteration.
Recursion uses more memory as compared to iteration.
Recursion uses less memory as compared to iteration.
Iteration is always better and simpler than recursion.
Which of the following problems can be solved using recursion?
finding Nth number of the Fibonacci sequence
finding the factorial of a number
finding the length of a string
all of the above
Recursion is similar to which of the following?
if-else
switch-case
loops
none of the above
What would happen if the base case if not defined in the recursive method?
Stack Overflow
Stack Underflow
Program Crashes
None of the above
The number of recursive calls is limited to the ____ of the stack.
time
ability
quality
size
Which of the following sorting algorithms use recursion?
Selection Sort
Insertion Sort
Mergesort
What is the returned value of recmethod(5)?
68
70
75
82
What is printed as a result of the call stri("COMPSCI")?
COMPSCI
COMPSC
COMPS
COMP
COM
CO
C
COMPSCI
OMPSCI
MPSCI
PSCI
SCI
CI
I
CO
COM
COMP
COMPS
COMPSC
COMPSCI
C
CO
COM
COMP
COMPS
COMPSC
COMPSCI
Will rec(5) iterate infinitely?
Yes
No
What value is returned as a result of the call mystry(x)?
x * (x+1)
2x
2(x-1)
x3 +1
What will print?
1
2
11
1
2
21
1
2
3
11
1
2
3
21
Which of the following cannot be converted in a recursion function?
Factorial program
random function generation
binary search
Greatest common divisor(GCD)
In a recursive function ,_______ case must always be reachable.
recursive case
Explicit case
Base case
repetitive case
Explore all questions with a free account