PCAP Object-Oriented Programming • Set 10
PCAP Object-Oriented Programming Practice Test 10 — 15 questions with explanations. Free, no signup.
A developer is building a simulation of different types of vehicles. They have a base class Vehicle with an attribute speed initialized in __init__. They also have a subclass Car that inherits from Vehicle and adds an attribute fuel_type. The developer wants to ensure that every time a Car object is created, it also initializes the speed attribute from the Vehicle class. Which approach should the developer use?
Choose an answer to begin — your selection is scored in the full session.
15 questions · instant feedback and full explanations after every question.