Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

Write short answers

Question 1
What is object oriented programming? Name two object oriented programming
languages.

Answer

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. Two Object
Oriented Programming languages are C++ and Java.

Question 2
Name four basic principles of object oriented programming.

Answer

Four basic principles of object oriented programming are:

Encapsulation
Abstraction
Inheritance
Polymorphism
Question 3
Why do we prefer object oriented approach in complex programming? Explain.

Answer

Object Oriented approach offers advantages like:

Data Values are secured.


Mishandling of data is protected.
Error detection and correction becomes easier.
Easier in coding complex programs.
For these reasons, Object Oriented approach is preferred for complex programming.

Question 4
What is meant by a base class and a derived class?

Answer

The class that is inherited is known as base class and the class that inherits from
the base is known as derived class.

Question 5
Mention two limitations of procedure oriented programming approach.

Answer

Two limitations of procedure oriented programming approach are:

No restriction on data values.


No reusability concept hence time management, testing and length of the program
increases.
Question 6
What is meant by Encapsulation?
Answer

Wrapping of data and functions that operate on that data into a single unit is
called Encapsulation.

Question 7
Define the following with an example each.

(a) Inheritance

Answer

Inheritance enables new classes to receive or inherit the properties and methods of
existing classes. Example of Inheritance is given here.

(b) Polymorphism

Answer

In object-oriented programming, Polymorphism provides the means to perform a single


action in multiple different ways. Example of Polymorphism is given here.

Question 8
In what way is Data Hiding related to Data Abstraction?

Answer

Data Hiding and Data Abstraction are complementary concepts. Data Abstraction
focuses on the observable behaviour of an object, whereas Data hiding or Data
Encapsulation focuses upon the implementation that gives rise to this behaviour. In
other words, Data Abstraction cares about what something does but not how it does
it. Data Encapsulation cares about how something does what it does such that others
don't have to worry about the implementation details. Hence, we can say that
Encapsulation is a way to implement Data Abstraction.

Question 9
Give an example to explain Data Abstraction.

Answer

Example of Data Abstraction is given here.

Question 10
What is meant by Data Hiding?

Answer

Data Hiding means restricting direct access to the implementation details of an


object and providing a well defined public interface through methods to use the
functionality of the object.

You might also like