IB · Class 12 · Set 2
Computer Science
Practice for IB 2026-27 assessments. Examination sessions run in May and November according to school registration.
Independent practice paper — verify on official board sources
Disclaimer: BharatBoard is an independent student and parent guide — not affiliated with, associated with, or endorsed by any Central Board, State Board, school, educational institution, recruitment commission, or government body, and does not represent any government entity. We recommend that you contact and verify all exam results, date sheets, syllabi, school admission dates, eligibility criteria, fee schedules, scholarships, and government job notifications directly with the respective school, institution, Central Board, State Board, or recruitment body via their official websites and notifications. These questions are original practice items for revision. Follow the official syllabus, the prescribed textbooks, and your school or institution. Model answers are a study aid. They are not an official marking scheme.
IB Class 12 Computer Science, Set 2, is an original BharatBoard revision set of 20 marks. It is shorter than a full board paper. The official syllabus and sample papers on the IB website remain the authority.
Timed Exam Mode
Official 60-minute writing countdown
General instructions & how to use this paper
- This revision set has 15 questions and 20 marks. Ten questions are one mark. Five questions are two marks. Attempt every question. A calculator is not needed.
- Timing is typical months only — always verify the exact dates on the official board website, which change every session.
Section A
· Multiple-choice questionsAttempt all ten 1-mark questions.
In Object-Oriented Programming (OOP), declaring class attributes private and exposing controlled public getter/setter methods exemplifies:
Model answer · Option C
Encapsulation hides internal representation details and lets mutator methods validate updates (e.g., rejecting negative account deposits) before modifying fields.
A CityLibrary object holds a list of Book objects; if the CityLibrary closes, those Book instances are transferred intact to regional branches. Which OOP relationship models this?
Model answer · Option B
Aggregation represents a loosely coupled whole-part ("has-a") association where contained objects continue existing independently of the container.
Subclasses Circle and Rectangle both override calculateArea() inherited from abstract class Shape. Calling s.calculateArea() on a heterogeneous Shape[] array demonstrates:
Model answer · Option A
Polymorphism allows one unified interface call s.calculateArea() to invoke each object’s specific overridden implementation dynamically at runtime.
What distinguishes method overloading from method overriding in Java or C++ OOP design?
Model answer · Option D
Compilers resolve overloaded calls statically by argument count/types, whereas overridden subclass methods replace inherited behaviour polymorphically.
Inside a SensorReading class, field deviceCount is declared static whereas temperatureCelsius is non-static. If 50 objects are instantiated, how many copies of each exist in memory?
Model answer · Option C
A static member belongs to the class itself and is shared across every instance, whereas non-static instance attributes are allocated per object.
In a standard UML class diagram, what visibility access modifiers do the symbols −, #, and + denote respectively?
Model answer · Option B
UML notation marks private class-only members with minus (−), subclass-accessible protected members with hash (#), and public interfaces with plus (+).
Why has variable-width Unicode (UTF-8) replaced 7-bit ASCII across modern globalised software applications?
Model answer · Option A
7-bit ASCII is limited to 128 characters (0–127), whereas UTF-8 supports multilingual global scripts seamlessly for internationalisation.
What primary compile-time benefit arises from declaring ArrayList<Invoice> rather than an untyped raw collection in Java?
Model answer · Option D
Parameterised generics let the compiler enforce homogeneous element types, preventing ClassCastException crashes during runtime iteration.
When a subclass ElectricBus extends superclass Vehicle, what role does calling super(registrationID, capacity) perform on line one of the subclass constructor?
Model answer · Option C
Chaining to super(...) reuses validated superclass initialisation logic instead of duplicating code or leaving inherited fields uninitialised.
From a software-ethics and governance perspective, how can biased historical training datasets harm automated loan-approval or recruitment algorithms?
Model answer · Option B
Uncorrected historical skew causes algorithmic decisions to systematically disadvantage underrepresented groups unless audited for fairness and transparency.
Section B
· Short-answer questionsAttempt all five 2-mark questions.
Explain two concrete maintenance benefits of encapsulation when multiple developers collaborate on a large banking codebase.
Model answer
Private fields prevent external classes from corrupting invariants directly, and internal data representations (e.g., changing cents from double to long integer) can be refactored without breaking caller code that uses public getters/setters.
Distinguish clearly between inheritance ("is-a") and composition/aggregation ("has-a") using Hospital, Ward, and Surgeon classes.
Model answer
A Surgeon "is-a" MedicalStaff subclass (inheritance sharing staff ID and licensing methods), whereas a Hospital "has-a" collection of Wards (composition) and employs Surgeons (aggregation).
Explain why declaring a base class Animal with an abstract method makeSound() is cleaner than writing an empty dummy method.
Model answer
An abstract class cannot be instantiated accidentally on its own, and marking makeSound() abstract forces every concrete subclass (e.g., Wolf, Eagle) at compile time to supply a meaningful implementation.
Contrast open-source licensing with proprietary closed-source licensing for a municipal school-management platform.
Model answer
Open-source code allows independent security audits, local customisation, and freedom from vendor lock-in, whereas proprietary software restricts source access and charges recurring licence fees in exchange for dedicated vendor SLA support.
Write the state of private field stock after: Item p = new Item(20); p.restock(15); p.sell(40); assuming sell(q) only deducts q when q ≤ stock.
Model answer
Constructor sets stock = 20; restock(15) updates stock to 35; sell(40) fails the validation guard (40 ≤ 35 is false) and rejects the deduction, leaving final stock = 35.
Official syllabus & blueprint sources
Syllabus scope and question-paper structure were verified against the official portals below, which remain the sole authority.