Python Review Module 14 - Recursion
Quiz
•
Science, Other
•
University
•
Practice Problem
•
Hard
Karen Diggs
Used 37+ times
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If the base condition is not defined in the recursive function, _____.
the program runs only once
the program runs as many times as the number passed as its argument
the program terminates giving an error
the program gets into an infinite loop
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is output?
def divide_by_two(count):
if count == 1:
print('Terminated..!')
else:
print(count)
divide_by_two(count/2)
divide_by_two(9)
9
4.5
2.25
1.125
Terminated..!
9
4.5
2.25
Terminated..!
Infinite loop
9
4.5
2.25
1.125
0.5625
Terminated..!
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Assume that there is a recursive binary search function find(). If a sorted list has a data structure with indices 0 to 50 and the item being searched for happens to be at location 6, write each call of find() that would occur while searching for that item. The first is find(0,50).
find(0, 25) find(0, 12) find(0, 6)
find(0, 25) find(0, 12)
find(0, 25)
find(0, 25) find(0, 12) find(0, 6) find(0, 3)
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which is the best way to debug recursive functions?
Adding print statement of what that line of code does.
Adding output statements by keeping all the statements left aligned
Adding output statements with an indent to print statements at every iteration.
Adding output statements by keeping all the statements equally indented
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
While adding output statements to debug recursive functions, _____ the print statements to show the current depth of recursion.
left align
indent
right align
center align
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
An indent variable _____ number of spaces on each iteration.
adds unequal
removes unequal
removes equal
adds equal
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the role of sys.getrecursionlimit()?
It measures the maximum depth of the function.
It changes the depth of the function.
It isolates the defined function
It finds the error of the function.
Create a free account and access millions of resources
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
8 questions
Imposible to get 10/10 RAP MUSIC
Quiz
•
KG - Professional Dev...
10 questions
C++ Array Quiz
Quiz
•
University
15 questions
Weather, Climate and Adaptions of Animals to Climate
Quiz
•
7th Grade - Professio...
10 questions
QUIZ 22/4/24
Quiz
•
University
10 questions
Phases of the Moon
Quiz
•
5th Grade - University
10 questions
Science and technology
Quiz
•
University
15 questions
Grade 10 IGCSE Biology_Plant and Virus Classification Quiz
Quiz
•
10th Grade - University
10 questions
Guess the blackpink song lyrics
Quiz
•
4th Grade - Professio...
Popular Resources on Wayground
10 questions
Honoring the Significance of Veterans Day
Interactive video
•
6th - 10th Grade
9 questions
FOREST Community of Caring
Lesson
•
1st - 5th Grade
10 questions
Exploring Veterans Day: Facts and Celebrations for Kids
Interactive video
•
6th - 10th Grade
19 questions
Veterans Day
Quiz
•
5th Grade
14 questions
General Technology Use Quiz
Quiz
•
8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
15 questions
Circuits, Light Energy, and Forces
Quiz
•
5th Grade
19 questions
Thanksgiving Trivia
Quiz
•
6th Grade
Discover more resources for Science
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)
Quiz
•
8th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
9 questions
Principles of the United States Constitution
Interactive video
•
University
18 questions
Realidades 2 2A reflexivos
Quiz
•
7th Grade - University
10 questions
Dichotomous Key
Quiz
•
KG - University
25 questions
Integer Operations
Quiz
•
KG - University
7 questions
What Is Narrative Writing?
Interactive video
•
4th Grade - University
20 questions
SER vs ESTAR
Quiz
•
7th Grade - University
