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 is the result of executing type(SpaceShip)?
class SpaceShip:
pass
s1 = SpaceShip()
s2 = SpaceShip()
A.
It returns <class 'type'> because SpaceShip is an instance of the metaclass 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
...