IB Computer Science HL · Year 2 · Lesson 15

B3.1 Cumulative Paper 2 Checkpoint

Use the entire single-class OOP toolkit under reduced scaffolding and diagnose any remaining gaps before HL multiple-class OOP.

Paper 250 minutesB3.1.1–B3.1.5 cumulative
Checkpoint

Less support, more independent recall

2 / 10
Checkpoint ruleAttempt each task before revealing. If a gap appears, use the model to repair it immediately and then retry from memory.
B3.1.1B3.1.2B3.1.3B3.1.4B3.1.5
Learn + retrieve

Rapid Recall Deck

3 / 10

Attempt each card first. If a term is new, flip and study it, then answer it again without looking. Mark only secure recall as “Know it”.

Paper 2 checkpoint

Design before implementation

4 / 10
ScenarioA workshop booking system stores one workshop session per object. Each session has a workshop title, facilitator name, maximum seats and a private number of confirmed seats. The organization name is the same for every session object. A session must support confirm(), which adds one confirmed seat only when capacity remains, and spaces_left().

Part A · Construct the UML

Class name
Shared + instance state
Required methods
WorkshopSession
-------------------------
organization_name
workshop_title
facilitator_name
max_seats
_confirmed
-------------------------
confirm()
spaces_left()
Construct

From UML to executable Python

5 / 10

Part B · Construct the class

Construct WorkshopSession from these requirements: organization_name is shared by all sessions; each object stores workshop_title, facilitator_name, max_seats and private _confirmed starting at 0. confirm() adds one seat only when capacity remains and returns whether it succeeded. spaces_left() returns the remaining seats.

class WorkshopSession:
    organization_name = "City Learning Centre"

    def __init__(self, workshop_title, facilitator_name, max_seats):
        self.workshop_title = workshop_title
        self.facilitator_name = facilitator_name
        self.max_seats = max_seats
        self._confirmed = 0

    def confirm(self):
        if self._confirmed < self.max_seats:
            self._confirmed += 1
            return True
        return False

    def spaces_left(self):
        return self.max_seats - self._confirmed
Explain

Object creation and information hiding

6 / 10

Part C · Instantiation

List the important operations when the following statement executes:

s1 = WorkshopSession("Robotics", "Nia", 2)
  1. A new WorkshopSession object is created.
  2. __init__ runs using the supplied arguments.
  3. The object’s workshop title, facilitator name, maximum seats and initial confirmed count are initialized.
  4. The object reference is assigned to s1.

Part D · Private state

Explain two consequences of treating _confirmed as private state.

Outside code is expected not to change it directly, so updates go through controlled class behaviour; this reduces accidental/invalid changes and helps protect the integrity of the capacity rule.

Debug

Can you diagnose class-vs-instance state?

7 / 10
class WorkshopSession:
    organization_name = "City Learning Centre"
    confirmed = 0

    def __init__(self, workshop_title, facilitator_name, max_seats):
        self.workshop_title = workshop_title
        self.facilitator_name = facilitator_name
        self.max_seats = max_seats

    def confirm(self):
        if WorkshopSession.confirmed < self.max_seats:
            WorkshopSession.confirmed += 1

Debug the design

Two session objects can have different confirmed-seat counts. Identify the OOP design error and state the correction.

confirmed is incorrectly a class variable, so all session objects share one count. It should be an instance variable such as self._confirmed = 0 initialized in __init__ and updated through self._confirmed.

Exam lens

Cumulative B3.1 practice

8 / 10

Independent Paper 2 mini-set

1. Evaluate the use of OOP for a booking system expected to grow to many workshops and users.

2. Construct a method cancel() that decreases _confirmed only when the count is greater than 0.

3. Explain why organization_name can reasonably be class-level while workshop_title should be instance-level.

  1. A strong evaluation balances modelling/reuse/maintenance against added class-design complexity and concludes that OOP is suitable for the growing workshop-management application.
  2. def cancel(self):
        if self._confirmed > 0:
            self._confirmed -= 1
  3. The organization name is genuinely shared across all sessions, while different session objects can represent different workshops and therefore need independent workshop_title state.
Progress check

Turn errors into the next practice target

9 / 10

Gap diagnosis

Which B3.1 skill currently needs the most work?

UML/design
class vs instance members
constructors/object creation
encapsulation/information hiding
OOP evaluation

IA progress check

Show current Criterion D progress: one implemented feature, one test, and one piece of evidence you can document.

Homework

Finish the learning cycle

10 / 10

IA — main task

Continue Criterion D development/testing. Make sure your evidence log records what changed, why, and how you tested it.

Paper 2 — short practice

Redo only the checkpoint parts you missed today. Do not repeat secure sections just for volume.