Professional Documents
Culture Documents
Attempt History
Attempt Time Score
LATEST Attempt 1
7 minutes 5 out of 10
Question 1 0
/ 1 pts
class Vehicle():
def __init__(self):
def start(self):
def stop(self):
class Class1Vehicle():
pass
https://tip.instructure.com/courses/29905/quizzes/378522?module_item_id=2516349 1/8
4/22/22, 3:04 AM Quiz 5.1 Inheritance, Encapsulation, and Abstraction: CPE 009-CPE12S1 - Object Oriented Programming
vehicle1 = Class1Vehicle()
Single Inheritance
Multiple Inheritance
ou Answered
Multilevel Inheritance
orrect Answer
None
Question 2 0
/ 1 pts
class Person():
def __init__(self):
person1 = Person()
print(self.__name)
orrect Answer
The program will output an attribute error because Python could not find an
attribute __name in Person
The program will run but will not display anything.
ou Answered
The program will output "Default Name"
https://tip.instructure.com/courses/29905/quizzes/378522?module_item_id=2516349 2/8
4/22/22, 3:04 AM Quiz 5.1 Inheritance, Encapsulation, and Abstraction: CPE 009-CPE12S1 - Object Oriented Programming
Question 3 1
/ 1 pts
__init
_init_
init__
Correct!
__init__
Question 4 1
/ 1 pts
Correct!
method
Question 5 0
/ 1 pts
class Vehicle():
def __init__(self):
https://tip.instructure.com/courses/29905/quizzes/378522?module_item_id=2516349 3/8
4/22/22, 3:04 AM Quiz 5.1 Inheritance, Encapsulation, and Abstraction: CPE 009-CPE12S1 - Object Oriented Programming
def start(self):
def stop(self):
class Class1Vehicle():
pass
vehicle1 = Class1Vehicle()
vehicle1.start()
print(vehicle1.is_enginerunning)
False
ou Answered
True
orrect Answer
AttributeError: 'Class1Vehicle' object has no attribute 'start'
TypeError: start() takes 0 positional arguments but 1 was given
Question 6 0
/ 1 pts
class Person():
def __init__(self):
https://tip.instructure.com/courses/29905/quizzes/378522?module_item_id=2516349 4/8
4/22/22, 3:04 AM Quiz 5.1 Inheritance, Encapsulation, and Abstraction: CPE 009-CPE12S1 - Object Oriented Programming
person1 = Person()
person2 = Person()
print(person1)
print(person2)
ou Answered
person1 and person2 has the same variable names but the instance is
different.
When we create instances, their memory allocations are different meaning
though they are derived from the same class they may take on different
values.
orrect Answer
Modifying person1's variables will also modify person2's variables because
they were both created from class Person.
The memory addresses maybe different but they are derived from the
same class which acts as a template.
Question 7 1
/ 1 pts
class Student():
https://tip.instructure.com/courses/29905/quizzes/378522?module_item_id=2516349 5/8
4/22/22, 3:04 AM Quiz 5.1 Inheritance, Encapsulation, and Abstraction: CPE 009-CPE12S1 - Object Oriented Programming
class DSCOfficer(Student):
self.event_list = []
self.eventlist.append({"name":name})
officer1 = DSCOfficer("CpE")
officer1.initiateEvent("General Assembly")
print(officer1.stu_num)
0
Correct!
AttributeError: 'DSCOfficer' object has no attribute 'stu_num'
None
TypeError: initiateEvent() takes 1 positional argument but 2 were given
Question 8 1
/ 1 pts
Correct!
Attributes
https://tip.instructure.com/courses/29905/quizzes/378522?module_item_id=2516349 6/8
4/22/22, 3:04 AM Quiz 5.1 Inheritance, Encapsulation, and Abstraction: CPE 009-CPE12S1 - Object Oriented Programming
Question 9 1
/ 1 pts
class Person():
def __init__(self):
def greet():
person1 = Person()
person1.greet()
Correct!
TypeError: greet() takes 0 positional arguments but 1 was given
AttributeError: 'Person' object has no attribute 'greet'
<bound method Person.greet of <__main__.Person object at
0x000001A79201D088>>
Hello World
Question 10 0
/ 1 pts
class Student():
https://tip.instructure.com/courses/29905/quizzes/378522?module_item_id=2516349 7/8
4/22/22, 3:04 AM Quiz 5.1 Inheritance, Encapsulation, and Abstraction: CPE 009-CPE12S1 - Object Oriented Programming
class DSCOfficer(Student):
self.event_list = []
self.event_list.append({"name":name})
officer1 = DSCOfficer("CpE")
officer1.initiateEvent("General Assembly")
print(officer1.event_list)
[]
orrect Answer
[{'name': 'General Assembly'}]
TypeError: initiateEvent() takes 1 positional argument but 2 were given
ou Answered
AttributeError: 'DSCOfficer' object has no attribute 'eventlist'
Quiz Score:
5 out of 10
https://tip.instructure.com/courses/29905/quizzes/378522?module_item_id=2516349 8/8