Quiz: Object-Oriented Programming in Python
Test what you've learned about object oriented programming with this fun quiz!
1
What will be the output of the following code?
class Animal:
def __init__(self, name):
self.name = name
def speak(self):
return "Some sound"
class Dog(Animal):
def speak(self):
return "Woof!"
dog = Dog("Buddy")
print(dog.speak())
A)
Some sound
B)
Woof!
C)
Buddy
D)
Error
Question 1 of 60 attempted
Get hands-on with 1400+ tech skills courses.