Consider the following animal hierarchy. class Animal:    de…

Consider the following animal hierarchy. class Animal:    def __init__(self, name: str, age: int) -> None:        self._name = name        self._age = age     def speak(self) -> str:        raise NotImplementedError(“bad”) class Dog(Animal):    def speak(self) -> str:        return “woof”     def __repr__(self) -> str:        return f”Dog(name={self._name}, age={self._age}, sound={self.speak()})” class Cat(Animal):    def speak(self) -> str:        return “meow”     def __repr__(self) -> str:        return f”Cat(name={self._name}, age={self._age}, sound={self.speak()})” def main() -> None:    animals: list[Animal] = [ Dog(“Rex”, 5), Cat(“Milo”, 2) ]    print(animals) main() What gets printed when the main is run?

Consider the following task hierarchy — representing some u…

Consider the following task hierarchy — representing some unit of work to be completed. class Task:    def __init__(self, label: str) -> None:        self._label = label     def cost(self) -> int:        raise NotImplementedError(“bad”) class FixedTask(Task):    def __init__(self, label: str, minutes: int) -> None:        super().__init__(label)        self._minutes = minutes     def cost(self) -> int:        return self._minutes * 2     def __repr__(self) -> str:        return f”FixedTask(label={self._label}, cost={self.cost()})” def main() -> None:    items: list[Task] = [ FixedTask(“x”, 10), FixedTask(“y”, 3) ]    for t in items:        print(t) main() What prints?

Consider the following program: class Dinosaur : def __init…

Consider the following program: class Dinosaur : def __init__(self, name: str = “dinosaur”) -> None: self._name = name def display(self) -> None: print(self._name) class Triceratops(Dinosaur) : def __init__(self) -> None: super().__init__(“triceratops”) x = Triceratops() x.display() What is displayed when it executes?

Consider the following class hierarchy: class Animal:    def…

Consider the following class hierarchy: class Animal:    def speak(self) -> str:        return “???”     def shout(self) -> str:        return self.speak().upper() class Dog(Animal):    def speak(self) -> str:        return “woof” def main() -> None:    animals: list[Animal] = [ Dog() ]    print( animals[0].shout() ) main()

Consider the following code snippet: aVehicle = Auto() aVeh…

Consider the following code snippet: aVehicle = Auto() aVehicle.moveForward(200) If the Auto class inherits from the Vehicle class, and both classes have an implementation of the moveForward method with the same set of parameters, which statement is correct?

Consider the following hierarchy representing a Report (or m…

Consider the following hierarchy representing a Report (or memorandum) class Report:    def __init__(self, title: str) -> None:        self._title = title     def render(self) -> str:        raise NotImplementedError(“bad”) class BrokenReport(Report):    def __init__(self, title: str) -> None:        super().__init__(title)     def __repr__(self) -> str:        return f”BrokenReport(title={self._title}, output={self.render()})” def main() -> None:    items: list[Report] = [BrokenReport(“HW1”)]    print(items) main() What gets printed when the main is run?