Python Objects and Recursion
Quiz
•
Computers
•
10th Grade
•
Practice Problem
•
Medium
turgut kalfaoglu
Used 2+ times
FREE Resource
Enhance your content in a minute
14 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is recursion in Python?
Answer explanation
Recursion is a programming technique where a function calls itself to solve a problem.
2.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Which of the following is a base case in recursion?
Answer explanation
The base case is a condition that stops the recursive calls and prevents infinite recursion.
3.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the output of the following recursive function?
def factorial(n):
if n == 1: return 1
else: return n * factorial(n-1)
print(factorial(5))
Answer explanation
The factorial of 5 is 120, calculated as 5 * 4 * 3 * 2 * 1.
4.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the main purpose of a class in Python?
Answer explanation
A class is a blueprint for creating objects, which are instances of the class.
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Which keyword is used to create a class in Python?
Answer explanation
The `class` keyword is used to define a class in Python.
6.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is an instance of a class?
Answer explanation
An instance is an object created from a class, using the class as a blueprint.
7.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the purpose of the `__init__` method in a class?
Answer explanation
The `__init__` method is used to initialize the attributes of an object when it is created.
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
11 questions
Creative iMedia: Strengths, Weaknesses and Improvements
Quiz
•
10th Grade
11 questions
Excel
Quiz
•
1st - 10th Grade
10 questions
Berfikir Komputesional
Quiz
•
9th - 12th Grade
10 questions
Hệ Điều Hành Của Máy Tính
Quiz
•
10th Grade - University
16 questions
Input Device
Quiz
•
9th - 10th Grade
15 questions
Q1 W1 M1 PRE-TEST
Quiz
•
10th Grade
15 questions
Ôn tập KTGK. Bài 17. Biến và lệnh gán
Quiz
•
10th Grade
15 questions
Mengenal Jendela dan Ikon Microsoft Excel
Quiz
•
7th Grade - University
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
15 questions
4:3 Model Multiplication of Decimals by Whole Numbers
Quiz
•
5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
The Best Christmas Pageant Ever Chapters 1 & 2
Quiz
•
4th Grade
12 questions
Unit 4 Review Day
Quiz
•
3rd 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
