0% found this document useful (0 votes)
3 views

Principles Of OOP

Uploaded by

sarthak12das
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Principles Of OOP

Uploaded by

sarthak12das
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Principles of Object Oriented Programming

Write the short notes with examples if applicable-

1. Object Oriented Programming- Object Oriented Programming is an


approach in which stress is laid on data rather than functions. The data
values remain associated with the functions of a particular block of the
program so as to encourage data security.

2. Data Abstraction- Data Abstraction is the act of representing the


essential features without knowing the background details. Example of
Data Abstraction is Listening to music using headphones
3. Encapsulation- Wrapping of data and functions that operate on that
data into a single unit is called Encapsulation. Example of Encapsulation
is a person stores his personal information in itself ans its behaviour is
also implemented in it.

4. Machine Level language- For the processor to perform any


computation, we need to give the instructions and data as a sequence of
0's & 1's. This binary sequence that a processor understands is known as
its Machine Level language. Machine Level language is made up of
instructions and data that are all binary numbers. Machine Level
language of a processor differs from vendor to vendor. So programs
written in Machine Level language of one type of processors will not
work on a different type of processor.
5. Polymorphism- In object-oriented programming, Polymorphism
provides the means to perform a single action in multiple different ways.
Example of Polymorphism is behaviour of human beings.

6. Procedure Oriented Programming- Procedure Oriented Programming


basically consists of a list of instructions for the computer to follow and
these are organized into groups known as functions. In Procedure
Oriented Programming, most of the functions share global data and this
data moves more openly around the system from one function to the
other.
7. Inheritance- Inheritance enables new classes to receive or inherit the
properties and methods of existing classes. Example of Inheritance is a
child inheriting the qualities of parents.

8. Assembly Level language- In Assembly Level language, instructions


are written in more English like words known as mnemonics. These
instructions are not understood by the processor directly. They are
converted into equivalent Machine Level instructions through a
translator program called Assembler. Assembly Level language is
machine dependent that makes it unsuitable for writing portable
programs that can execute across machines.

Distinguish Between-
1. Object Oriented Programming and Procedure Oriented Programming

2. High Level language and Low Level language

3. Compiler and Interpreter

Answer the following questions-


1. Enlist the features of Object Oriented Programming.
Ans- Some of the features of Object Oriented Programming are:

I. It gives stress on data items rather than functions.


II. It makes the complete program/problem simpler by dividing it into
number of objects.
III. The objects can be used as a bridge to have data flow from one
function to another.
IV. The concept of data hiding enhances security in programs.
V. It is highly beneficial to solve complex programs.

2. Which OOP principle implements function overloading? Explain

Ans- Polymorphism implements function overloading. It is the process of


using a function/method for more than one purpose. In function
overloading, we write more than one function with the same name but
differing in the number and types of their arguments to perform different
tasks. This way we get different behaviour using the same function name.

3. Write three benefits of Object Oriented Programming.


Ans- Three benefits of Object Oriented Programming are:

I. The reusability of the program code is enhanced.


II. Data abstraction makes the software easier to handle.
III. Software for complex tasks can be easily developed.

4. Mention two limitations of:

Ans- I. Procedure Oriented Programming-

A. No restriction on data values so managing changes is difficult as it


impacts the entire program.
B. No reusability concept hence time management, testing and length of
the program increases.

II. Object Oriented Programming-

A. Requires intensive testing processes.

B. Solving problems takes more time as compared to Procedure Oriented


Programming.

5. How is Encapsulation useful in Object Oriented Programming?


Explain

Ans- Encapsulation restricts the free flow of data from one object to
another. The data and functions are wrapped together in an object in
such a way that the data of a particular object can only be used in
associated functions. Thus, Encapsulation helps in protecting the data
from unauthorized access.
6) What are the advantages of High Level languages?

Ans- A. High Level languages are machine independent.


B. High Level languages are human readable as instructions are
written using English like words and phrases.

C. It is easier to understand and develop the program logic in High


Level languages.

D. The error detection and correction is easier.

You might also like