Current Affairs updated daily
KalviGavaniKalviGavani

OOP Techniques Exercise Solutions | KalviGavani

TN Class 11 CS Introduction to OOP Techniques solutions: classes, objects, encapsulation, inheritance, polymorphism with Python examples and exam tips.

Updated 15 June 202623 min read

Exercise Solutions Available

Step-by-step answers for all textbook questions in this chapter

View Solutions →

Introduction to Object-Oriented Programming Techniques — Exercise Solutions

1. How to Use This Page

Welcome to the TN Board Class 11 Computer Science exercise solutions for the chapter Introduction to Object-Oriented Programming Techniques. Here is how to get the most out of this page:

  • Read the Key Concepts section first — it gives you a rapid recap of every major topic in the chapter with Python code examples you can try in your IDLE.
  • Attempt every question on your own before reading the solution. Cover the answer with your hand, think, and then compare.
  • Pay special attention to the explanations after each MCQ — the reasoning matters more than the final letter.
  • Use the Common Mistakes and Exam Checklist sections the night before your exam for a quick, focused review.

2. Key Concepts (Quick Recap)

Classes and Objects

ConceptDescription
ClassA blueprint or template that defines the properties (attributes) and behaviours (methods) common to all objects of that type.
ObjectAn instance of a class. Each object has its own copy of instance variables but shares the class methods.
Instance VariableA variable defined inside __init__ (or any method) using self. — unique to each object.
Class VariableA variable defined inside a class but outside any method — shared across all objects of the class.
class Student:
    school_name = "Govt HSS"          # class variable

    def __init__(self, name, roll_no):
        self.name = name                # instance variable
        self.roll_no = roll_no          # instance variable

    def display(self):
        print(f"{self.roll_no} - {self.name}")

s1 = Student("Arun", 101)
s2 = Student("Bala", 102)
s1.display()   # 101 - Arun
s2.display()   # 102 - Bala

The Four Pillars of OOP

PillarWhat It MeansPython Example
EncapsulationBundling data and methods together; restricting direct access to internal state.Using self.__balance (name-mangled) to hide an attribute.
AbstractionShowing only essential features and hiding background details.A start_engine() method hides ignition complexity.
InheritanceA child class derives properties and methods from a parent class.class Dog(Animal): — Dog inherits from Animal.
PolymorphismSame interface, different behaviour depending on context.len() works on strings, lists, and tuples differently.

Encapsulation — Detailed

class BankAccount:
    def __init__(self, owner, balance):
        self.owner = owner
        self.__balance = balance       # private attribute (name-mangled)

    def deposit(self, amount):
        if amount > 0:
            self.__balance += amount

    def withdraw(self, amount):
        if 0 < amount <= self.__balance:
            self.__balance -= amount
        else:
            print("Insufficient balance")

    def get_balance(self):
        return self.__balance           # controlled access

acc = BankAccount("Kumar", 5000)
acc.deposit(2000)
print(acc.get_balance())   # 7000
# print(acc.__balance)     # AttributeError — cannot access directly

Inheritance — Types and Examples

TypeDefinitionSyntax
SingleOne child inherits from one parent.class Child(Parent):
MultilevelChild inherits from a derived class, forming a chain.class Grandchild(Child):
MultipleChild inherits from more than one parent simultaneously.class Child(Parent1, Parent2):
HierarchicalMultiple children inherit from one parent.Multiple class X(Parent):
# Single Inheritance
class Animal:
    def speak(self):
        print("Animal speaks")

class Dog(Animal):
    def bark(self):
        print("Dog barks")

d = Dog()
d.speak()   # Inherited from Animal
d.bark()    # Own method
# Multilevel Inheritance
class GrandParent:
    def house(self):
        print("GrandParent's house")

class Parent(GrandParent):
    def car(self):
        print("Parent's car")

class Child(Parent):
    def bike(self):
        print("Child's bike")

c = Child()
c.house()   # Inherited through chain
c.car()     # Inherited from Parent
c.bike()    # Own method

Polymorphism — Detailed

Compile-time (Static) Polymorphism: Method overloading — same method name, different parameters. Python does not support true method overloading; the last definition wins.

Run-time (Dynamic) Polymorphism: Method overriding — child class redefines a parent method.

class Shape:
    def area(self):
        return 0

class Circle(Shape):
    def __init__(self, radius):
        self.radius = radius

    def area(self):                       # overriding
        return 3.14 * self.radius ** 2

class Rectangle(Shape):
    def __init__(self, length, breadth):
        self.length = length
        self.breadth = breadth

    def area(self):                       # overriding
        return self.length * self.breadth

shapes = [Circle(5), Rectangle(4, 6)]
for s in shapes:
    print(s.area())   # 78.5, 24 — same method name, different behaviour

Constructors and the self Parameter

ConceptDetails
Constructor__init__() — called automatically when an object is created. Used to initialise instance variables.
selfRefers to the current object. Must be the first parameter of every instance method. Python passes it automatically.
Default ConstructorA constructor with no parameters besides self.
Parameterised ConstructorA constructor that accepts arguments besides self.
class Book:
    # Default constructor
    def __init__(self):
        self.title = "Unknown"
        self.author = "Unknown"

    # Note: Python does not support constructor overloading.
    # Use default arguments instead:
    # def __init__(self, title="Unknown", author="Unknown"):

b = Book()
print(b.title)   # Unknown

Access Specifiers in Python

SpecifierSyntaxAccess Level
Publicself.nameAccessible from anywhere.
Protectedself._nameAccessible within the class and subclasses (convention only, not enforced).
Privateself.__nameName-mangled to self._ClassName__name; not directly accessible outside the class.

3. I. Choose the Best Answer (MCQs)

Q1. Which of the following is a blueprint that defines the structure and behaviour of objects?

(a) Object (b) Class (c) Method (d) Constructor

Answer(b) Class
ExplanationA class is a template or blueprint. Just as an architectural drawing defines how a house should be built, a class defines what attributes and methods its objects will have. An object is created from a class, a method is a function inside a class, and a constructor is a special method used to initialise objects.

Q2. The concept of wrapping data and methods together into a single unit is called:

(a) Inheritance (b) Polymorphism (c) Encapsulation (d) Abstraction

Answer(c) Encapsulation
ExplanationEncapsulation means bundling data (attributes) and the methods that operate on that data into one unit — the class — and restricting direct access to the internal state. Think of a medicine capsule: the ingredients are bundled inside and you cannot access them directly; you take the capsule as a whole.

Q3. A child class inherits from two or more parent classes. Which type of inheritance is this?

(a) Single inheritance (b) Multilevel inheritance (c) Multiple inheritance (d) Hierarchical inheritance

Answer(c) Multiple inheritance
ExplanationWhen one child class derives from more than one parent class simultaneously, it is called multiple inheritance. In Python, it is written as class Child(Parent1, Parent2):. Single inheritance involves one parent, multilevel involves a chain, and hierarchical involves multiple children from one parent.

Q4. Which method is automatically called when an object is created in Python?

(a) __new__() (b) __init__() (c) __create__() (d) __start__()

Answer(b) __init__()
ExplanationThe __init__() method is the constructor in Python. It is invoked automatically every time you create a new object of the class. While __new__() is also called during object creation (it allocates memory), __init__() is the method that initialises the object's attributes and is the one the textbook focuses on.

Q5. What does the self parameter in a Python class method refer to?

(a) The class itself (b) The current object calling the method (c) The parent class (d) The global namespace

Answer(b) The current object calling the method
Explanationself is a reference to the object that is calling the method. When you write obj.method(), Python internally converts it to Class.method(obj), passing the object as the first argument. This is how each object keeps its own data separate.

Q6. Which access specifier in Python makes an attribute private using name mangling?

(a) Single underscore prefix: _var (b) Double underscore prefix: __var (c) No prefix: var (d) Triple underscore prefix: ___var

Answer(b) Double underscore prefix: __var
ExplanationIn Python, prefixing an attribute with double underscores (__) triggers name mangling. Python renames __var to _ClassName__var internally, making it difficult (though not impossible) to access from outside the class. A single underscore (_var) is only a convention indicating "protected" and is not enforced.

Q7. Method overriding is an example of which type of polymorphism?

(a) Compile-time polymorphism (b) Run-time polymorphism (c) Operator overloading (d) Method overloading

Answer(b) Run-time polymorphism
ExplanationMethod overriding occurs when a child class provides its own implementation of a method already defined in the parent class. The decision about which version to call is made at runtime based on the object type, making it a form of run-time (dynamic) polymorphism. Method overloading would be compile-time, but Python does not support true method overloading.

Q8. In multilevel inheritance, if class C inherits from class B, and class B inherits from class A, which class does C NOT directly inherit from?

(a) Class A (b) Class B (c) Both A and B (d) C inherits attributes from both A and B

Answer(a) Class A
ExplanationIn multilevel inheritance, class C directly inherits from class B only. However, because class B already inherits from class A, class C indirectly gets attributes from A as well. The key word in the question is "directly" — C directly inherits from B, not A.

Q9. Which of the following is NOT a feature of Object-Oriented Programming?

(a) Data hiding (b) Function overloading (c) Inheritance (d) Procedural paradigm

Answer(d) Procedural paradigm
ExplanationData hiding (through encapsulation), function/method overloading (a form of polymorphism), and inheritance are all core features of OOP. The procedural paradigm is a different programming paradigm altogether — it focuses on functions/procedures rather than objects.

Q10. What is the output of the following code?

class Test:
    def __init__(self, a=10):
        self.a = a

t1 = Test()
t2 = Test(20)
print(t1.a + t2.a)

(a) 10 (b) 20 (c) 30 (d) Error

Answer(c) 30
Explanationt1 is created with the default argument, so t1.a is 10. t2 passes 20, so t2.a is 20. The sum is 30. Default arguments allow a constructor to work with or without explicit values.

4. II. Fill in the Blanks

1. A \_\_\_\_\_\_ is a blueprint that defines the structure and behaviour of objects. Answer: class

2. An \_\_\_\_\_\_ is an instance of a class. Answer: object

3. The \_\_\_\_\_\_ method is called automatically when an object is created in Python. Answer: __init__

4. In Python, \_\_\_\_\_\_ refers to the current object and must be the first parameter of every instance method. Answer: self

5. \_\_\_\_\_\_ is the process of bundling data and methods that operate on the data into a single unit. Answer: Encapsulation

6. The \_\_\_\_\_\_ inheritance type involves one child class inheriting from more than one parent class. Answer: Multiple

7. When a child class provides its own implementation of a method defined in the parent class, it is called \_\_\_\_\_\_. Answer: method overriding

8. In Python, prefixing an attribute with \_\_\_\_\_\_ makes it private through name mangling. Answer: double underscore (__)

9. \_\_\_\_\_\_ is the OOP principle that allows hiding unnecessary details and showing only essential features. Answer: Abstraction

10. A \_\_\_\_\_\_ constructor does not accept any arguments besides self. Answer: default

11. The process of acquiring the properties of one class by another class is called \_\_\_\_\_\_. Answer: inheritance

12. \_\_\_\_\_\_ polymorphism is also known as static polymorphism. Answer: Compile-time


5. III. True or False

1. A class can exist without creating any objects. Answer: True Explanation: A class is simply a definition or blueprint. It can be defined without ever creating an object from it, just as an architectural plan can exist without building a house.


2. In Python, a private attribute can never be accessed from outside the class. Answer: False Correction: Python uses name mangling for private attributes (e.g., __var becomes _ClassName__var), so they can still be accessed using the mangled name. True encapsulation with strict access control does not exist in Python; it relies on convention.


3. Method overloading is fully supported in Python. Answer: False Correction: Python does not support true method overloading. If you define multiple methods with the same name, only the last definition is retained. Default arguments can simulate some overloading behaviour, but it is not the same as compile-time method overloading found in languages like C++ or Java.


4. A child class can override methods of the parent class. Answer: True Explanation: Method overriding is a key feature of inheritance. The child class can provide its own implementation of a method that already exists in the parent class. This is an example of run-time polymorphism.


5. In multilevel inheritance, a grandchild class can access methods of the grandparent class. Answer: True Explanation: In multilevel inheritance, properties and methods are inherited through the chain. If class A is inherited by class B, and class B is inherited by class C, then class C can access methods of both class B and class A.


6. The self keyword is mandatory in Python class definitions, but you can name it something else. Answer: True Explanation: While self is the conventional name, Python does not enforce it. You could technically use this, obj, or any other name as the first parameter. However, using anything other than self is considered very poor practice and makes code hard to read.


6. IV. Match the Following

No.Column ANo.Column B
1ClassaInstance of a class
2ObjectbBlueprint or template
3EncapsulationcHiding unnecessary details
4AbstractiondBundling data and methods
5InheritanceeAcquiring properties from parent
6PolymorphismfSame interface, different behaviour
7__init__gConstructor method
8selfhReference to current object
Answer
Column AColumn B
1 — Classb (Blueprint or template)
2 — Objecta (Instance of a class)
3 — Encapsulationd (Bundling data and methods)
4 — Abstractionc (Hiding unnecessary details)
5 — Inheritancee (Acquiring properties from parent)
6 — Polymorphismf (Same interface, different behaviour)
7 — __init__g (Constructor method)
8 — selfh (Reference to current object)

7. V. Answer Briefly (2-Mark Questions)

Q1. What is a class? Give an example.

A class is a blueprint or template that defines the properties (attributes) and behaviours (methods) that its objects will have. It does not occupy memory for data; it only describes the structure.

class Car:
    def __init__(self, brand, colour):
        self.brand = brand
        self.colour = colour

    def display(self):
        print(f"{self.colour} {self.brand}")

Here, Car is a class that specifies that every car object will have a brand and a colour, and can display itself.


Q2. Differentiate between a class and an object.

ClassObject
It is a blueprint or template.It is an instance of a class.
It defines the structure and behaviour.It has actual values for the attributes.
It does not occupy memory for data.It occupies memory in the computer.
Example: class Student:Example: s1 = Student("Arun", 101)
A class is created only once.Many objects can be created from one class.

Q3. What is encapsulation? Why is it important?

Encapsulation is the technique of bundling data (attributes) and the methods that operate on that data within a single unit (class), while restricting direct access to some of the object's components. This is typically achieved using access specifiers (public, protected, private).

Importance:

  • It prevents accidental modification of data by external code.
  • It provides controlled access through getter and setter methods.
  • It improves code maintainability and security.

Example: A BankAccount class keeps the balance as a private attribute and allows access only through deposit() and withdraw() methods.


Q4. What is the role of the self parameter in Python classes?

The self parameter is a reference to the current object calling the method. It must be the first parameter of every instance method in a Python class. When you call obj.method(arg), Python automatically converts it to Class.method(obj, arg), passing the object as self.

  • self distinguishes between instance variables (self.var) and local variables (var).
  • Without self, Python would not know which object's data to operate on.
  • It allows each object to maintain its own separate state.

Q5. Differentiate between single inheritance and multiple inheritance.

Single InheritanceMultiple Inheritance
One child class inherits from one parent class.One child class inherits from two or more parent classes.
Simpler and easier to understand.Can lead to ambiguity (diamond problem).
class Child(Parent):class Child(Parent1, Parent2):
Example: class Dog(Animal):Example: class FlyingCar(Vehicle, Aircraft):

8. VI. Answer in Detail (5-Mark Questions)

Q1. Explain the four pillars of Object-Oriented Programming with suitable Python examples.

1. Encapsulation:
Answer

Encapsulation is the bundling of data and methods within a single unit (class) and restricting direct access to some components. In Python, this is achieved using private attributes (double underscore prefix) and providing public methods for controlled access.

class Employee:
    def __init__(self, name, salary):
        self.name = name
        self.__salary = salary        # private attribute

    def get_salary(self):             # getter method
        return self.__salary

    def set_salary(self, amount):     # setter method
        if amount > 0:
            self.__salary = amount

e = Employee("Ravi", 30000)
print(e.get_salary())    # 30000
e.set_salary(35000)
print(e.get_salary())    # 35000
# e.__salary              # AttributeError
2. Abstraction:
Answer

Abstraction is the concept of hiding complex implementation details and showing only the essential features. The user interacts with a simple interface without knowing the internal workings.

class EmailService:
    def __init__(self, smtp_server):
        self.__smtp_server = smtp_server
        self.__port = 587

    def send_email(self, to, subject, body):
        # Complex internal logic hidden from user
        self.__connect()
        self.__authenticate()
        self.__transmit(to, subject, body)
        self.__disconnect()
        print(f"Email sent to {to}")

    def __connect(self):
        pass   # hidden implementation

    def __authenticate(self):
        pass   # hidden implementation

    def __transmit(self, to, subject, body):
        pass   # hidden implementation

    def __disconnect(self):
        pass   # hidden implementation

email = EmailService("smtp.example.com")
email.send_email("[email protected]", "Hello", "Hi there")
# User just calls send_email; internal steps are abstracted
3. Inheritance:
Answer

Inheritance allows a child class to acquire the properties and methods of a parent class. It promotes code reusability and establishes an "is-a" relationship.

class Vehicle:
    def __init__(self, brand, speed):
        self.brand = brand
        self.speed = speed

    def display(self):
        print(f"Brand: {self.brand}, Top Speed: {self.speed} km/h")

class Car(Vehicle):
    def __init__(self, brand, speed, seats):
        super().__init__(brand, speed)
        self.seats = seats

    def display(self):
        super().display()
        print(f"Seats: {self.seats}")

c = Car("Honda", 180, 5)
c.display()
# Brand: Honda, Top Speed: 180 km/h
# Seats: 5
4. Polymorphism:
Answer

Polymorphism means "many forms." It allows objects of different classes to be treated through a common interface. The same method name behaves differently based on the object calling it.

class Bird:
    def fly(self):
        print("Bird can fly")

class Penguin(Bird):
    def fly(self):
        print("Penguin cannot fly, it swims")

class Eagle(Bird):
    def fly(self):
        print("Eagle soars high")

birds = [Bird(), Penguin(), Eagle()]
for b in birds:
    b.fly()
# Output:
# Bird can fly
# Penguin cannot fly, it swims
# Eagle soars high

Q2. Explain the different types of inheritance in Python with examples.

1. Single Inheritance:
Answer

A child class inherits from a single parent class. This is the simplest form of inheritance.

class Animal:
    def breathe(self):
        print("Breathing...")

class Dog(Animal):
    def bark(self):
        print("Woof! Woof!")

d = Dog()
d.breathe()   # Inherited from Animal
d.bark()      # Own method
2. Multilevel Inheritance:
Answer

A class inherits from a derived class, forming a chain: Grandparent to Parent to Child.

class Vehicle:
    def move(self):
        print("Vehicle is moving")

class Car(Vehicle):
    def drive(self):
        print("Car is being driven")

class ElectricCar(Car):
    def charge(self):
        print("Electric car is charging")

ec = ElectricCar()
ec.move()     # From Vehicle
ec.drive()    # From Car
ec.charge()   # Own method
3. Multiple Inheritance:
Answer

A child class inherits from two or more parent classes simultaneously.

class Father:
    def gardening(self):
        print("Father enjoys gardening")

class Mother:
    def cooking(self):
        print("Mother enjoys cooking")

class Child(Father, Mother):
    def playing(self):
        print("Child loves playing")

c = Child()
c.gardening()   # From Father
c.cooking()      # From Mother
c.playing()      # Own method
4. Hierarchical Inheritance:
Answer

Multiple child classes inherit from a single parent class.

class Shape:
    def description(self):
        print("This is a shape")

class Circle(Shape):
    def area(self, r):
        return 3.14 * r * r

class Square(Shape):
    def area(self, side):
        return side * side

c = Circle()
s = Square()
c.description()   # Inherited from Shape
s.description()   # Inherited from Shape
print(c.area(5))  # 78.5
print(s.area(4))  # 16
5. Hybrid Inheritance:
Answer

A combination of two or more types of inheritance. This can lead to the diamond problem, which Python resolves using the Method Resolution Order (MRO).

class A:
    def show(self):
        print("A")

class B(A):
    def show(self):
        print("B")

class C(A):
    def show(self):
        print("C")

class D(B, C):
    pass

d = D()
d.show()              # B (MRO: D -> B -> C -> A)
print(D.__mro__)      # Shows the full resolution order

Q3. Explain constructors in Python with types and examples. How are they different from regular methods?

A constructor is a special method that is automatically called when an object of a class is created. In Python, the constructor method is __init__().

Types of Constructors:

TypeDescriptionExample
Default ConstructorTakes no parameters besides self.def __init__(self):
Parameterised ConstructorTakes parameters besides self to initialise attributes.def __init__(self, name, age):

Default Constructor:

class Student:
    def __init__(self):
        self.name = "Unknown"
        self.roll_no = 0

    def display(self):
        print(f"Name: {self.name}, Roll No: {self.roll_no}")

s = Student()          # Default constructor called
s.display()            # Name: Unknown, Roll No: 0

Parameterised Constructor:

class Student:
    def __init__(self, name, roll_no):
        self.name = name
        self.roll_no = roll_no

    def display(self):
        print(f"Name: {self.name}, Roll No: {self.roll_no}")

s = Student("Priya", 105)    # Parameterised constructor called
s.display()                   # Name: Priya, Roll No: 105

Constructor with Default Arguments (simulating overloading):

class Student:
    def __init__(self, name="Unknown", roll_no=0):
        self.name = name
        self.roll_no = roll_no

    def display(self):
        print(f"Name: {self.name}, Roll No: {self.roll_no}")

s1 = Student()                # Uses both defaults
s2 = Student("Karthik")       # Overrides name, uses default roll_no
s3 = Student("Karthik", 202)  # Overrides both
s1.display()   # Name: Unknown, Roll No: 0
s2.display()   # Name: Karthik, Roll No: 0
s3.display()   # Name: Karthik, Roll No: 202

Difference Between Constructors and Regular Methods:

FeatureConstructor (__init__)Regular Method
Called automaticallyYes, when object is createdNo, called explicitly
PurposeTo initialise object attributesTo perform operations on the object
Return valueShould not return anythingCan return values
NameMust be __init__Can be any valid identifier
Number of calls per objectCalled exactly once at creationCan be called any number of times

9. Common Mistakes to Avoid

1. Forgetting self in method definitions: Every instance method in a Python class must have self as the first parameter. Omitting it causes a TypeError.

   # WRONG
   def display():
       print(self.name)    # NameError: self not defined

   # CORRECT
   def display(self):
       print(self.name)

2. Confusing class and object: A class is the blueprint; an object is the instance. Writing Student.display() without creating an object first is wrong. You must first create s = Student() and then call s.display().

3. Trying to access private attributes directly: Private attributes (with __ prefix) cannot be accessed directly as obj.__attr. Use the mangled name obj._ClassName__attr or, preferably, a getter method. Do not rely on direct access.

4. Confusing method overriding with method overloading: Method overriding is when a child class redefines a parent method (same name, same parameters). Method overloading is having multiple methods with the same name but different parameters — Python does not support this. The last method definition wins.

5. Misunderstanding the constructor return value: The __init__ method should never have a return statement with a value. It implicitly returns None. Adding return value inside __init__ causes a TypeError.

6. Using class name instead of self for instance variables: Writing Class.var = value modifies the class variable (shared by all objects), not the instance variable. Use self.var = value to set an instance variable.

   class Counter:
       count = 0                # class variable
       def __init__(self):
           self.count = 0       # instance variable (shadows class var)
           Counter.count += 1   # modifies class variable

7. Calling the parent constructor incorrectly in inheritance: When a child class has its own __init__, the parent's __init__ is not automatically called. You must explicitly call it using super().__init__() or Parent.__init__(self, ...).

   # WRONG — parent attributes not initialised
   class Child(Parent):
       def __init__(self, child_attr):
           self.child_attr = child_attr

   # CORRECT
   class Child(Parent):
       def __init__(self, parent_attr, child_attr):
           super().__init__(parent_attr)
           self.child_attr = child_attr

10. Exam Checklist

Before your exam, make sure you can confidently answer the following:

  • [ ] Define class and object, and explain the difference between them.
  • [ ] Name and explain the four pillars of OOP: Encapsulation, Abstraction, Inheritance, Polymorphism.
  • [ ] Write a simple Python class with __init__, instance variables, and at least one method.
  • [ ] Explain the role of the self parameter and what happens if you omit it.
  • [ ] Differentiate between public, protected, and private access specifiers in Python (var, _var, __var).
  • [ ] List and explain the five types of inheritance: single, multilevel, multiple, hierarchical, hybrid.
  • [ ] Explain method overriding with a Python example.
  • [ ] Explain why Python does not support true method overloading.
  • [ ] Write the syntax for calling a parent class constructor from a child class using super().
  • [ ] Define polymorphism and give one example each of compile-time and run-time polymorphism.
  • [ ] Explain name mangling in Python and how __var becomes _ClassName__var.
  • [ ] Differentiate between default and parameterised constructors.
  • [ ] Explain the Method Resolution Order (MRO) and its relevance in hybrid/multiple inheritance.
  • [ ] Draw a simple inheritance diagram for multilevel and hierarchical inheritance.
  • [ ] Write a complete Python program that demonstrates encapsulation using getter and setter methods.

All the best for your exam! Remember: understanding concepts deeply matters far more than memorising answers. Practise writing Python code in IDLE for every concept you learn.

Frequently Asked Questions

Encapsulation, Abstraction, Inheritance, and Polymorphism are the four pillars of Object-Oriented Programming.