
Recursion in Python Quiz

Quiz
•
Computers
•
12th Grade
•
Medium
Standards-aligned

Albert Gorup
Used 7+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What happens when a recursive function in Python does not have a proper base case?
The function returns None
The function executes indefinitely until manually stopped
The function immediately raises a syntax error
The function returns a random value
Tags
DOK Level 2: Skill/Concept
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the recursive function to calculate factorial of a number `n`. What is the base case for this function?
`n == 0`
`n == 1`
`n > 1`
`n < 1`
Tags
DOK Level 2: Skill/Concept
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a correct recursive function to compute the sum of numbers from 1 to `n`?
```python def sum_numbers(n): if n == 1: return 1 else: return n + sum_numbers(n-1) ```
```python def sum_numbers(n): return n + sum_numbers(n) ```
```python def sum_numbers(n): if n == 0: return 0 else: return n ```
```python def sum_numbers(n): if n > 1: return n else: return n + sum_numbers(n-1) ```
Tags
DOK Level 2: Skill/Concept
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In a recursive function, what is the purpose of the recursive case?
To handle the simplest case and terminate the recursion
To reduce the problem into smaller problems
To perform cleanup after recursion ends
To initialize variables
Tags
DOK Level 2: Skill/Concept
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following Python recursive function when called as `find(5)`? ```python def find(n): if n == 0: return 0 else: return find(n-1) + n ```
10
15
5
0
Tags
DOK Level 2: Skill/Concept
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following scenarios is most appropriate for using recursion?
Calculating the maximum value in a list
Sorting a list using merge sort
Adding two numbers
Printing "Hello World" 10 times
Tags
DOK Level 2: Skill/Concept
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How does a recursive function differ from an iterative function in Python?
Recursive functions are always faster than iterative functions
Recursive functions can handle any size input, while iterative cannot
Recursive functions use the function call stack to handle function calls
Iterative functions are less accurate than recursive functions
Tags
DOK Level 2: Skill/Concept
Create a free account and access millions of resources
Similar Resources on Quizizz
10 questions
Recursion in Java (AP Computer Science A)

Quiz
•
9th - 12th Grade
15 questions
Technical Quiz R2

Quiz
•
12th Grade
10 questions
l.7. PYTHON FUNCTIONS

Quiz
•
12th Grade
20 questions
Python String

Quiz
•
12th Grade
16 questions
Python programming

Quiz
•
6th - 12th Grade
20 questions
Python Basics & Syntax

Quiz
•
10th - 12th Grade
10 questions
Python- Operators

Quiz
•
12th Grade
14 questions
Python User Defined Functions

Quiz
•
12th Grade
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade
Discover more resources for Computers
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
20 questions
Taxes

Quiz
•
9th - 12th Grade
17 questions
Parts of Speech

Quiz
•
7th - 12th Grade
20 questions
Chapter 3 - Making a Good Impression

Quiz
•
9th - 12th Grade
20 questions
Inequalities Graphing

Quiz
•
9th - 12th Grade
10 questions
Identifying equations

Quiz
•
KG - University