Font size
WorksheetsPython Classes Quiz
Total questions: 15
Worksheet time: 8mins
What is a Python class?
A function to create an object.
A template (blueprint) for creating objects.
A procedure related to an object.
A process that repeats are directed.
What is the keyword to create a class?
import
__int__
class
def
Identify the first statement that creates a class named Employee.
class Employee():
Class Employee:
class employee:
class Employee:
Identify the term that describes the creation of a new object.
instantiation
declare
iteration
initialize
Identify the code that properly creates an instance of a class named Car.
camero.car(make, model)
tesla = car.make()
mustang = Car(make,model)
porsche = car.make.model()
Identify the initialization method for a Car class.
class init(self, make, model):
class__init__:
def __init__(self, make, model):
def __init__(self, make, model):
Identify the code that properly accesses an engine_sound() method in a Car class.
porsche.engine_sound()
mustang = engine_sound()
engine_sound(tesla):
engine_sound.Car(camaro)
Identify the keyword that accesses an instance's attributes when three objects are created.
inheritance
class
__init__
self
Inheritance can only be applied between one sub class and one super class.
True
False
Occasionally
Depending on instantiation
What are class variables?
Variables with a sense of style
Variables that apply to all instances of the class
Variables that change with every instance of the class
Integers
Do you think a variable to store a car's value would be a class or instance variable?
Class
Instance
What does __init__ do?
Constructs the instance
Initialize the instance values
Calls the Super class
Creates a circle
Getters and setters
Are important for class incapsulation
Are important to add each data member of the class
Are replaced by the @property decorator in Python
Are replaced by the @classmethod in Python
Who would win in a battle where Bilbo Baggins vs. Frodo Baggins
Bilbo Baggins
Frodo Baggins
Who would win a battle between, Darth Vader vs. Capt. James T. Kirk
Darth Vader
Capt. James T. Kirk
