What is a function that calls itself known as?
Circular function
Self-calling function
Iterative function
Recursive function
In the given countdown example, what happens each time the count_down()
function is called?
A new global namespace is created
A new namespace is created for the local scope of the function
The script finishes
The function prints "GO!"
Which of the following is a definition of an algorithm?
An abstract representation of a function
A sequence of steps for solving a problem
A function that calls itself
A method of solving equations
What kind of algorithm would be best to minimize the number of guesses in
the given guessing game program?
Divide by 10s and then 1s approach
Binary search approach
Recursive approach
Incremental approach
, In the context of the guessing game, what is the function of the find(low,
high) function?
To define the range of possible numbers
To guess the midpoint of the range and then make recursive calls based on
the user's response
To generate a random number within the specified range
To print the midpoint of the range
In recursive functions, what is the end of the recursion known as?
Final statement
Recursive end
Exit case
Base case
In the example of a program to find an item in a sorted list, what does the
find() function do if it doesn't match the middle element and the window's
size is only one element?
It returns -1
It calls itself with an argument of 0
It performs a binary search on the lower half of the range
It performs a binary search on the upper half of the range
Can all recursive solutions be achieved using loops?
Yes, but using loops is generally less efficient
Yes, but recursive solutions may be clearer and more concise in some cases
No, recursive solutions are exclusive to recursive problems
No, loops cannot handle recursive problems
What kind of problems are good candidates for recursion?