IB COMPUTER SCIENCE | B3 ASSESSMENT
OBJECT-ORIENTED PROGRAMMING: END OF TOPIC REVIEW
Assess class design, object state, access rules and HL relationships and patterns through scored retrieval, applied traces and developed written responses.
BEFORE YOU BEGIN
This review covers all ten B3 objectives. Use several sessions if needed: quick checks, applied traces, then written construction and explanations. B3.1 is common SL/HL; B3.2 is HL-only. The basic OOP ideas named in B3.1.1 remain common content.
Sections A and B award one point for each fully correct automatic item, with no partial credit within an item. Section C has separately suggested content marks. These are original practice questions, not an official IB paper, grade boundary or prediction.
Choose your level below. Write calculations, diagrams and Section C answers in your exercise book before revealing guidance. Answers and selections last while the page remains open.
Automatic total: 48 points. Suggested written total: 84 marks, assessed separately.
C | WRITTEN COMMUNICATION AND SUBJECT KNOWLEDGE
Write in your exercise book before revealing the guidance. The table gives practical guidance based on the IB command terms supplied in the guide; it is not the Cambridge command-word table.
In particular, IB compare focuses on similarities, while distinguish asks for differences. If you need to address both, the question can request each separately. All main commands below are highlighted.
| IB command term | What to provide here | Practical approach |
|---|---|---|
| Compare | Similarities, referring to both throughout | Use both to identify a shared property. |
| Suggest | A possible answer or solution | Apply relevant knowledge to propose a suitable test or approach. |
| Construct | Information in diagrammatic or logical form | Supply complete code/algorithm, including initialization, stopping and failure paths. |
| Trace | Follow and record actions of an algorithm | Separate arguments, variables, decisions, outputs and returned results. |
| Calculate | A numerical result with relevant working | Show counts or formula stages before the answer. |
| Describe | A detailed account | Give relevant features and an ordered process where useful. |
| Explain | A detailed account including reasons or causes | Link correct ideas using because, therefore, resulting in or leading to. |
| Compare and contrast | Similarities and differences, referring to both throughout | Use both for shared properties and whereas for differences. |
| Distinguish | Clear differences | State how roles or behaviours differ. |
| Evaluate | An appraisal weighing strengths and limitations | Connect trade-offs to the scenario and support the conclusion. |
A connective earns no automatic mark by itself: it must express an accurate relationship. For example, “a rejected battery request leaves state unchanged, therefore an excessive request cannot make the stored charge negative through that operation” explains a mechanism and consequence. Suggested marks reward subject content, not extra unofficial grammar marks.
C1 | EVALUATING OOP FOR A LIBRARY
6 suggested marks | COMMON SL/HL
Evaluate using OOP for a school library with many book copies and borrowing rules. Include two strengths, a relevant limitation and a justified judgement.
A BookCopy object can hold each copy’s current borrower and provide borrow/return operations. This groups the relevant state and rules, so different interfaces can reuse consistent validation. Separate objects also model independent copies naturally. However, introducing many unnecessary classes or a deep hierarchy can increase complexity. OOP fits the stateful multi-entity library, provided responsibilities stay focused; a small isolated calculation may remain a function.
SUGGESTED MARKING POINTS
- Identify a meaningful library object and its state.
- Explain how grouped operations can preserve a rule.
- Link a reusable operation to reduced duplicated logic.
- Explain independent object state in the scenario.
- Identify a relevant complexity or dependency cost.
- Reach a justified context-specific judgement.
Writing focus: Use because and therefore to connect each feature to a consequence, then weigh the limitation.
Equivalent accurate wording and methods can be valid. Use the points as self-assessment guidance, not an official IB markscheme.
Revisit related contentC2 | DESIGN A BOOK COPY
6 suggested marks | COMMON SL/HL
Construct a UML class diagram for a current-only BookCopy with a unique copy ID and optional current borrower ID. Include borrow(member_id), return_book() and is_available(). Describe the result of borrowing an already borrowed copy.
− borrower_id: String [0..1]
+ return_book(): Boolean
+ is_available(): Boolean
borrow returns False and leaves the current borrower unchanged when the copy is already borrowed. A successful borrow stores the member ID and returns True. is_available inspects whether a current borrower is absent.
SUGGESTED MARKING POINTS
- Show a named class and separate attribute/operation compartments.
- Represent the individual copy identifier.
- Represent optional current borrower state.
- Show borrow with its parameter and Boolean result.
- Show return and availability operations with suitable results.
- Describe rejection preserving the existing borrower.
Writing focus: Make the diagram readable; explain the rejected transition rather than only writing “error”.
Equivalent accurate wording and methods can be valid. Use the points as self-assessment guidance, not an official IB markscheme.
Revisit related contentC3 | CLASS STATE VERSUS OBJECT STATE
6 suggested marks | COMMON SL/HL
Distinguish between instance and class/static attributes using student scores and a shared school label. Include how static and instance methods differ in their receiving context. Explain the effect of assigning a.school in Python when school originally exists only on Student.
An instance score belongs to one student; the shared school label belongs to the class. Updating one score should not alter another student’s score. In Python, a.school = "Local" creates an instance attribute that shadows Student.school for a. Other instances without that shadow still find the class value. A static method has no automatic receiving instance; it is not the same as a Python classmethod receiving cls.
SUGGESTED MARKING POINTS
- Identify per-student score as instance state.
- Identify a common school label as class state.
- Explain independent score updates.
- Explain creation of the Python instance shadow.
- Explain lookup by another instance without the shadow.
- Correctly distinguish static-method reception from instance or classmethod reception.
Writing focus: Refer to both kinds of state and identify exactly which lookup changes.
Equivalent accurate wording and methods can be valid. Use the points as self-assessment guidance, not an official IB markscheme.
Revisit related contentC4 | CONSTRUCTION AND REFERENCE TRACING
6 suggested marks | COMMON SL/HL
Trace P1 in your book, recording a, b and alias as references to object X or Y. Explain why the final values differ and state the number of constructed objects.
| Stage | a | b | alias | X.value | Y.value |
|---|---|---|---|---|---|
| After first construction | X | Not assigned | Not assigned | 2 | Not created |
| After second construction | X | Y | Not assigned | 2 | 7 |
| After alias = a and add(3) | X | Y | X | 5 | 7 |
| After a = b | Y | Y | X | 5 | 7 |
| After final two additions | Y | Y | X | 6 | 9 |
Only two constructor calls occur. Rebinding a changes its reference to Y; alias still reaches X, therefore its addition affects X while a.add affects Y.
SUGGESTED MARKING POINTS
- Identify two distinct created instances.
- Record alias initially referring to X.
- Record X changing to 5 after add(3).
- Record a rebinding to Y without moving alias.
- Give final X = 6 and Y = 9.
- Explain identity and rebinding with two total constructions.
Writing focus: Keep reference names separate from object state; label values that do not yet exist honestly.
Equivalent accurate wording and methods can be valid. Use the points as self-assessment guidance, not an official IB markscheme.
Revisit related contentC5 | CONTROLLED BATTERY UPDATES
6 suggested marks | COMMON SL/HL
Explain how P2 protects battery state. Suggest tests for a valid request, an excessive request and a negative request. Discuss why an underscore alone is insufficient.
The public operation validates the amount before mutation. A valid 10 from 15 succeeds and leaves 5; a later 8 is rejected and leaves 5; a negative request is also rejected before mutation. The property offers read access. The underscore signals internal use by convention, so protection depends on callers respecting the intended interface and the implementation correctly enforcing its rules.
SUGGESTED MARKING POINTS
- Identify validation before mutation.
- Explain the successful transition 15 to 5.
- Explain excessive-request rejection with unchanged state.
- Include negative-request rejection and unchanged state.
- Explain the read-access role of the property.
- State that underscore is a convention rather than absolute privacy.
Writing focus: For explain, connect the check to the state outcome; include expected results in tests.
Equivalent accurate wording and methods can be valid. Use the points as self-assessment guidance, not an official IB markscheme.
Revisit related contentC6 | CONSTRUCT A CONTROLLED COUNTER
6 suggested marks | COMMON SL/HL
Construct a Python class or Java class for a StepCounter starting at zero. Provide read access to the count and add_steps(amount), which accepts positive whole-number amounts, returns a Boolean and leaves state unchanged on rejection. Explain one useful test.
class StepCounter:
def __init__(self):
self._count = 0
@property
def count(self):
return self._count
def add_steps(self, amount):
if type(amount) is not int or amount <= 0:
return False
self._count += amount
return True
For Python, add_steps(3) should return True and leave count 3; add_steps(0) should return False and leave count 3. An equivalent Java solution can accept int input and reject non-positive values before updating.
SUGGESTED MARKING POINTS
- Define a class with per-instance count initialized to zero.
- Provide a suitable read interface.
- Accept a supplied amount through an operation.
- Reject invalid or non-positive amounts before mutation.
- Update and return True on success; return False on rejection.
- Give a test with a correct result and final state.
Writing focus: Supply complete initialization and both success and rejection paths.
Equivalent accurate wording and methods can be valid. Use the points as self-assessment guidance, not an official IB markscheme.
Revisit related contentC7 | CHOOSE AND TEST AN OBJECT MODEL
6 suggested marks | COMMON SL/HL
Describe how to test two BookCopy objects and an alias to one of them. Explain why these tests reveal more than a single successful borrowing test.
Create two copies with different IDs and confirm both are available. Borrow the first and confirm the second remains available. Keep an alias to the first and verify it observes the same borrower. Attempt a second borrow and check rejection preserves that borrower. Return the first and verify availability through both references. These tests distinguish independent instances from aliases and test the rejected path as well as success.
SUGGESTED MARKING POINTS
- Create two independently identified copies.
- Check a borrow affects only the selected copy.
- Check an alias observes the same first-copy state.
- Test a second borrow is rejected without replacing the borrower.
- Test return restores availability through both references.
- Explain that independent-state, alias and rejection checks expose additional defects.
Writing focus: State expected observations and why they matter, rather than only listing method calls.
Equivalent accurate wording and methods can be valid. Use the points as self-assessment guidance, not an official IB markscheme.
Revisit related contentC8 | REUSE THROUGH INHERITANCE
6 suggested marks | HL ONLY
Explain how Robot can reuse Device initialization and extend its behaviour with a scan counter. Address super and one access restriction in Java.
Robot specialises Device and calls appropriate base initialization to prepare the same object’s identifier. It then initializes its own scan counter and increments that value in scan. It can reuse a suitable inherited report method. In Python super follows method resolution order; it does not create a separate Device object. Java private base state must be managed through permitted base operations rather than direct inherited-subclass field access.
SUGGESTED MARKING POINTS
- Identify a meaningful is-a specialisation.
- Explain reuse of base initialization.
- State initialization occurs on the same subclass object.
- Explain added scan state and operation.
- Identify suitable inherited behaviour reused.
- Explain an accurate Java access restriction.
Writing focus: Link inherited code to reuse, while making the added responsibility explicit.
Equivalent accurate wording and methods can be valid. Use the points as self-assessment guidance, not an official IB markscheme.
Revisit related contentC9 | OVERLOADING AND OVERRIDING
6 suggested marks | HL ONLY
Distinguish between Java overloading and overriding. Explain the returned string in the Java dispatch scenario using both declared and actual types.
Overloading offers same-name methods with different parameter lists; the compiler selects an applicable signature. Overriding provides a compatible subclass implementation of an inherited instance operation. item is declared Device, so show(Device) is selected. Its device.report() call uses the actual Robot object and dispatches to Robot.report, therefore the result is Device overload: Robot.
SUGGESTED MARKING POINTS
- Define overloading using different parameter lists.
- Identify compile-time signature selection.
- Define subclass instance overriding.
- Identify runtime instance dispatch.
- Explain why show(Device) is selected.
- Explain Robot.report and give the complete returned string.
Writing focus: Show the two selection steps in order instead of using “polymorphism” as the whole explanation.
Equivalent accurate wording and methods can be valid. Use the points as self-assessment guidance, not an official IB markscheme.
Revisit related contentC10 | ABSTRACTION AND MODULAR CODE
6 suggested marks | HL ONLY
Explain how P4 uses an abstract class to establish a common interface and share working code. Include what happens for Resource() and why implementation still needs testing.
Resource requires summary while providing a concrete preview algorithm. Article supplies the required summary, so its preview returns Preview: Read. Resource cannot be directly instantiated; Python raises TypeError. This separates the common preview from the variable content, allowing callers to rely on stable operations. ABC machinery does not prove return values or compatible calling behaviour, so contract tests remain necessary.
SUGGESTED MARKING POINTS
- Identify the required summary operation.
- Identify concrete shared preview code.
- Explain Article completing the requirement.
- Explain failed direct abstract construction.
- Link a stable interface to modular reuse.
- Explain a behavioural requirement not proven by the abstract marker.
Writing focus: Connect interface, implementation and consequence using a specific call.
Equivalent accurate wording and methods can be valid. Use the points as self-assessment guidance, not an official IB markscheme.
Revisit related contentC11 | COMPOSITION AND AGGREGATION
6 suggested marks | HL ONLY
Compare composition and aggregation in terms of their shared whole–part role. Then distinguish their ownership and lifetime rules using a report and a club. Include UML notation.
Both assemble a whole from smaller component objects. Composition gives the whole exclusive ownership of its parts, whose active modelled lifetime depends on it; a report owns its sections. Aggregation groups independent parts; students remain usable after a club disbands. UML places a filled composition diamond or hollow aggregation diamond at the whole. These lifecycle rules are separate from deleting a variable name or immediate garbage collection.
SUGGESTED MARKING POINTS
- State the common whole–part role.
- Explain exclusive composition ownership.
- Explain dependent lifetime with a report-section example.
- Explain independent student lifetime in aggregation.
- Identify both UML diamonds at the whole.
- Separate modelled lifetime from name deletion or immediate memory reclamation.
Writing focus: Use both for similarities, whereas for differences, and justify each example from its rules.
Equivalent accurate wording and methods can be valid. Use the points as self-assessment guidance, not an official IB markscheme.
Revisit related contentC12 | CHOOSE SUITABLE DESIGN PATTERNS
6 suggested marks | HL ONLY
Explain a suitable pattern for each requirement: shared settings in one controlled runtime, selecting a notice product, and refreshing several score listeners. Include a limitation of each.
Singleton can control access to one settings instance within the intended runtime, but shared mutable state complicates tests and does not automatically cross processes. A factory centralises notice creation behind a common contract, but its creation logic still needs to know the supported products. Observer registers listeners and invokes update after change, but subscription lifetime and callback failures need explicit policies.
SUGGESTED MARKING POINTS
- Explain singleton creation/access for the stated scope.
- Identify an accurate singleton limitation.
- Explain centralised factory product selection.
- Identify a relevant factory dependency or maintenance limit.
- Explain observer registration and notification.
- Identify a relevant observer timing, failure or lifecycle limit.
Writing focus: Pair each mechanism with a consequence and limitation in this scenario.
Equivalent accurate wording and methods can be valid. Use the points as self-assessment guidance, not an official IB markscheme.
Revisit related contentC13 | TRACE REFERENCES AND LIFETIME
6 suggested marks | HL ONLY
Trace P6, recording the three membership-list sizes and the identity of their student references. Explain why disbanding Robotics does not remove Sam from Coding.
After Club construction there are three distinct list containers, each initially holding a reference to the same Student. source.clear leaves its list empty without editing either club list. Sam’s points become 1. robotics.disband empties only Robotics. Final sizes are source 0, Robotics 0 and Coding 1; Coding’s member is still the original Sam with one point. The student’s lifetime is independent of either club.
SUGGESTED MARKING POINTS
- Identify separate source and club list containers.
- Identify one shared Student object rather than copied students.
- Explain source.clear leaves club membership intact.
- Give final sizes 0, 0 and 1.
- Give Sam’s final points as 1 through Coding.
- Explain independent lifetime and removal of only one grouping.
Writing focus: Separate containers, references and object values in the trace.
Equivalent accurate wording and methods can be valid. Use the points as self-assessment guidance, not an official IB markscheme.
Revisit related contentC14 | EXTEND AND TEST A RESOURCE PORTAL
6 suggested marks | HL ONLY
Construct a design plan for a resource portal with Article and Video products, a common preview operation and two listeners for publication changes. Evaluate whether a singleton is needed.
Define a common Resource contract with preview and concrete Article and Video implementations. A creation operation chooses the appropriate product, after which the page calls preview uniformly. A publication subject manages subscriptions for a dashboard and history listener through update. Test both product behaviours, correct creation, notification to both listeners and unsubscribe. A singleton is not automatically needed: an ordinary service instance passed to callers can share identity with clearer dependencies; use singleton only if controlled uniqueness in the intended scope is justified.
SUGGESTED MARKING POINTS
- Define a meaningful common resource operation.
- Provide two compatible concrete implementations.
- Separate product creation through a suitable factory.
- Define subject/listener registration and a common update operation.
- Give tests covering products and subscription changes.
- Evaluate singleton need with an accurate alternative and justified judgement.
Writing focus: Make responsibilities explicit and weigh complexity against the requirement for uniqueness.
Equivalent accurate wording and methods can be valid. Use the points as self-assessment guidance, not an official IB markscheme.
Revisit related contentCHECK THE QUALITY OF YOUR WRITING
Did you answer the command? For explain, check the reason or cause; for compare, address both items through similarities; for compare and contrast, include differences too; for discuss, balance relevant factors in context; for distinguish, make the differences explicit; for evaluate, weigh strengths and limitations and support your conclusion.
For construct, check labels, connections and completeness. For calculate, show enough working to follow your method and label units. Select two weak responses and rewrite them after revising. Keep the written total separate from your automatic result.
YOUR NEXT REVISION STEP
Submit the automatic sections for targeted revision links.
Record your own written marks using the suggested points. Choose two weaknesses and attempt new examples after revising. Use the B3 revision page for worked content and a personal flashcard list, or return to the IB course index.