Worksheets5MM OOP Classes
Total questions: 12
Worksheet time: 7mins
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 initialization method for a Car class.
class init(self, make, model):
class__init__:
def __init__(self, make, model):
def __init__(self, make, model):
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
Given this code, what will print?
The shark is being awesome.
The shark is swimming.
The shark is being awesome.
The shark is swimming.
ERROR
Given this class, how would you make jaws swim?
jaws.swim()
jaws.swim
swim.jaws
jaws(swim)
swim(jaws)
Given this code, how many attributes are in the class?
1
2
3
4
0
Given this code, what is the class name?
Shark
jaws
Bruce
swim
self
Given this code, what is the attribute?
name
self
__init__
swim
be_awesome
Who would win a battle between, Darth Vader vs. Capt. James T. Kirk
Darth Vader
Capt. James T. Kirk
