Counted from the questions in the past papers listed on this site. Repeated = how many times the topic came in those papers.
Object Oriented Programming and Methodology important questions with answers
Each answer starts with the short answer. Then come the points to write, a diagram and an exam tip. The questions under each topic are copied from the RGPV papers.
Q1. Abstract class and interface
Asked 21 times in 2020, 2022, 2023, 2024, 2025 · Unit 3
From the papers
“Compare interfaces and abstract classes.” (2022, 2024, 2025)
“Association and aggregation; what is an abstract class and why is it used.” (2020, 2022, 2023)
“What is meant by an abstract class?” (2023, 2024)
The short answer
An abstract class has at least one pure virtual function, such as virtual void draw() = 0, so no object of it can be created. An interface is a class with only pure virtual functions and no data, which derived classes must fully implement.
Write these points
Why use it: it forces every derived class to give its own version of a function. It also gives one common type for run time polymorphism through base pointers.
An abstract class may have data members, normal functions and constructors. It can have pointers and references, but no objects.
A derived class that does not override every pure virtual function stays abstract.
In Java write an abstract class with abstract methods. An interface is declared with the keyword interface and a class uses implements. A class can extend one class but implement many interfaces.
In C++ there is no interface keyword. A class made only of pure virtual functions plays that role.
Basis
Abstract class
Interface
Functions
Normal and pure virtual
Only declarations (pure virtual)
Data members
Allowed
Not in the usual design
Inheritance
Single or multiple in C++
A class can use many
Purpose
Common base with shared code
A contract of what a class can do
Example.
class Shape { public: virtual float area() = 0; };
class Circle : public Shape { float r; public:
Circle(float x) { r = x; } float area() { return 3.14159 * r * r; } };
Real-life example
A driving school tells you 'every vehicle must start and stop' without saying how. That is an abstract class or interface. A car and a bike each give their own way to start.
Abstract class Shape and its derived classes
Same or opposite: abstract class and interface
Point
Abstract class
Interface
Same or opposite
Can hold normal methods
Yes
No (only pure virtual)
Opposite
Data members
Allowed
Not usual
Opposite
Objects can be created
No
No
Same
A class can implement many
Through multiple inheritance
Yes
Opposite
Exam tip. The words pure virtual and = 0 must appear in the answer. You cannot write Shape s;. You can write Shape *p = new Circle(2);.
Asked 18 times in 2020, 2022, 2023, 2024, 2025 · Unit 4
From the papers
“Compare run time and compile time polymorphism.” (2022, 2023, 2024)
“Compile-time and run-time polymorphism with examples.” (2024, 2025)
“Polymorphism in detail; ways to implement it in C++; function overloading versus overriding with syntax.” (2020, 2023)
The short answer
Polymorphism means one name with many forms. The same function name or operator behaves differently for different types or objects.
Write these points
Compile time (static) polymorphism is decided by the compiler. It comes from function overloading and operator overloading. It is also called early binding.
Run time (dynamic) polymorphism is decided while the program runs. It comes from virtual functions and overriding, called through a base class pointer or reference. It is also called late binding.
Compile time calls are faster because no lookup is needed. Run time calls are more flexible because the real object decides which function runs.
Conditions for run time polymorphism: the base function is virtual, the derived class overrides it with the same signature. The call must go through a base pointer or reference.
Basis
Compile time
Run time
Binding
Early, by the compiler
Late, while running
Achieved by
Function and operator overloading
Virtual functions and overriding
Speed
Faster
Slightly slower (vtable lookup)
Example
area(int), area(int, int)
Animal *p = new Dog(); p->sound();
Both kinds of polymorphism in one program.
Compile time: int add(int a, int b) and double add(double a, double b).
add(2, 3) gives 5 and add(2.5, 1.5) gives 4.0. The compiler picks the version from the argument types.
Run time: Shape *s = new Circle(2); s->area(); calls Circle::area and gives 12.57.
Then s = new Square(3); s->area(); gives 9. The same call ran different code, chosen while the program runs.
Real-life example
The word 'play' means one thing for cricket and another for a guitar. In C++, one function name draw() works for a circle and a square in different ways. The object decides which version runs.
Two kinds of polymorphism
Same or opposite: compile-time and run-time polymorphism
Point
Compile time
Run time
Same or opposite
Decided
When compiling
While running
Opposite
Achieved by
Overloading
Virtual functions
Opposite
Speed
Faster
Slightly slower
Opposite
One name, many forms
Yes
Yes
Same
Exam tip. Write both types and give one example of each. Without the keyword virtual the base class function is called, even when the pointer holds a derived object.
Asked 17 times in 2020, 2022, 2023, 2024, 2025 · Unit 5
From the papers
“Exception handling and multithreading.” (2022, 2025)
“Array index out of bounds exception and null pointer exception.” (2023, 2024)
“What is meant by exceptions? How is an exception handled?” (2020, 2023)
The short answer
An exception is an error that happens while the program runs, such as division by zero. Exception handling lets the program catch the error and deal with it instead of crashing.
Write these points
try holds the code that may fail. throw signals the error. catch receives it and handles it.
When throw runs, control leaves the try block at once and jumps to the first matching catch. The rest of the try block is skipped.
A try block can have several catch blocks. Put specific types first. catch(...) catches every type.
Local objects are destroyed while control leaves the try block (stack unwinding), so destructors still run.
Java has one more block, finally, that always runs. Common run time exceptions there are ArrayIndexOutOfBoundsException, NullPointerException and ArithmeticException.
Synchronous exceptions come from the program itself (division by zero, array range). Asynchronous exceptions come from outside events such as a keyboard interrupt. C++ handles only synchronous ones.
Steps
Read x, y and z.
try { if (x == y) throw 0; float r = z / (x-y); cout << r; }
catch (int e) { cout << "Division by zero"; }
The program continues after the catch block.
Division with and without an error.
try { if (b == 0) throw "Divide by zero"; cout << a / b; }
catch (const char *m) { cout << m; }
Input a = 10, b = 2: the try block prints 5 and the catch block is skipped.
Input a = 10, b = 0: throw jumps to catch, which prints Divide by zero. The program goes on instead of crashing.
Real-life example
When an ATM finds too little money in your account it does not crash. It shows a message and returns your card. A program does the same with try, throw and catch.
Flow of try, throw and catch
Same or opposite: error and exception
Point
Compile-time error
Exception
Same or opposite
Found
When compiling
While running
Opposite
Example
Missing semicolon
Divide by zero
Opposite
Handled by try-catch
No
Yes
Opposite
Must be fixed or handled
Yes
Yes
Same
Exam tip. Always write the three keywords try, catch and throw with one short program. For the program, check the condition (x equals y) before the division.
Asked 16 times in 2020, 2022, 2023, 2024, 2025 · Unit 1
From the papers
“Main features of the object oriented paradigm; advantages and disadvantages.” (2023, 2024, 2025)
“Features, merits and demerits of the object oriented paradigm.” (2023, 2024, 2025)
“Merits and demerits of object oriented methodology; where OOP suits and where not.” (2020, 2024)
The short answer
Object oriented programming builds a program from objects. Each object holds data together with the functions that work on that data.
Write these points
Main features: object, class, encapsulation, data abstraction, inheritance, polymorphism, message passing and dynamic binding.
Merit: code reuse. Inheritance lets one class use the code of another, so less code is written and tested.
Merit: security. Data hiding stops outside code from changing the data by mistake.
Merit: easy maintenance and extension. A change stays inside one class. New objects can be added without touching old code.
Merit: it models the real world, so a large problem splits into small objects that are easy to understand.
Demerit: more design effort at the start. Beginners also need more time to learn it.
Demerit: for a small problem the program can be larger and slower than a simple procedural one.
A bank account before and after OOP.
Procedural: a global variable balance that any function can change. A bug calls balance = balance − 500 twice and nothing stops it.
OOP: class Account keeps balance private. deposit(double a) accepts only a > 0, so deposit(−500) is refused.
Reuse: class SavingsAccount : public Account adds addInterest() at 4%.
On a balance of ₹10,000, addInterest() gives ₹10,400 without rewriting any Account code.
Real-life example
Building a school ERP, one team writes the Student class and another writes Fees. Each works on its own object without breaking the other. That is why large software uses OOP.
Main concepts of object oriented programming
Same or opposite: encapsulation and inheritance
Point
Encapsulation
Inheritance
Same or opposite
Purpose
Hide and protect data
Reuse code
Opposite
Keyword
private, public
: public Base
Opposite
OOP feature
Yes
Yes
Same
Example
Bank balance kept private
Savings account from Account
Opposite
Exam tip. Write at least four features and three merits. Add two demerits to get full marks. Give a real life example for each feature, such as a car for abstraction.
Asked 15 times in 2020, 2022, 2023, 2024, 2025 · Unit 3
From the papers
“Fundamental concept of inheritance; multiple, multilevel and hybrid inheritance with diagram and syntax.” (2020, 2023)
“The is-a relationship in inheritance.” (2025)
“Inheritance and its types.” (2025)
The short answer
Inheritance lets a new class (the derived class) take the data and functions of an existing class (the base class). It gives code reuse and an is-a relationship, for example a Dog is an Animal.
Write these points
Syntax: class Dog : public Animal { };. The derived class gets the public and protected members of the base class.
Single: one base and one derived class. Multilevel: A to B to C. Multiple: one derived class with two or more bases, as in class C : public A, public B.
Hierarchical: one base class with many derived classes. Hybrid: a mix of the types above, for example multiple and multilevel together.
Constructors run from base to derived. Destructors run in the opposite order.
Multiple inheritance can cause ambiguity. If B and C both derive from A and D derives from B and C, then D gets two copies of A. Declare class B : virtual public A to keep one copy. Calling a name that exists in two bases also needs the scope operator, as in obj.A::show().
Java does not allow multiple inheritance of classes. It uses interfaces for that need.
Example.
class Person { public: string name; };
class Student : public Person { public: int roll; };
A Student object holds name from Person and roll of its own.
Real-life example
A child inherits the family surname and house, then adds their own skills. In code, class Car inherits wheels and engine from class Vehicle and adds its own air conditioner. Nothing common is written twice.
Types of inheritance (arrow points from derived to base)
Same or opposite: multilevel and multiple inheritance
Point
Multilevel
Multiple
Same or opposite
Parents of one class
One, in a chain
Two or more
Opposite
Example
A → B → C
C from A and B
Opposite
Diamond problem
No
Yes, solved by virtual base class
Opposite
Reuses parent code
Yes
Yes
Same
Exam tip. Draw the small diagram for each type before you write its syntax. Private members of the base class are never directly open to the derived class. If the question mentions ambiguity, write the virtual base class solution.
Asked 15 times in 2020, 2022, 2023, 2024, 2025 · Unit 2
From the papers
“Objects: state, behaviour and identity.” (2024, 2025)
“Member functions with example.” (2023, 2024)
“Class and object, relation and difference, syntax of a class; state, behavior and identity of an object.” (2020, 2022)
The short answer
A class is a user defined type that groups data members with member functions. An object is a real instance of that class, which takes memory.
Write these points
A class is a blueprint. It takes no memory until an object is made from it.
An object has state (the values of its data members), behaviour (its member functions) and identity (its own name and address).
Many objects can come from one class. Each object has its own copy of the data members and all share the member functions.
Use the dot operator with an object (s1.show()) and the arrow operator with a pointer (p->show()).
Define a class with the keyword class, then a private part and a public part. Member functions can be defined inside the class or outside with the scope operator, as in void Student::show() { }.
Singleton class: a class that allows only one object. The constructor is private and a static function returns the single instance.
Class
Object
Blueprint or template
Real instance of the class
No memory at definition
Memory is allocated at creation
Defined once
Many can be created
Example: Student
Example: Student s1;
Example.
class Student { int roll; float marks; public:
void set(int r, float m) { roll = r; marks = m; }
void show() { cout << roll << " " << marks; } };
Then in main(): Student s1; s1.set(1, 80.5); s1.show(); prints 1 80.5.
Real-life example
A house map drawn by an architect is a class. The real houses built from it in a colony are objects. Every house has the same plan but its own colour and owner.
One class, two objects
Same or opposite: class and object
Point
Class
Object
Same or opposite
What it is
Blueprint
Real instance
Opposite
Memory
None for data until objects are made
Gets memory
Opposite
Number
Declared once
Many from one class
Opposite
Has data members and functions
Yes
Yes
Same
Exam tip. Write the syntax of a class and one object creation. Examiners check this first. State, behaviour and identity are the three words to write for an object.
Asked 13 times in 2020, 2022, 2023, 2024, 2025 · Unit 3
From the papers
“Association and aggregation; what is an abstract class and why is it used.” (2020, 2022, 2023)
“Differentiate between association and aggregation.” (2025)
“Differentiate association, aggregation and composition with real world examples.” (2024)
The short answer
These are three ways in which classes relate: association is a general uses link, while aggregation is a has-a link where the part can live without the whole. Composition is a stronger has-a link where the part dies with the whole.
Write these points
Association: two independent classes know each other. A Teacher teaches Students. It can be one to one, one to many or many to many.
Aggregation: a weak whole and part link. A Department has Teachers. If the department closes, the teachers still exist. UML shows it with a hollow diamond.
Composition: a strong whole and part link. A House has Rooms. If the house is destroyed, the rooms go too. UML shows it with a filled diamond.
In C++ aggregation keeps a pointer or reference to a part made elsewhere. Composition keeps the part as a member object, made and destroyed with the whole.
Inheritance is a different link. It is is-a. Aggregation and composition are has-a.
Relation
Meaning
Part without whole?
Example
Association
Uses or knows
Yes
Teacher and Student
Aggregation
Has-a, weak
Yes
Department and Teacher
Composition
Has-a, strong
No
House and Room
Three links in code.
Association: void Teacher::teach(Student &s) uses a Student only for the call. Neither owns the other.
Aggregation: class Library { vector<Book*> books; }. Deleting the Library leaves the Book objects alive.
Composition: class House { Room rooms[3]; }. Destroying the House destroys its 3 rooms too.
Test: delete the whole, then ask if the part still exists. Yes means aggregation, no means composition.
Real-life example
A teacher and a student are associated. A department has teachers, but teachers exist without it: aggregation. A house has rooms that vanish with the house: composition.
UML notation of the three relations
Same or opposite: aggregation and composition
Point
Aggregation
Composition
Same or opposite
Relationship
Has-a, weak
Has-a, strong
Opposite
Part lives after the whole is gone
Yes
No
Opposite
UML symbol
Hollow diamond
Filled diamond
Opposite
A kind of association
Yes
Yes
Same
Exam tip. Draw the three UML symbols. They are easy marks. The test for composition: does the part die when the whole dies?.
Asked 12 times in 2020, 2022, 2023, 2024, 2025 · Unit 2
From the papers
“Access modifiers in C++ and their role in data hiding.” (2020, 2022)
“Access modifiers, static members and object life cycle.” (2025)
“Role of access modifiers in class design; compare public, private and protected.” (2024)
The short answer
Access modifiers set which parts of a program can use a member of a class. C++ has three, public, private and protected, which are the tools for data hiding.
Write these points
private members can be used only by member functions and friends of the same class. This is the default in a class.
protected members can also be used by derived classes. Outside code cannot use them.
public members can be used from anywhere. They form the interface of the class.
Data hiding: keep data private and give public functions to read or change it. Then every change goes through your checks.
With public inheritance, public stays public and protected stays protected. With protected inheritance, both become protected. With private inheritance, both become private. Private members of the base class are never open to the derived class.
Java has a fourth level, default (package) access, when no word is written.
Modifier
Same class
Derived class
Outside
private
Yes
No
No
protected
Yes
Yes
No
public
Yes
Yes
Yes
What compiles and what does not.
class Base { private: int a; protected: int b; public: int c; };
class Derived : public Base { void f() { b = 2; c = 3; } }; This compiles.
Writing a = 1 inside f() gives a compile error, because a is private to Base.
In main(): Derived d; d.c = 5; works. d.b = 5; fails, because b is protected.
Real-life example
In a house, the drawing room is public, so any guest may sit there. The bedroom is private to its owner. The family room is protected: family members, like derived classes, may enter while guests may not.
Who can reach a member
Same or opposite: private and protected
Point
Private
Protected
Same or opposite
Access in the same class
Yes
Yes
Same
Access in a derived class
No
Yes
Opposite
Access from outside
No
No
Same
Default in a class
Yes
No
Opposite
Exam tip. Write the table. It earns the marks quickly. Name data hiding when the question says role in data hiding.
Asked 11 times in 2020, 2022, 2023, 2024, 2025 · Unit 2
From the papers
“What is a constructor? Is it mandatory to use a constructor in a class?” (2023, 2024)
“Construction and destruction of objects.” (2022, 2024)
“Constructor and destructor function with an example.” (2020, 2023)
The short answer
A constructor is a member function with the class name and no return type that runs by itself when an object is created. A destructor, written ~ClassName(), runs when the object is destroyed and frees what it used.
Write these points
Default constructor takes no arguments. Parameterized constructor takes values to set the data. Copy constructor builds an object from another object of the same class.
Copy constructor syntax: Point(const Point &p). It runs when an object is created from another one, passed by value or returned by value. The argument must be a reference.
Constructors can be overloaded. A destructor takes no argument and returns nothing. It cannot be overloaded. A class has only one.
Objects are destroyed in the reverse order of creation.
A constructor is not mandatory. If you write none, the compiler gives a default one.
Use the destructor to release memory taken with new and to close files.
Type
Syntax
Called when
Default
Point()
Point p;
Parameterized
Point(int a, int b)
Point p(2, 3);
Copy
Point(const Point &p)
Point q(p);
Destructor
~Point()
Object goes out of scope
Example.
class Point { int x, y; public:
Point() { x = 0; y = 0; }
Point(int a, int b) { x = a; y = b; }
Point(const Point &p) { x = p.x; y = p.y; }
~Point() { cout << "gone"; } };
Real-life example
When you open a new mobile number, the operator activates it with a default plan at once. That is a constructor. When you port out, it clears your records. That is a destructor.
Life of an object
Same or opposite: constructor and destructor
Point
Constructor
Destructor
Same or opposite
Name
Same as the class
~ and the class name
Opposite
Arguments
Can take them
None
Opposite
Overloading
Allowed
Not allowed
Opposite
Called automatically
Yes
Yes
Same
Exam tip. Name of the constructor equals the class name and it has no return type, not even void. In the copy constructor the parameter must be a reference. A value parameter would call the copy constructor again and again.
Asked 6 times in 2020, 2022, 2023, 2024, 2025 · Unit 4
From the papers
“Explain virtual function and write its purpose.” (2024)
“Virtual functions, friend functions and static functions.” (2024)
“Differentiate: virtual and pure virtual function.” (2023)
The short answer
A virtual function is a member function declared with the keyword virtual in the base class and redefined in the derived class. A call through a base class pointer or reference runs the version of the actual object.
Write these points
Without virtual, the compiler binds the call to the pointer type, so the base version runs. With virtual, the choice is made at run time.
How it works: each class with virtual functions has a table of function addresses (vtable). Each object holds a hidden pointer (vptr) to that table.
Rules: it must be a member function and it cannot be static. The derived version must have the same signature. The call must go through a pointer or reference.
A pure virtual function has no body in the base class and is written = 0. A class with one is abstract.
Make the base class destructor virtual when you delete a derived object through a base pointer. Otherwise only the base destructor runs.
class Dog : public Animal { public: void sound() { cout << "Bark"; } };
Animal *p = new Dog; p->sound(); prints Bark, because the call follows the real object.
Remove virtual and the same call prints ..., because it follows the pointer type Animal.
Each object of a class with virtual functions keeps a hidden pointer to the table of its class functions.
Real-life example
A TV remote has one 'power' button, but each brand's TV turns on in its own way. A virtual function is that button. The base pointer presses it and the real object's version runs.
Call through a base pointer with a virtual function
Same or opposite: virtual and normal member function
Point
Virtual function
Normal function
Same or opposite
Bound
At run time
At compile time
Opposite
Through a base pointer calls
Derived version
Base version
Opposite
Needs a vtable
Yes
No
Opposite
Declared in a class
Yes
Yes
Same
Exam tip. Purpose of a virtual function: run time polymorphism. Write the difference between a virtual and a pure virtual function if the question says so.
“Define encapsulation and data abstraction.” (2023, 2025)
“Encapsulation and data abstraction with a C++ program; scope and life of a variable.” (2020, 2023)
“Program for encapsulation: class Student with roll number, name and marks.” (2025)
The short answer
Encapsulation wraps data with the functions that use it into one unit, the class, which hides the data from outside. Data abstraction shows only the essential features and hides how they work inside.
Write these points
Encapsulation is done with a class: private data members and public member functions (getters and setters).
Abstraction is done by exposing a small public interface. A driver uses the steering wheel and pedals and does not need to know the engine. In the same way cout prints without showing how.
Difference: encapsulation is about packing data and code together and hiding the data. Abstraction is about showing only what the user needs.
Benefits: data security, easy change of the inside without changing the users, fewer bugs.
Scope and life of a variable: a local variable is visible only in its block and lives until the block ends. A global variable is visible in the whole file and lives for the whole run. A static local variable keeps its value between calls. A data member lives as long as its object.
Example.
class Account { double balance; public:
void deposit(double a) { if (a > 0) balance += a; }
double getBalance() { return balance; } };
Outside code cannot set balance to a wrong value directly.
Real-life example
A car driver uses the steering and pedals without seeing the engine. That is abstraction. The engine sealed under the bonnet so nobody touches it by mistake is encapsulation.
Class as a capsule
Same or opposite: encapsulation and abstraction
Point
Encapsulation
Abstraction
Same or opposite
Focus
Hiding data inside a class
Showing only what is needed
Opposite
Done with
Access specifiers
Abstract classes, interfaces
Opposite
Level
Implementation
Design
Opposite
Reduces complexity
Yes
Yes
Same
Exam tip. Write both ideas. Data and functions are bound together. The data is hidden. Give a program with private data and public functions. Then add scope and life if the question asks.
“Compare procedural programming with object oriented programming.” (2025)
“Compare OOP with procedural programming, at least three differences.” (2024)
“How OOP differs from procedural programming; key features of the object oriented paradigm.” (2024)
The short answer
Procedural programming builds a program from functions that work on shared data. Object oriented programming builds it from objects that keep their own data and the functions for it.
In procedural code the data is usually global and open to every function. In OOP the data sits inside objects and is protected by access control.
Procedural design is top down (main problem split into functions). OOP design is bottom up (objects first, then the program).
OOP gives inheritance and polymorphism, so code is reused. In procedural code a similar function is often copied.
OOP models real things, so large programs are easier to change. Procedural style is simple and quick for small programs.
Basis
Procedural
Object oriented
Focus
Functions
Objects
Data
Global, shared, open
Hidden inside objects
Approach
Top down
Bottom up
Security
Low
High (access control)
Reuse
Copy functions
Inheritance
Polymorphism
No
Yes
Average marks both ways.
Procedural: float avg(float m[], int n) is a separate function. Any code can change the marks array.
OOP: class Student { float m[5]; public: float average(); }. Only member functions touch the marks.
Marks 70, 80, 90, 60, 75 give average 75 in both versions.
Adding a Teacher type later: procedural code needs edits in shared functions, while OOP adds one new class.
Real-life example
A procedural recipe lists steps in order. An OOP kitchen has a chef, a waiter and a cashier, each with their own job and data. For a big restaurant, the OOP kitchen is easier to run and change.
Where the data lives
Same or opposite: OOP and procedural programming
Point
OOP
Procedural
Same or opposite
Built around
Objects
Functions
Opposite
Data security
Hidden in classes
Global data is open
Opposite
Approach
Bottom up
Top down
Opposite
Example language
C++, Java
C
Opposite
Solves problems with code
Yes
Yes
Same
Exam tip. Write at least five points in a table. Three is the minimum a question may ask for. Name an example language on each side.
“Polymorphism in detail; ways to implement it in C++; function overloading versus overriding with syntax.” (2020, 2023)
“Differentiate between overriding and overloading methods.” (2020, 2023)
“Polymorphism with method overloading and overriding.” (2025)
The short answer
Function overloading means several functions with the same name and different parameters in one scope. Function overriding means a derived class gives a new body to a base class function with the same name and signature.
Write these points
Overloading is decided at compile time by the number, types or order of arguments. The return type alone cannot tell two functions apart.
Overriding is decided at run time when the base function is virtual and the call is through a pointer or reference.
Overloading happens inside one class. Overriding needs two classes in an inheritance link.
The same names are used in Java as method overloading and method overriding.
Area program with overloading: float area(float r) for a circle, float area(float l, float b) for a rectangle and int area(int s) for a square. The compiler picks the function from the arguments. Two functions with one float parameter would clash, so give the square an int parameter or use another name.
Basis
Overloading
Overriding
Where
Same class
Base and derived class
Signature
Must differ
Must be the same
Binding
Compile time
Run time (with virtual)
Keyword
None
virtual in the base class
Overloading and overriding side by side.
Overloading in one class: int area(int s) and int area(int l, int b).
area(4) gives 16 and area(4, 6) gives 24. Different parameters pick the version.
Overriding across classes: Base::show() prints Base while Derived::show() prints Derived.
Derived d; d.show(); prints Derived. The child body replaces the parent body for the same signature.
Real-life example
A food app has one 'order' action that takes a dish, or a dish and quantity. That is overloading. A premium member's 'order' that adds free delivery replaces the normal one: overriding.
Overloading and overriding side by side
Same or opposite: overloading and overriding
Point
Overloading
Overriding
Same or opposite
Where
Same class
Base and derived class
Opposite
Signature
Must differ
Must be the same
Opposite
Polymorphism type
Compile time
Run time
Opposite
Same function name
Yes
Yes
Same
Exam tip. Always write the table with a short code example for each. Same name with the same parameters in the same class is an error, not overloading.
“Operator overloading; how to overload unary and binary operators.” (2024)
“Interactive program for a distance class: add and subtract distances.” (2024)
“Operator overloading; Distance class overloading + and -.” (2022)
The short answer
Operator overloading gives an existing operator a new meaning for a user defined type. The function is named operator followed by the symbol, for example operator+.
Write these points
It is compile time polymorphism. The operator keeps its usual meaning for built in types.
You cannot overload these operators: :: . .* ?: sizeof. You cannot change the precedence or the number of operands. You cannot create a new operator.
Member function: the left operand is the calling object. A unary operator takes no argument and a binary operator takes one.
Friend function: all operands come as arguments, so a unary operator takes one and a binary operator takes two. Use it when the left operand is not an object, as in cout << obj.
The assignment operator = must be a member function. It cannot be a friend.
Write the Distance class: operator+ adds the parts and carries cm into m. operator- subtracts in the same way.
Steps
class Distance { int m, cm; public: Distance(int a = 0, int b = 0) { m = a; cm = b; }
In main(): Distance a(2, 50), b(1, 70), c; c = a + b; gives 4 m 20 cm.
Adding two complex numbers with +.
class Complex { float re, im; public: Complex operator+(Complex c); };
operator+ returns Complex(re + c.re, im + c.im).
(2 + 3i) + (1 + 4i) gives 3 + 7i, written simply as c3 = c1 + c2;.
With the Distance class: 5 m 30 cm − 2 m 70 cm. x = 530, y = 270, so the result is 2 m 60 cm.
Real-life example
We write ₹200 + ₹300 and understand it. In code, a Money class can overload + so that m1 + m2 adds rupees and paise correctly, just as it reads on paper.
How a + b is read by the compiler
Same or opposite: member and friend operator function
Point
Member function
Friend function
Same or opposite
Left operand
Must be an object of the class
Can be any type
Opposite
Arguments for a binary operator
One
Two
Opposite
Keyword
operator
friend and operator
Opposite
Gives a new meaning to an operator
Yes
Yes
Same
Exam tip. Write the general syntax: return_type operator op (arguments). Say clearly where a member version and a friend version differ.
“Friend class in C++ and access to private and protected members.” (2025)
“Friend function in C++; why and when; limits.” (2025)
“Virtual functions, friend functions and static functions.” (2024)
The short answer
A friend function is a function outside the class that the class declares with the keyword friend. It can then use the private and protected members of that class.
Write these points
Declare it inside the class with friend. Define it outside like a normal function, without friend and without the scope operator.
It is not a member. It is called like an ordinary function and takes the object as an argument, so it uses obj.member to reach the data.
One function can be a friend of two classes. This helps when it must work on the private data of both.
A friend class gives all its member functions access to the other class. Write friend class B; inside A.
Friendship is not inherited, not mutual and not passed on. If A names B as a friend, A does not become a friend of B.
Uses: operator overloading such as << and >>. Functions that work across classes. Limit: it weakens data hiding, so use it with care.
Steps
class Box { int w; public: Box(int x) { w = x; } friend void show(Box b); };
void show(Box b) { cout << b.w; }
In main(): Box b(5); show(b); prints 5.
A friend function reading private data.
class Box { int w; public: Box(int x) { w = x; } friend int twice(Box b); };
int twice(Box b) { return 2 * b.w; } is not a member, yet it reads the private w.
twice(Box(7)) returns 14.
If class B is a friend of class A, every function of B can read the private data of A. Friendship is not mutual and is not inherited.
Real-life example
A family gives a trusted neighbour a spare key. The neighbour is not family but can enter. A friend function is that neighbour: not a member, yet allowed to read private data.
A friend function reaches the private data
Same or opposite: friend function and member function
Point
Friend function
Member function
Same or opposite
Belongs to the class
No
Yes
Opposite
Called with an object and dot
No
Yes
Opposite
Can access private data
Yes
Yes
Same
Has a this pointer
No
Yes
Opposite
Exam tip. Write that friend is declared inside the class and defined outside. Mention the loss of encapsulation as the limitation.
RGPV teaches Object Oriented Programming and Methodology to 2 branches under one syllabus. Each branch prints its own code on the paper, but the units are the same. So one page and one PDF serve all of them.
We counted every question in the Object Oriented Programming and Methodology papers on this site by topic, from 2020 to 2025. A topic that keeps coming back is a topic RGPV likes, so it sits higher in the table. One branch alone has only a few papers. Counting them together gives a surer list.
Object Oriented Programming and Methodology important questions by branch
CS-305Object Oriented Programming and Methodology important questions for CSE, Semester 3
CS-305 follows the same RGPV syllabus as the other codes on this page. The 15 topics and answers above are the CS-305 important questions too.
Object Oriented Programming and Methodology (CS-305) teaches how to design programs around objects instead of steps. It has five units in Semester 3 of RGPV B.Tech CSE: the object oriented idea, classes and objects, inheritance, polymorphism, and strings with exceptions. Write small programs for every idea, because that is how it sticks.
Object Oriented Programming and Methodology unit-wise brief
Unit 1: Object oriented thinking
This unit compares object oriented programming with procedural programming and lists the merits and demerits of the object oriented approach. It introduces the object model, the main elements of object oriented languages and input and output processing. Be ready to explain in your own words why the object approach exists.
Unit 2: Encapsulation and data abstraction
Here you learn what an object is: its state, behaviour and identity. The unit covers classes, finding the classes in a problem, attributes and services, access modifiers, static members, message passing, and how objects are created and destroyed. Pick a small problem such as a bank account and model it as a class.
Unit 3: Relationships and inheritance
Classes can reuse and relate to each other. This unit covers inheritance and its types, the 'is a' relationship, association and aggregation, interfaces and abstract classes. Draw a small diagram for each relationship, because the difference between them is easy to mix up.
Unit 4: Polymorphism
Polymorphism lets one name do different jobs. The unit covers method overriding and method overloading, and the difference between static (compile time) and run time polymorphism. Write one example of each kind and say when the decision is made.
Unit 5: Strings, exceptions and case studies
The last unit covers strings, exception handling, and an introduction to multi-threading and data collections. It closes with case studies such as an ATM and a library management system. Build one of the case studies yourself and your answers will improve.
Units follow the RGPV scheme and syllabus, B.Tech Computer Science and Engineering, Semester 3 (AICTE flexible curriculum, batches admitted July 2020 (w.e.f. July 2021)). For the full topic list of each unit, open the Object Oriented Programming and Methodology notes.
Start with the latest papers
Object Oriented Programming and Methodology - Dec 2024
Object Oriented Programming and Methodology - Jun 2023
Object Oriented Programming and Methodology - Dec 2023
Object Oriented Programming and Methodology (CS-305) FAQs
What are the most important topics in Object Oriented Programming and Methodology?
By how often they were asked in the papers on this site: Abstract class and interface (21 times); Polymorphism: compile time and run time (18 times); Exception handling (try, catch, throw) (17 times); Features, merits and demerits of OOP (16 times); Inheritance and its types (15 times).
How were these Object Oriented Programming and Methodology important questions chosen?
Each topic was counted from the questions in the past papers listed on this site (2020-2025). Repeated is the number of times the topic came. The counts come from keyword matching and the answers are not teacher-reviewed, so use them together with your syllabus.
Is there a PDF of Object Oriented Programming and Methodology important questions with answers?
Yes. The Paperwala Imp Question & Answer PDF for Object Oriented Programming and Methodology is free to download from this page.
The 15 most repeated topics of Object Oriented Programming and Methodology (CS-305) for RGPV B.Tech CSE semester 3, counted from the previous year papers on this site. The same syllabus is taught under 2 codes: CS-305, IS-305. Object Oriented Programming and Methodology is also searched for as CO-305.