I have a list of objects of many classes that represent shapes. I run a loop on that list, and use a .draw() method that appropriately draws shapes from these different classes. This is an example of which of the four object-oriented pillars?
Given the above code, which is the correct way to instantiat…
Given the above code, which is the correct way to instantiate a cat? Cat(‘Fred’, ‘Burmese’) Cat() Cat.__init__(‘Fred’, ‘Burmese’) Cat(self, ‘Fred’, ‘Burmese’)
This code will produce what value?
This code will produce what value?
I have created a class, beverage, that has a method called d…
I have created a class, beverage, that has a method called drink. I then create a class from that class, called coffee. The coffee class also has the drink method, even though I didn’t explicitly create it in the class. This is because of one of the four fundamental features called inheritance polymorphism abstraction encapsulation
”’Returns a greeting”’ is called a
”’Returns a greeting”’ is called a
Based on the above code, what will be printed? Mooo Attribut…
Based on the above code, what will be printed? Mooo AttributeError Yum None of these
The exclaim method prints out “I’m a car!” even though we di…
The exclaim method prints out “I’m a car!” even though we didn’t create it in our Prius definition. Why would it be able to do this? It inherits the method from the car class Car is a subclass which means it can also use that method The method exclaim is a base Python method which it my_car has by default None of these
We use the __init__() method if we want to assign object at…
We use the __init__() method if we want to assign object attributes at creation time assign object methods at creation time define methods for subclasses create an instance of that type
We define a subclass by using the same class keyword but wit…
We define a subclass by using the same class keyword but with the child class name inside parentheses True False
Generally speaking, attributes are directly available in Pyt…
Generally speaking, attributes are directly available in Python True False