Quiz: Python Classes


1. Classes are collections of variables and functions that are particularly useful in object-oriented programming.

A. True
Correct.
B. False
Incorrect.

2. In the example in the video introduction to classes, what is an instance of the Person class? Select two correct answers.

A. Jane
Correct. Jane is an instance of the parent class.
B. class Person
Incorrect. The parent class is not an instance.
C. Eric
Correct. Eric is an instance of the parent class.
D. addSkill
Incorrect. The function addSkill is a method of the Person class, not an instance of the Person class.

3. What function is used to initialize variables when creating a new instance of a class?

A. def init(self):
Incorrect.
B. def addSkill(self,skill):
Incorrect.
C. def __init__(self):
Correct. 2 underscores on either side of init