CS-305 IS-305 Object Oriented Programming and Methodology

Object Oriented Programming and Methodology Important Questions

RGPV · B.Tech · CSE · Semester 3 · Current scheme · 6 papers (2020 to 2024)

  1. Read the answers

    Start with the topics that come every year.

  2. Revise unit notes

    Go through each unit once to score more.

Paperwala Imp Topics - Object Oriented Programming and Methodology important questions

Download Paperwala Imp Question & Answer (PDF)

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

  1. 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.
  2. An abstract class may have data members, normal functions and constructors. It can have pointers and references, but no objects.
  3. A derived class that does not override every pure virtual function stays abstract.
  4. 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.
  5. In C++ there is no interface keyword. A class made only of pure virtual functions plays that role.
BasisAbstract classInterface
FunctionsNormal and pure virtualOnly declarations (pure virtual)
Data membersAllowedNot in the usual design
InheritanceSingle or multiple in C++A class can use many
PurposeCommon base with shared codeA 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
Abstract class Shape and its derived classes

Same or opposite: abstract class and interface

PointAbstract classInterfaceSame or opposite
Can hold normal methodsYesNo (only pure virtual)Opposite
Data membersAllowedNot usualOpposite
Objects can be createdNoNoSame
A class can implement manyThrough multiple inheritanceYesOpposite

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);.

Back to the topic list

Q2. Polymorphism: compile time and run time

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

  1. Compile time (static) polymorphism is decided by the compiler. It comes from function overloading and operator overloading. It is also called early binding.
  2. 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.
  3. Compile time calls are faster because no lookup is needed. Run time calls are more flexible because the real object decides which function runs.
  4. 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.
BasisCompile timeRun time
BindingEarly, by the compilerLate, while running
Achieved byFunction and operator overloadingVirtual functions and overriding
SpeedFasterSlightly slower (vtable lookup)
Examplearea(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
Two kinds of polymorphism

Same or opposite: compile-time and run-time polymorphism

PointCompile timeRun timeSame or opposite
DecidedWhen compilingWhile runningOpposite
Achieved byOverloadingVirtual functionsOpposite
SpeedFasterSlightly slowerOpposite
One name, many formsYesYesSame

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.

Back to the topic list

Q3. Exception handling (try, catch, throw)

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

  1. try holds the code that may fail. throw signals the error. catch receives it and handles it.
  2. 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.
  3. A try block can have several catch blocks. Put specific types first. catch(...) catches every type.
  4. Local objects are destroyed while control leaves the try block (stack unwinding), so destructors still run.
  5. Java has one more block, finally, that always runs. Common run time exceptions there are ArrayIndexOutOfBoundsException, NullPointerException and ArithmeticException.
  6. 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

  1. Read x, y and z.
  2. try { if (x == y) throw 0; float r = z / (x-y); cout << r; }
  3. catch (int e) { cout << "Division by zero"; }
  4. 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
Flow of try, throw and catch

Same or opposite: error and exception

PointCompile-time errorExceptionSame or opposite
FoundWhen compilingWhile runningOpposite
ExampleMissing semicolonDivide by zeroOpposite
Handled by try-catchNoYesOpposite
Must be fixed or handledYesYesSame

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.

Back to the topic list

Q4. Features, merits and demerits of OOP

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

  1. Main features: object, class, encapsulation, data abstraction, inheritance, polymorphism, message passing and dynamic binding.
  2. Merit: code reuse. Inheritance lets one class use the code of another, so less code is written and tested.
  3. Merit: security. Data hiding stops outside code from changing the data by mistake.
  4. Merit: easy maintenance and extension. A change stays inside one class. New objects can be added without touching old code.
  5. Merit: it models the real world, so a large problem splits into small objects that are easy to understand.
  6. Demerit: more design effort at the start. Beginners also need more time to learn it.
  7. 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
Main concepts of object oriented programming

Same or opposite: encapsulation and inheritance

PointEncapsulationInheritanceSame or opposite
PurposeHide and protect dataReuse codeOpposite
Keywordprivate, public: public BaseOpposite
OOP featureYesYesSame
ExampleBank balance kept privateSavings account from AccountOpposite

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.

Back to the topic list

Q5. Inheritance and its types

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

  1. Syntax: class Dog : public Animal { };. The derived class gets the public and protected members of the base class.
  2. 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.
  3. Hierarchical: one base class with many derived classes. Hybrid: a mix of the types above, for example multiple and multilevel together.
  4. Constructors run from base to derived. Destructors run in the opposite order.
  5. 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().
  6. 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)
Types of inheritance (arrow points from derived to base)

Same or opposite: multilevel and multiple inheritance

PointMultilevelMultipleSame or opposite
Parents of one classOne, in a chainTwo or moreOpposite
ExampleA → B → CC from A and BOpposite
Diamond problemNoYes, solved by virtual base classOpposite
Reuses parent codeYesYesSame

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.

Back to the topic list

Q6. Class and object

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

  1. A class is a blueprint. It takes no memory until an object is made from it.
  2. An object has state (the values of its data members), behaviour (its member functions) and identity (its own name and address).
  3. Many objects can come from one class. Each object has its own copy of the data members and all share the member functions.
  4. Use the dot operator with an object (s1.show()) and the arrow operator with a pointer (p->show()).
  5. 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() { }.
  6. Singleton class: a class that allows only one object. The constructor is private and a static function returns the single instance.
ClassObject
Blueprint or templateReal instance of the class
No memory at definitionMemory is allocated at creation
Defined onceMany can be created
Example: StudentExample: 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
One class, two objects

Same or opposite: class and object

PointClassObjectSame or opposite
What it isBlueprintReal instanceOpposite
MemoryNone for data until objects are madeGets memoryOpposite
NumberDeclared onceMany from one classOpposite
Has data members and functionsYesYesSame

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.

Back to the topic list

Q7. Association, aggregation and composition

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

  1. Association: two independent classes know each other. A Teacher teaches Students. It can be one to one, one to many or many to many.
  2. 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.
  3. 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.
  4. 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.
  5. Inheritance is a different link. It is is-a. Aggregation and composition are has-a.
RelationMeaningPart without whole?Example
AssociationUses or knowsYesTeacher and Student
AggregationHas-a, weakYesDepartment and Teacher
CompositionHas-a, strongNoHouse 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
UML notation of the three relations

Same or opposite: aggregation and composition

PointAggregationCompositionSame or opposite
RelationshipHas-a, weakHas-a, strongOpposite
Part lives after the whole is goneYesNoOpposite
UML symbolHollow diamondFilled diamondOpposite
A kind of associationYesYesSame

Exam tip. Draw the three UML symbols. They are easy marks. The test for composition: does the part die when the whole dies?.

Back to the topic list

Q8. Access modifiers: public, private, protected

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

  1. private members can be used only by member functions and friends of the same class. This is the default in a class.
  2. protected members can also be used by derived classes. Outside code cannot use them.
  3. public members can be used from anywhere. They form the interface of the class.
  4. Data hiding: keep data private and give public functions to read or change it. Then every change goes through your checks.
  5. 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.
  6. Java has a fourth level, default (package) access, when no word is written.
ModifierSame classDerived classOutside
privateYesNoNo
protectedYesYesNo
publicYesYesYes

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
Who can reach a member

Same or opposite: private and protected

PointPrivateProtectedSame or opposite
Access in the same classYesYesSame
Access in a derived classNoYesOpposite
Access from outsideNoNoSame
Default in a classYesNoOpposite

Exam tip. Write the table. It earns the marks quickly. Name data hiding when the question says role in data hiding.

Back to the topic list

Q9. Constructor and destructor

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

  1. 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.
  2. 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.
  3. Constructors can be overloaded. A destructor takes no argument and returns nothing. It cannot be overloaded. A class has only one.
  4. Objects are destroyed in the reverse order of creation.
  5. A constructor is not mandatory. If you write none, the compiler gives a default one.
  6. Use the destructor to release memory taken with new and to close files.
TypeSyntaxCalled when
DefaultPoint()Point p;
ParameterizedPoint(int a, int b)Point p(2, 3);
CopyPoint(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
Life of an object

Same or opposite: constructor and destructor

PointConstructorDestructorSame or opposite
NameSame as the class~ and the class nameOpposite
ArgumentsCan take themNoneOpposite
OverloadingAllowedNot allowedOpposite
Called automaticallyYesYesSame

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.

Back to the topic list

Q10. Virtual function

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

  1. 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.
  2. 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.
  3. 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.
  4. A pure virtual function has no body in the base class and is written = 0. A class with one is abstract.
  5. Make the base class destructor virtual when you delete a derived object through a base pointer. Otherwise only the base destructor runs.

Steps

  1. class Animal { public: virtual void sound() { cout << "Animal"; } };
  2. class Dog : public Animal { public: void sound() { cout << "Bark"; } };
  3. Animal *p = new Dog(); p->sound(); prints Bark. Without virtual it prints Animal.

With and without the virtual keyword.

class Animal { public: virtual void sound() { cout << "..."; } };

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
Call through a base pointer with a virtual function

Same or opposite: virtual and normal member function

PointVirtual functionNormal functionSame or opposite
BoundAt run timeAt compile timeOpposite
Through a base pointer callsDerived versionBase versionOpposite
Needs a vtableYesNoOpposite
Declared in a classYesYesSame

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.

Back to the topic list

Q11. Encapsulation and data abstraction

Asked 9 times in 2020, 2023, 2024, 2025 · Unit 2

From the papers

  • “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

  1. Encapsulation is done with a class: private data members and public member functions (getters and setters).
  2. 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.
  3. Difference: encapsulation is about packing data and code together and hiding the data. Abstraction is about showing only what the user needs.
  4. Benefits: data security, easy change of the inside without changing the users, fewer bugs.
  5. 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
Class as a capsule

Same or opposite: encapsulation and abstraction

PointEncapsulationAbstractionSame or opposite
FocusHiding data inside a classShowing only what is neededOpposite
Done withAccess specifiersAbstract classes, interfacesOpposite
LevelImplementationDesignOpposite
Reduces complexityYesYesSame

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.

Back to the topic list

Q12. OOP versus procedural programming

Asked 8 times in 2020, 2023, 2024, 2025 · Unit 1

From the papers

  • “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.

Write these points

  1. Procedural languages: C, Pascal, FORTRAN. Object oriented languages: C++, Java, Python.
  2. 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.
  3. Procedural design is top down (main problem split into functions). OOP design is bottom up (objects first, then the program).
  4. OOP gives inheritance and polymorphism, so code is reused. In procedural code a similar function is often copied.
  5. OOP models real things, so large programs are easier to change. Procedural style is simple and quick for small programs.
BasisProceduralObject oriented
FocusFunctionsObjects
DataGlobal, shared, openHidden inside objects
ApproachTop downBottom up
SecurityLowHigh (access control)
ReuseCopy functionsInheritance
PolymorphismNoYes

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
Where the data lives

Same or opposite: OOP and procedural programming

PointOOPProceduralSame or opposite
Built aroundObjectsFunctionsOpposite
Data securityHidden in classesGlobal data is openOpposite
ApproachBottom upTop downOpposite
Example languageC++, JavaCOpposite
Solves problems with codeYesYesSame

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.

Back to the topic list

Q13. Function overloading versus overriding

Asked 7 times in 2020, 2022, 2023, 2025 · Unit 4

From the papers

  • “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

  1. Overloading is decided at compile time by the number, types or order of arguments. The return type alone cannot tell two functions apart.
  2. Overriding is decided at run time when the base function is virtual and the call is through a pointer or reference.
  3. Overloading happens inside one class. Overriding needs two classes in an inheritance link.
  4. The same names are used in Java as method overloading and method overriding.
  5. 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.
BasisOverloadingOverriding
WhereSame classBase and derived class
SignatureMust differMust be the same
BindingCompile timeRun time (with virtual)
KeywordNonevirtual 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
Overloading and overriding side by side

Same or opposite: overloading and overriding

PointOverloadingOverridingSame or opposite
WhereSame classBase and derived classOpposite
SignatureMust differMust be the sameOpposite
Polymorphism typeCompile timeRun timeOpposite
Same function nameYesYesSame

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.

Back to the topic list

Q14. Operator overloading

Asked 5 times in 2020, 2022, 2024 · Unit 4

From the papers

  • “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

  1. It is compile time polymorphism. The operator keeps its usual meaning for built in types.
  2. You cannot overload these operators: :: . .* ?: sizeof. You cannot change the precedence or the number of operands. You cannot create a new operator.
  3. Member function: the left operand is the calling object. A unary operator takes no argument and a binary operator takes one.
  4. 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.
  5. The assignment operator = must be a member function. It cannot be a friend.
  6. Write the Distance class: operator+ adds the parts and carries cm into m. operator- subtracts in the same way.

Steps

  1. class Distance { int m, cm; public: Distance(int a = 0, int b = 0) { m = a; cm = b; }
  2. Distance operator+(Distance d) { Distance t; t.cm = cm + d.cm; t.m = m + d.m + t.cm / 100; t.cm = t.cm % 100; return t; }
  3. Distance operator-(Distance d) { Distance t;
  4. int x = m*100 + cm; int y = d.m*100 + d.cm;
  5. t.m = (x-y) / 100; t.cm = (x-y) % 100; return t; } };
  6. 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
How a + b is read by the compiler

Same or opposite: member and friend operator function

PointMember functionFriend functionSame or opposite
Left operandMust be an object of the classCan be any typeOpposite
Arguments for a binary operatorOneTwoOpposite
Keywordoperatorfriend and operatorOpposite
Gives a new meaning to an operatorYesYesSame

Exam tip. Write the general syntax: return_type operator op (arguments). Say clearly where a member version and a friend version differ.

Back to the topic list

Q15. Friend function and friend class

Asked 5 times in 2022, 2024, 2025 · Unit 4

From the papers

  • “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

  1. Declare it inside the class with friend. Define it outside like a normal function, without friend and without the scope operator.
  2. 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.
  3. One function can be a friend of two classes. This helps when it must work on the private data of both.
  4. A friend class gives all its member functions access to the other class. Write friend class B; inside A.
  5. 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.
  6. Uses: operator overloading such as << and >>. Functions that work across classes. Limit: it weakens data hiding, so use it with care.

Steps

  1. class Box { int w; public: Box(int x) { w = x; } friend void show(Box b); };
  2. void show(Box b) { cout << b.w; }
  3. 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
A friend function reaches the private data

Same or opposite: friend function and member function

PointFriend functionMember functionSame or opposite
Belongs to the classNoYesOpposite
Called with an object and dotNoYesOpposite
Can access private dataYesYesSame
Has a this pointerNoYesOpposite

Exam tip. Write that friend is declared inside the class and defined outside. Mention the loss of encapsulation as the limitation.

Back to the topic list

How we picked these questions

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-305 Object 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.

See all 6 CS-305 previous year papers

IS-305 Object Oriented Programming and Methodology important questions for IOT, Semester 3

IS-305 follows the same RGPV syllabus as the other codes on this page. The 15 topics and answers above are the IS-305 important questions too.

See all 8 IS-305 previous year papers

About Object Oriented Programming and Methodology

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

See all 6 papers →

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.

Also known as CO-305