OOPs in Python
Quiz
•
Computers
•
University
•
Medium
Anik Acharjee
Used 49+ times
FREE Resource
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following code?
class A:
def init(self):
self.x = 1
class B(A):
def init(self):
super().__init__()
self.y = 2
b = B()
print(b.x, b.y)
1 2
Error
2 1
None
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following code?
class Animal:
def speak(self):
print("Animal speaks")
class Dog(Animal):
def speak(self):
print("Dog barks")
d = Dog()
d.speak()
Animal speaks
Dog barks
Error
None
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following is true about multiple inheritance in Python?
Python does not support multiple inheritance
A class can inherit from only two parent classes
A class can inherit from multiple parent classes
Multiple inheritance is only possible with abstract classes
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following code?
class A:
def init(self):
self.x = 1
def method(self):
print("Method of class A")
class B(A):
def method(self):
super().method()
print("Method of class B")
b = B()
b.method()
Method of class A
Method of class B
Method of class A
Method of class B
Error
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following is used to implement abstraction in Python?
@abstractmethod decorator
abstract keyword
interface keyword
virtual keyword
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following code?
class A:
x = 1
a1 = A()
a2 = A()
a1.x = 2
print(a1.x, a2.x, A.x)
2 1 1
2 2 2
2 1 2
Error
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following is true about the `__init__` method in Python?
It must return a value
It is called automatically when a class is instantiated
It can only have one parameter
It is optional in all classes
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
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
20 questions
UIT 1111 (Latihan Word)
Quiz
•
University
20 questions
קלט פלט משתנים והוראות השמה
Quiz
•
7th Grade - University
20 questions
3°DS _AV2_R2 3TEC_PM_Programação Mobile _12_20 Quizizz
Quiz
•
11th Grade - University
20 questions
Computer Networks Quiz 2
Quiz
•
University
19 questions
DSA Quest 1.0
Quiz
•
University
15 questions
Searching and Sorting
Quiz
•
University - Professi...
24 questions
Photoshop Certification Vocabulary Part 1
Quiz
•
11th Grade - University
20 questions
PYTHON REVISION
Quiz
•
University
Popular Resources on Wayground
20 questions
Halloween Trivia
Quiz
•
6th - 8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
15 questions
Order of Operations
Quiz
•
5th Grade
20 questions
Halloween
Quiz
•
5th Grade
16 questions
Halloween
Quiz
•
3rd Grade
12 questions
It's The Great Pumpkin Charlie Brown
Quiz
•
1st - 5th Grade
20 questions
Possessive Nouns
Quiz
•
5th Grade
10 questions
Halloween Traditions and Origins
Interactive video
•
5th - 10th Grade
Discover more resources for Computers
10 questions
Halloween Movies Trivia
Quiz
•
5th Grade - University
12 questions
Halloween
Quiz
•
3rd Grade - University
5 questions
Using Context Clues
Interactive video
•
4th Grade - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)
Quiz
•
8th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
14 questions
Eat Healthy,Be Healty
Quiz
•
4th Grade - University
7 questions
History of Halloween: Pagan or Christian?
Interactive video
•
11th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
