
Recursion in Python Quiz
Authored by Fadi Fadi
Information Technology (IT)
9th Grade
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
14 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is recursion in Python?
A way to create loops using for
A function that returns a list
A function that calls itself
A function that runs forever
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the main danger of recursion if not written properly?
It prints the wrong result
It runs only once
It causes an infinite loop
It turns into a list
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which part of a recursive function stops it from calling itself forever?
Return statement
Loop
Base case
Recursive call
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will this function return? def factorial(n): if n == 1: return 1 else: return n * factorial(n - 1) print(factorial(3))
3
6
9
Error
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the base case in this function? def countdown(n): if n == 0: print("Blast off!") else: print(n) countdown(n - 1)
print(n)
n == 0
countdown(n - 1)
"Blast off!"
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is printed when this code runs? def test(x): if x == 0: return print(x) test(x - 1) test(3)
3 2 1 0
0 1 2 3
3 2 1
Nothing
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of these problems is most suitable for recursion?
Printing numbers from 1 to 10
Finding maximum in a list
Searching a file in nested folders
Adding two numbers
Access all questions and much more by creating a free account
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?