Quiz: Creating and Using Classes
Test your applied understanding of Python classes, instances, encapsulation, and object relationships through this comprehensive assessment.
We'll cover the following...
We'll cover the following...
Technical Quiz
1.
Consider the following class definition. What happens when we execute type(SpaceShip)?
class SpaceShip:
pass
s1 = SpaceShip()
s2 = SpaceShip()
A.
It returns <class '__main__.SpaceShip'> because SpaceShip is an instance of the class type.
B.
It returns None because SpaceShip is just a template, not an object.
C.
It returns <class 'object'> because all classes inherit from object.
D.
It raises a NameError because SpaceShip is only valid when instantiating s1.
1 / 10
...