Skip to content
ExamSpine

B3.1 Fundamentals of OOP for a single class: notes and practice

B3.1 introduces object-oriented programming with one class: classes and objects, constructors, attributes and methods, static members, encapsulation, access modifiers and UML class diagrams.

Paper 2SL and HL7 practice questions

What you need to know

Our summary of the topic in our own words, not the IB guide.

  • Explain what object oriented programming is and how it differs from a procedural approach
  • Distinguish a class from an object and explain what instantiation means
  • Evaluate the benefits of an object oriented design for a described problem
  • Identify the attributes and methods a class needs from a problem description
  • Draw a UML class diagram for a single class showing attributes, methods and visibility
  • Distinguish static from non-static variables and methods, and say which belongs to the class and which to the instance
  • Predict the value of a static variable shared across several objects
  • Write code that defines a class with a constructor
  • Write code that instantiates objects and calls their methods
  • Trace a program that creates several objects and state the state of each
  • Explain encapsulation and information hiding and why internal state is protected
  • Apply access modifiers to attributes and methods appropriately
  • Write accessor and mutator methods, including validation inside a mutator

Learn it

Practice questions

Original questions written for the 2027 course, marked as you go. Easiest first.

Exam tips for B3.1

  • A class is the blueprint and an object is one thing made from it. Use the terms precisely.
  • Static members belong to the class and are shared by every object. Trace them carefully.
  • Put validation inside mutator (setter) methods. It is a common exam request.

Updated 24 October 2026. Topic codes are used as labels. Everything on this page is written by ExamSpine and is not endorsed by the IB.