Chapter 5: Object Oriented Programming (OOP)

  1. What are the programming methods or approaches of program development?

There are two approaches of program development. They are Procedure Oriented Programming and Object-Oriented Programming. Procedure Oriented Programming is a conventional method of programming and the Object-Oriented Programming is a modern or latest programming method.

  1. What is Procedure Oriented Programming?

It is a conventional or old method of programming, in which the program is written into many small parts  and combined together. In this approach, the functions are created and the data is not very crucial.  Variables are created for the data handling and they are treated as the global and local variables. Creation  of the variables inside of the sub programs is known as local variable and the creation of the variables in  the main module is called the global variable. Global variables can be accessed from any modules but the  local variables can be accessed only within the local modules. The alteration of data is very high.

  1. What are the features of Procedure Oriented Programming?

The characteristics or features are as follow:

a) A large program is broken down into small programs or procedures.

b) It focuses on the functions rather than the data.

c) Variables are created as local and global.

d) The possibility of data alteration is very high, which is the main disadvantage of this approach.

e) It follows top down method.

  1. What is Object Oriented Programming?

It is a modern approach of programming. It is highly known as OOP in short form. In this method, all the  real world entities are treated as the objects and objects are collected in a class. Even the classes are  controlled by the Superclass. And by the inheritance feature, the changes on the superclass are easily  passed to its subclasses. Similarly, it was developed to overcome procedure oriented programming  method and the data is given high priority rather than the functions. Data can be hidden, so that the  possibility of data alteration is very less.

  1. What are the characteristics of OOP?

a) Emphasis is given to the data.

b) Program are divided into multiple objects.

c) Functions and data are tied together in a single unit.

d) Data can be hidden to prevent accidental alteration.

e) It follows the bottom up approach.

  1. What are the differences between Procedure Oriented and Object Oriented Programming?
Procedure Oriented Object Oriented
1. Emphasis is given to procedures. 1. Emphasis is given to data.
2. Programs are divided into multiple modules. 2. Programs are divided into multiple objects.
3. It follows top-down method. 3. It follows bottom-up method.
4. Generally data cannot be hidden. 4. Data can be hidden.
5. It does not model the real world perfectly. 5. It models the real world perfectly.
6. Maintenance is difficult. 6. Maintenance is easy.
7. Code reusability is difficult. 7. Code reusability is easy.
8. Examples: FORTRAN, COBOL, Pascal, C, etc. 8. Examples: C++, JAVA, Smalltalk, etc.
  1. Write short notes on the following:

a) Object

All the entities of a program used in OOP method are called objects. Here entities represent a group of  people, teachers, students, books, cars, etc. Each entity or object does have an attribute called  characteristics and the behavior or functions. For example, a car can be an object. The colour like blue,  black, size, weight, etc. are the attributes or the characteristics, which distinguishes to it with other  objects and move, turn, etc. can be the functions.

b) Class

Class is a user defined data type in OOP, which defines the data types for all the objects, which run under  it. Or it collects the objects of its similar data types. For example, a class vehicle can have the objects like  car, bus, truck, etc. Similarly a class school can have students, teachers, staff, etc.

c) Abstraction

It is a feature of hiding internal detail of any object. It provides only the interface to the user, which makes  them easy to use but does not show the details of that object, how that works and how that is made. Due  to this feature, OOP has become very secure platform for its data from being accidental alteration.

d) Encapsulation

It is a process of combining the data and functions together. OOP gives more emphasis on the data rather  than the functions or procedures. Many functions can use the same data but the instruction given to the  function to use any particular data and combining them together is the encapsulation. Due to its unrelated  functions cannot use unnecessary data in the program.

e) Inheritance

Inheritance is the process of creating new classes based on the existing class. The new classes require the  features of the main class called the Super class and it is provided through the feature called Inheritance. By the Inheritance feature Super class can coordinate with its subclasses. It models the real world. It  allows the extension and reuse of existing code without having to rewrite for the new created classes.

f) Polymorphism

It is a feature of OOP, which refers to the way of operating the same operator in different ways and  different method or purpose. Operator overloading and the operation overloading are the examples or  Polymorphism. For example ‘+’ operator can be used for arithmetic operation and string concatenation  both. This facility or feature is an example of Polymorphism. It reduces the number or keywords or  operators.

  1. What are the advantages and disadvantages of OOP?


a) Code repetition is reduced by the various techniques like inheritance.

b) Data is more secure due to the data hiding feature called abstraction.

c) Existing classes can serve as library class for further enhancements.

d) Division of a program into multiple objects makes the software development easier. e) Software complexity is less.

f) Upgrading and maintenance of software is easy.

g) It perfectly models the real world system.

h) Code reusability is much easier than the conventional programming system.


a) Compiler and runtime overhead is high.

b) Software developer should analyze the problem in object oriented way.

c) Requires the mastery in software engineering and programming methodology.

d) Useful only for the large and complex projects.


Application of OOP

  1. Expert System
  2. Artificial intelligence
  3. Management information systems.
  4. Decision support system.
  5. Computer based training and education
  6. Object- oriented database.
  7. Computer games.
  8. Mobile applications.
  9. Internet based applications.
  10. Designing user interface for software.
  11. Security System