Sikshya Plus Get appGet the app free
Class 12 · Computer Science

Object-oriented programming (OOP) – Class 12 Computer Science Notes and Solutions

Complete solutions and answers for “Object-oriented programming (OOP)”, a chapter in Class 12 Computer Science (NEB exam preparation). This page covers Multiple Choice Questions and Short Answer Questions.

  • Free, no login needed
  • 10 min read
  • Updated 1 July 2026

Chapter at a glance

This chapter introduces Object-Oriented Programming (OOP) as a programming paradigm that structures code around objects. It covers the fundamental concepts of OOP, including classes, objects, inheritance, polymorphism, encapsulation, and abstraction, and contrasts OOP with procedural programming.

  • Object-Oriented Programming (OOP)
  • Procedural Programming
  • Class
  • Object
  • Inheritance
  • Polymorphism
  • Encapsulation
  • Abstraction

Exam focus: Students should focus on understanding the four main pillars of OOP (Inheritance, Polymorphism, Encapsulation, Abstraction) and their practical implications, as well as the differences between OOP and procedural programming.

Key formulas and definitions

  • Class: A blueprint or template for creating objects, defining attributes and methods.
  • Object: An instance of a class, possessing state (data) and behavior (methods).
  • Inheritance: A mechanism where a new class derives properties from an existing class.
  • Polymorphism: The ability of a method or object to take on many forms (e.g., method overriding).
  • Encapsulation: Bundling data and methods within a class and restricting direct access to data.

Solutions and answers

📝

Multiple Choice Questions

Q1
Which of the following is not an Object-Oriented Programming language?
  • a C
  • b C++
  • c PHP
  • d Perl
✅ Correct Answer
a. C
💡 Explanation
C is a procedural programming language developed by Dennis Ritchie in 1972. It follows the top-down approach where programs are structured as a sequence of procedures (functions). C does not support the core OOP pillars — there are no classes, objects, inheritance, polymorphism, encapsulation, or abstraction in C.

In contrast, C++ (developed by Bjarne Stroustrup) is a superset of C that added full OOP support. PHP (from version 5+) supports classes and OOP features. Perl also supports OOP through packages and bless references.
Q2
Which is not a procedural programming language?
  • a Ruby
  • b Python
  • c C++
  • d All of the above
✅ Correct Answer
d. All of the above
💡 Explanation
Ruby, Python, and C++ are all Object-Oriented Programming languages (though they may also support procedural styles):

• Ruby — A purely object-oriented language; everything in Ruby is an object, including numbers and strings.
• Python — A multi-paradigm language with strong OOP support; everything in Python is an object.
• C++ — Originally "C with Classes," it is a multi-paradigm language designed specifically to add OOP to C.

Since all three support OOP, the correct answer is "All of the above." True procedural languages include C, Pascal, FORTRAN, and BASIC.
Q3
Which feature of OOP derives a class from another class?
  • a Inheritance
  • b Encapsulation
  • c Polymorphism
  • d None of the above
✅ Correct Answer
a. Inheritance
💡 Explanation
Inheritance is the OOP mechanism by which a new class (derived/child class) is created from an existing class (base/parent class). The derived class automatically acquires all the non-private properties and methods of the parent class, and can also add its own new features or override inherited ones.

For example, if Vehicle is a base class, then Car and Bike can be derived classes that inherit properties like speed and color from Vehicle.
Q4
Which feature of OOP refers to code reusability?
  • a Abstraction
  • b Inheritance
  • c Polymorphism
  • d Encapsulation
✅ Correct Answer
b. Inheritance
💡 Explanation
Inheritance is the primary mechanism for code reusability in OOP. When a child class inherits from a parent class, it automatically gains access to all the attributes and methods defined in the parent class — without rewriting that code.

This means you write common functionality once in the base class and reuse it across multiple derived classes. This reduces code duplication, minimises bugs, and makes maintenance significantly easier. For instance, a Shape class might define area() and perimeter(), which Circle, Rectangle, and Triangle all inherit and reuse.
Q5
Class is a/an ________.
  • a Object Abstraction
  • b Real
  • c Object
  • d Hypothetical
✅ Correct Answer
a. Object Abstraction
💡 Explanation
A class is an object abstraction — it is a blueprint or template that defines the common properties (attributes) and behaviors (methods) that its objects will have. A class itself is not a real-world entity; it is an abstract definition.

For example, the class Student might define attributes like name, roll_no, and grade. The class itself is abstract — it doesn't represent a specific student. When you create an object (instance) from the class, like student1 = Student("Ram", 101, "A"), that object represents a real, specific student.
Q6
________ is the ability to redefine methods for a derived class.
  • a Abstraction
  • b Inheritance
  • c Polymorphism
  • d Encapsulation
✅ Correct Answer
c. Polymorphism
💡 Explanation
Polymorphism (from Greek: poly = many, morph = forms) is the ability of a method to behave differently based on the context. One of its key forms is method overriding, where a derived class provides its own specific implementation of a method that is already defined in the base class.

For example, a base class Shape may define a method area(). The derived classes Circle, Rectangle, and Triangle each override this method with their own formula — yet all are called using the same method name area(). This is polymorphism in action: "one name, many forms."
✏️

Short Answer Questions

Q1
What is Programming Paradigm? List any two differences between procedural and OOP paradigms.
📖 Definition
A Programming Paradigm is a fundamental style, approach, or methodology used to write computer programs. It provides a structured way of thinking about and organising code. A programming paradigm defines how a programmer conceptualises the problem and structures the solution — it influences the way programs are designed, written, and executed.

Different paradigms offer different philosophies for structuring code. Some programs are best written as a sequence of step-by-step instructions (procedural), while others benefit from modelling real-world entities as objects (OOP).

⚡ Key Differences: Procedural vs OOP
Procedural Paradigm
  • Follows a top-down approach — program is divided into procedures/functions
  • Focuses on functions and procedures that operate on data
  • Data and functions are separate entities
  • Less secure — no access control mechanism
  • Difficult to manage for large, complex projects
  • Examples: C, Pascal, FORTRAN
OOP Paradigm
  • Follows a bottom-up approach — program is built around objects
  • Focuses on objects that combine data and behaviour
  • Data and functions are bundled together in objects
  • More secure — supports encapsulation and access modifiers
  • Easier to manage and scale for complex projects
  • Examples: C++, Java, Python
Q2
What is OOP? List the advantages of OOP.
📖 Definition
Object-Oriented Programming (OOP) is a programming paradigm that organises software design around objects rather than functions and logic. An object is a data structure that contains both data (attributes/properties) and code (methods/behaviours). OOP models real-world entities as objects that interact with each other to build complex software systems.

In OOP, a program is viewed as a collection of objects that communicate with one another. Each object is an instance of a class, which serves as a blueprint defining the structure and behaviour of its objects.

🌟 Advantages of OOP
  1. Code Reusability — Through inheritance, existing code can be reused in new classes without rewriting, saving development time and effort.
  2. Data Security (Encapsulation) — Data hiding is achieved through encapsulation, where internal object details are protected from outside interference using access modifiers.
  3. Modularity — The source code for an object can be written and maintained independently of other objects, making debugging and collaborative development easier.
  4. Easier Maintenance and Upgradation — OOP systems are easier to maintain, modify, and extend because changes in one part of the system have minimal impact on other parts.
  5. Polymorphism and Flexibility — The same interface can be used for different data types and behaviours, making the code more flexible and adaptable.
  6. Better Problem Modelling — OOP mirrors real-world entities and their interactions, making it intuitive to design and understand complex systems.
  7. Improved Productivity — Reusability, modularity, and cleaner design lead to faster development and higher-quality software.
Q3
Write the features of OOP.

Object-Oriented Programming has four fundamental features (also called the four pillars of OOP) along with several other important concepts:

🧬
Inheritance
A derived class acquires the properties and methods of a base class, promoting code reusability.
🔄
Polymorphism
The ability of a method or object to take many forms — same name, different behaviours.
📦
Encapsulation
Bundling data and methods into a single unit (class) and restricting direct access to data.
🎭
Abstraction
Hiding complex implementation details and showing only the essential features to the user.
  1. Class — A class is a user-defined blueprint or prototype from which objects are created. It defines a set of attributes and methods that characterize any object of the class. For example, Student is a class, and individual students are objects.
  2. Object — An object is an instance of a class. It is a real-world entity that has state (data/attributes) and behaviour (methods/functions). For example, a specific student named "Ram" with roll number 101 is an object of the Student class.
  3. Inheritance — Inheritance is the mechanism by which one class (child/derived) acquires the properties and behaviours of another class (parent/base). It promotes code reusability and establishes an "is-a" relationship. For example, Car is a Vehicle.
  4. Polymorphism — Polymorphism means "many forms." It allows the same method name to perform different tasks depending on the object that calls it. This is achieved through method overloading (compile-time) and method overriding (runtime).
  5. Encapsulation — Encapsulation is the wrapping of data (variables) and code (methods) together into a single unit (class). It also provides data hiding by restricting direct access to some components using access modifiers (private, protected, public).
  6. Abstraction — Abstraction means hiding the internal implementation details and showing only the essential features. It is achieved through abstract classes and interfaces. For example, when you drive a car, you only use the steering wheel and pedals — you don't need to know how the engine works internally.
  7. Message Passing — In OOP, objects communicate with each other by sending and receiving messages (i.e., calling methods on objects). This mechanism of interaction between objects is called message passing.
Q4
Define Polymorphism and Inheritance features of OOP.
📖 Polymorphism
Polymorphism is derived from two Greek words: "poly" meaning many and "morph" meaning forms. It is the ability of a single method, function, or operator to behave in different ways depending on the context — such as the type of object calling it or the parameters passed.

Polymorphism is broadly classified into two types:

  • Compile-time Polymorphism (Static Binding) — Achieved through method overloading (multiple methods with the same name but different parameters in the same class) and operator overloading. The compiler determines which method to call at compile time.
  • Run-time Polymorphism (Dynamic Binding) — Achieved through method overriding (a derived class provides its own implementation of a method defined in the base class). The correct method is determined at runtime based on the object type.
📖 Inheritance
Inheritance is the OOP mechanism by which a new class (called the derived class, child class, or subclass) is created from an existing class (called the base class, parent class, or superclass). The derived class automatically acquires all the non-private attributes and methods of the base class and can also add new features or override inherited ones.

Key aspects of inheritance:

  • Promotes Code Reusability — Common code is written once in the base class and inherited by all derived classes, eliminating redundancy.
  • Establishes "Is-A" Relationship — For example, Dog is a Animal, Car is a Vehicle.
  • Types of Inheritance — Single (one parent, one child), Multiple (multiple parents, one child), Multilevel (grandparent → parent → child), Hierarchical (one parent, multiple children), and Hybrid (combination of types).
  • The super() keyword is used to call the parent class constructor or methods from the derived class.
Q5
Write the applications of OOP.

Object-Oriented Programming is widely used across many domains of software development due to its modularity, reusability, and scalability. The major applications of OOP are:

🖼️
GUI-Based Applications (Desktop & Mobile)
🌐
Web Application Development
🎮
Game Development & Simulation
🤖
Artificial Intelligence & Machine Learning
🗄️
Database Management Systems
📊
Data Analytics & Visualization
🔧
CAD/CAM & Engineering Software
📱
Mobile App Development (Android/iOS)
🏢
Enterprise Software (ERP, CRM)
🔒
Network Security & Cryptography Tools
☁️
Cloud Computing & Distributed Systems
💻
Operating Systems Development

OOP languages like Java, C++, Python, C#, and Swift are the backbone of most modern software systems. The ability to model real-world entities, reuse code through inheritance, and secure data through encapsulation makes OOP the preferred paradigm for complex, large-scale softwareThe request was rejected because it was considered high risk

Frequently asked questions

What is Object-oriented programming (OOP) about?

This chapter introduces Object-Oriented Programming (OOP) as a programming paradigm that structures code around objects. It covers the fundamental concepts of OOP, including classes, objects, inheritance, polymorphism, encapsulation, and abstraction, and contrasts OOP with procedural programming.

Which topics are covered in Object-oriented programming (OOP)?

Class 12 Computer Science “Object-oriented programming (OOP)” covers: Object-Oriented Programming (OOP); Procedural Programming; Class; Object; Inheritance; Polymorphism; Encapsulation; Abstraction.

What should I focus on in Object-oriented programming (OOP) for the exam?

Students should focus on understanding the four main pillars of OOP (Inheritance, Polymorphism, Encapsulation, Abstraction) and their practical implications, as well as the differences between OOP and procedural programming.

What are the key formulas or definitions in Object-oriented programming (OOP)?

Class: A blueprint or template for creating objects, defining attributes and methods.; Object: An instance of a class, possessing state (data) and behavior (methods).; Inheritance: A mechanism where a new class derives properties from an existing class.; Polymorphism: The ability of a method or object to take on many forms (e.g., method overriding).; Encapsulation: Bundling data and methods within a class and restricting direct access to data..

Where can I read the Class 12 Computer Science “Object-oriented programming (OOP)” solutions?

Right on this page. They are free and you do not need to sign up. For chapter quizzes and the AI tutor, install the Sikshya Plus app.

Study tips

Free for Class 9 to 12

Do not just read it. Practice it.

You have read the solutions for Object-oriented programming (OOP). Now test yourself, ask the AI tutor and keep your streak going.

Sikshya Plus chapter quiz screen with class, subject and difficulty options
Sikshya AI personal tutor chat inside the app
Sikshya Plus AI tools screen: question assistant, summarizer, translator, grammar checker
Chapter list with Past Q, materials, posts and books tabs
  • AI quizzes for this chapterTest yourself with instant feedback and explanations after every answer.
  • AI tutor, free, 24/7Stuck on a question? Ask in your own words and get a step-by-step explanation.
  • 14 AI tools in one appSummarizer, grammar checker, flashcards, essay help, math solver and more.
  • Past questions and notesPast papers and your own notes organized chapter by chapter.
Download free on Google Play Scan with your phone to install