18. In Python, to create an object from a class, the programmer has to call the __init__ method for that class.
A. TRUE B. FALSE
19. Suppose that a class named Hero has been defined, and that the class defines a method named say_hello(self). Suppose also that an object of the Hero class named a_hero has already been created. Which of the following calls the say_hello(self) method correctly?
A. Hero.say_hello()
B. a_hero.say_hello()
C. a_hero.say_hello(self)
D. say_hello(a_hero)
E. Hero.say_hello(a_hero)
20. Using your understanding of the Stack ADT, what is the output of the following code:
s = Stack.Stack()
values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
for v in values:
s.push(v)
n = 0
for i in range(3):
n = n + s.pop()
print(n)
A. 0 B. 3 C. 6 D. 15 E. 27