
Recursion and Data Structures Quiz
Quiz
•
Professional Development
•
University
•
Practice Problem
•
Medium
Karnam Bharath
Used 3+ times
FREE Resource
Enhance your content in a minute
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the base case in recursion?
The case where the function calls itself
The condition that stops further recursive calls
The first step in the recursive function
A case where infinite recursion occurs
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What happens if a recursive function lacks a proper base case?
It will execute normally
It will result in infinite recursion leading to a stack overflow
It will execute but return None
It will compile but not run
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following recursive function: def mystery(n): if n == 0: return 1 return n * mystery(n - 1) What does mystery(5) return?
5
24
120
25
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following recursive functions correctly calculates the sum of digits of a number?
def sum_of_digits(n): return sum_of_digits(n // 10) + n % 10
def sum_of_digits(n): if n == 0: return 0 return sum_of_digits(n // 10) + n % 10
def sum_of_digits(n): if n < 0: return 0 return sum_of_digits(n - 1) + n % 10
None of the above
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which data structure is used for handling recursive function calls internally?
Queue
Stack
Linked List
Heap
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the time complexity of a naive recursive Fibonacci function?
O(n)
O(n²)
O(2ⁿ)
O(log n)
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following approaches optimizes recursive Fibonacci using memoization?
Storing computed values in an array and reusing them
Using a loop instead of recursion
Using an explicit stack
Removing the base case
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?
Similar Resources on Wayground
20 questions
QUIZ 3 : TOPIC 2 [MANUFACTURING COSTS:CONCEPTS & COMPONENTS]
Quiz
•
1st Grade - University
17 questions
Elaborar Documentos
Quiz
•
University
20 questions
ZONA DE CONFORT
Quiz
•
University
15 questions
Universidad Nebrija:repaso inicial
Quiz
•
University
20 questions
Derecho Laboral
Quiz
•
University
15 questions
Programação Web - HTML 3
Quiz
•
7th Grade - Professio...
20 questions
La Meta
Quiz
•
University
15 questions
Comunicación No verbal
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Professional Development
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
23 questions
Subject Verb Agreement
Quiz
•
9th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
5 questions
Poetry Interpretation
Interactive video
•
4th Grade - University
19 questions
Black History Month Trivia
Quiz
•
6th Grade - Professio...
15 questions
Review1
Quiz
•
University
15 questions
Pre1
Quiz
•
University
