Unit 1: Introduction to Object Oriented Programming Concepts

PrevNextBack

Unit 1: Introduction to Object Oriented Programming Concepts

Contents

Tick the correct option

Question 1

In object oriented programming, the stress is given on:

  1. procedure
  2. methods
  3. class
  4. data ✓

Question 2

Which of the following principle does not allow to access directly from outside the class premises:

  1. data hiding
  2. encapsulation
  3. abstraction
  4. all of the above ✓

Question 3

The process of combining data and functions that enables them to be together as a single entity is called

  1. inheritance
  2. encapsulation ✓
  3. classification
  4. attributes

Question 4

The process by which a class acquires the properties from another class is called:

  1. polymorphism
  2. inheritance ✓
  3. abstraction
  4. object

Question 5

In procedural programming, the stress is laid on:

  1. class
  2. function ✓
  3. data
  4. object

Question 6

A ............... is a set of objects that has common attributes and common behavior.

  1. abstraction
  2. encapsulation
  3. class ✓
  4. function

Question 7

Which of the following is not an object oriented programming language?

  1. C++
  2. Simula
  3. BASIC ✓
  4. Java

Question 8

The process of restricting the free flow of data from the outside world is known as:

  1. encapsulation ✓
  2. inheritance
  3. function
  4. class

Fill in the blanks

Question 1

Object is the fundamental concept in object oriented programming language.

Question 2

Objects can communicate with each other through function in object oriented programming language.

Question 3

Using a function for multiple operations is called as polymorphism.

Question 4

Data Abstraction is an act of representing essential features without including background details.

Question 5

Feature of wrapping data and functions as a single unit is called encapsulation.

Question 6

Inheritance principle of object oriented programming promotes reusability feature.

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:

  1. Encapsulation
  2. Abstraction
  3. Inheritance
  4. Polymorphism

Question 3

Why do we prefer object oriented approach in complex programming? Explain.

Answer

Object Oriented approach offers advantages like:

  1. Data Values are secured.
  2. Mishandling of data is protected.
  3. Error detection and correction becomes easier.
  4. 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:

  1. No restriction on data values.
  2. 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.

Video Explanations