Question 2
Back to Exercise
What is the output of the following Python program?
class Animal: pass
class Dog(Animal): pass
d = Dog()
print(isinstance(d, Animal), type(d) == Animal, issubclass(bool, int), issubclass(Animal, object))
- A True True True True
- B False False True True
- C True False False True
- D True False True True Correct
Correct Answer: Option D
isinstance respects inheritance; type() gives the exact class. bool subclasses int and every class subclasses object.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!