
Recursion in Python Quiz
Quiz
•
Computers
•
12th Grade
•
Practice Problem
•
Medium
Standards-aligned
Albert Gorup
Used 8+ times
FREE Resource
Enhance your content in a minute
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
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
20 questions
SOFTWARE 7I
Quiz
•
7th Grade - University
10 questions
Quiz 8 (01.09.2021)
Quiz
•
1st - 12th Grade
10 questions
ICT as Platform for Change
Quiz
•
11th - 12th Grade
10 questions
emtech
Quiz
•
12th Grade
10 questions
Visual Basic 2010
Quiz
•
8th Grade - University
20 questions
Skill Competition Quiz 2024
Quiz
•
10th Grade - University
12 questions
1.2.4. Types of Programming Language
Quiz
•
12th Grade
11 questions
Types of Mass Media
Quiz
•
10th Grade - Professi...
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
Discover more resources for Computers
26 questions
Christmas Movie Trivia
Lesson
•
8th Grade - Professio...
15 questions
Christmas Song Emoji Pictionary
Quiz
•
7th - 12th Grade
20 questions
Christmas Movies
Quiz
•
1st - 12th Grade
55 questions
CHS Holiday Trivia
Quiz
•
12th Grade
20 questions
Christmas Movie Trivia
Quiz
•
9th - 12th Grade
29 questions
christmas facts
Lesson
•
5th - 12th Grade
20 questions
Christmas Trivia
Quiz
•
5th - 12th Grade
20 questions
Stages of Meiosis
Quiz
•
9th - 12th Grade
