- IB
- B3.2 Fundamentals of OOP for multiple classes (HL only)
Practice B3.2 Fundamentals of OOP for multiple classes (HL only) with authentic IB Computer Science (First Exam 2027) exam questions for both SL and HL students. This question bank mirrors Paper 1, 2, 3 structure, covering key topics like programming concepts, algorithms, and data structures. Get instant solutions, detailed explanations, and build exam confidence with questions in the style of IB examiners.
Case Study: TransportFleet Inc. has a Vehicle class with a startEngine() method that performs basic engine startup. Their Car and Motorcycle subclasses need different starting procedures: cars require fuel pump priming and automatic transmission checks, while motorcycles need kickstand safety checks.
Define what is meant by "method overriding" in object-oriented programming.
Describe the rules and requirements for properly overriding methods in inheritance hierarchies.
Using the TransportFleet case study, explain how method overriding would be implemented for the different starting procedures and what precautions should be taken.
Case Study: DesignStudio Pro is creating a drawing application where users can create different shapes (Circle, Rectangle, Triangle) that all need to calculate area and perimeter, but each shape uses different mathematical formulas for these calculations.
State what is meant by "polymorphism" in object-oriented programming.
Compare compile-time polymorphism (method overloading) with runtime polymorphism (method overriding), explaining when each occurs.
Using the DesignStudio case study, describe how polymorphism would allow treating different shapes uniformly while maintaining specific area calculations.
Case Study: AeronauticsDesign Corp wants to create a FlyingCar class that needs characteristics from both their existing Car class (wheels, steering, land navigation) and Aircraft class (wings, flight controls, air navigation), but their programming language doesn't support multiple inheritance.
Define what is meant by "multiple inheritance" in object-oriented programming.
Explain the diamond problem that can occur with multiple inheritance and describe how different programming languages address this issue.
Using the AeronauticsDesign case study, analyse the challenges this creates and suggest design solutions that avoid multiple inheritance problems.
Case Study: MotorVehicles Inc. has a Vehicle class with basic initialization. Their Motorcycle class needs to call the Vehicle constructor to set make and model, then add motorcycle-specific attributes like engine displacement and handlebar type.
State what is meant by "super" keyword in object-oriented programming.
Describe the different ways the super keyword can be used in inheritance relationships and explain why it is important.
Using the MotorVehicles case study, explain how super would be used in the Motorcycle constructor and why this approach is beneficial.
Case Study: GraphicsEngine Ltd. has a Shape hierarchy where Circle and Rectangle classes both override the draw() method from the base Shape class. When the rendering system calls draw() on a Shape reference that points to a Circle object, it needs to execute Circle's specific drawing code.
State what is meant by "method resolution" in polymorphic inheritance hierarchies.
Describe how virtual method tables (vtables) or similar mechanisms enable dynamic method dispatch in object-oriented languages.
Using the GraphicsEngine case study, explain the process that occurs when draw() is called on a Shape reference pointing to a Circle object.
Case Study: WildlifePreserve is developing a zoo management system where they need to model different animals. All animals share common attributes (name, age, species, habitat) but have specific behaviours like Lion.roar(), Elephant.trumpet(), and Penguin.swim().
Define what is meant by "inheritance" in object-oriented programming.
Explain the benefits and potential drawbacks of using inheritance in software design.
Using the WildlifePreserve case study, analyse how inheritance could be used to model different animal types and discuss the advantages of this approach.
Case Study: GameEngine Pro is developing a framework for video games where they need to define common behaviour for all game entities (position, health, collision detection) while ensuring that specific entity types (Player, Enemy, PowerUp) must implement their own update and render methods.
State what is meant by "abstract classes" in object-oriented programming.
Compare abstract classes with concrete classes, explaining when abstract classes are appropriate to use.
Using the GameEngine case study, justify why an abstract GameEntity class would be beneficial for the game framework.
Case Study: MediaCenter Entertainment is building a media application where different player classes (AudioPlayer, VideoPlayer, StreamingPlayer) all need to support the same basic operations: play(), pause(), stop(), and getStatus(), but each implements these differently based on their media type.
Define what is meant by "interfaces" in object-oriented programming.
Compare interfaces with abstract classes in terms of their purpose and implementation constraints.
Using the MediaCenter case study, explain how an interface would solve this design challenge and describe the benefits.
Case Study: FinTechSolutions is developing a PaymentProcessor class that needs to work with different payment methods (CreditCardService, PayPalService, BankTransferService). Currently, the class creates these service objects internally, making testing difficult and coupling it tightly to specific implementations.
State what is meant by "dependency injection" in object-oriented design.
Describe the different types of dependency injection and explain how this pattern improves code testability and maintainability.
Using the FinTechSolutions case study, explain how dependency injection would make the PaymentProcessor design more flexible and easier to test.