- IB
- B3.1 Fundamentals of OOP for a single class
Practice B3.1 Fundamentals of OOP for a single class 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: MathTutor Educational Software is developing a calculator application that needs to handle different types of mathematical operations: addition with two integers, addition with two decimals, and addition with three numbers for advanced calculations.
State what is meant by "method overloading" in object-oriented programming.
Describe the rules that govern method overloading and explain how the compiler determines which overloaded method to call.
Using the MathTutor case study, explain how method overloading would be implemented for the addition operations and why this approach is beneficial.
Case Study: GeometryLibrary is creating a mathematical utilities package with functions like calculateCircleArea(), calculateTriangleArea(), and findMaximum(). These functions don't depend on specific object instances and should be available without creating geometry objects.
Define what is meant by "static methods" in object-oriented programming.
Compare static methods with instance methods in terms of how they are called and what data they can access.
Using the GeometryLibrary case study, justify why the utility functions should be static and explain the advantages of this design choice.
Case Study: GlobalSchool Network is building an educational platform that needs to track the total number of students across all schools in their system. This count must be shared among all Student objects and updated whenever new students enroll or graduate.
Define what is meant by "class attributes" (static variables) in object-oriented programming.
Distinguish between class attributes and instance attributes in terms of memory allocation and sharing among objects.
Using the GlobalSchool case study, explain why a class attribute would be appropriate for tracking total student count and how it would be implemented.
Case Study: ECommercePlatform is developing a ShoppingCart class that directly accesses database tables to retrieve product information, update inventory, and process payments, creating tight dependencies on specific database structures.
Define what is meant by "object coupling" in object-oriented design.
Distinguish between loose coupling and tight coupling, explaining the implications of each for software maintenance.
Using the ECommercePlatform case study, analyse the coupling issues created by direct database access and suggest improvements.
Case Study: An online university is building a student management system to handle enrolments, grades, and academic records. The system needs to manage thousands of students, each with unique information like student ID, name, courses, and GPA.
State what is meant by a "class" in object-oriented programming.
Distinguish between a class and an object, explaining the relationship between them.
Using the university case study, describe what would constitute the Student class definition and what would be examples of objects for this scenario.
Case Study: CorporateStructure Ltd. is modelling their organization where a Department contains Employee objects and Office objects. Employees can work in multiple departments and offices can be shared between departments.
State what is meant by "aggregation" in object-oriented design.
Compare aggregation with composition in terms of object relationships and lifecycle dependencies.
Using the CorporateStructure case study, analyse whether aggregation or composition would be more appropriate for Department-Employee and Department-Office relationships.
Case Study: SecureBank is developing an online banking application where customer account information must be protected from unauthorized access. Account balances and transaction histories contain sensitive financial data that requires strict security measures.
Define what is meant by "encapsulation" in object-oriented programming.
Explain the benefits of using private and public access modifiers in class design.
Using the SecureBank case study, explain why the account balance should be private and describe what public methods would be necessary to interact with the balance safely.
Case Study: AutoDealership is creating a vehicle inventory system to manage their car lot. Each vehicle needs to be initialized with essential information like make, model, year, VIN number, and mileage when added to their inventory database.
State what is meant by "constructor" in object-oriented programming.
Compare default constructors with parameterized constructors, explaining when each would be appropriate.
Using the AutoDealership case study, design appropriate constructors for the Vehicle class and justify your choices.
Case Study: TextEditor Pro is developing a document formatting system where operations like bold(), italic(), and underline() need to be chained together to create complex formatting commands efficiently: text.bold().italic().underline().
State what is meant by "method chaining" in object-oriented programming.
Describe how method chaining is implemented and explain the benefits it provides for code readability and user experience.
Using the TextEditor case study, explain how method chaining would improve the usability of formatting operations and provide an example.
Case Study: SafetyFirst Manufacturing is developing a PressureTank class for industrial equipment where the pressure reading must always remain within safe operating limits (0-1000 PSI) to prevent equipment damage and ensure worker safety.
Define what is meant by "class invariants" in object-oriented programming.
Explain how class invariants contribute to software reliability and describe when they should be checked during object lifecycle.
Using the SafetyFirst case study, describe what class invariants would be appropriate for PressureTank and explain how they ensure system safety.