Chapter 13
Chapter 13
Chapter 13
www.nammakalvi.org
Unit - IV CHAPTER - 13
INTRODUCTION TO OOP WITH C++
Part – 1
Choose the best answer
1. The term is used to describe a programming approach based on classes and objects is
(A) OOP (B) POP (C) ADT (D) SOP
2. The paradigm which aims more at procedures.
(A) Object Oriented Programming (B) Procedural programming
(C) Modular programming (D) Structural programming
3. Which of the following is a user defined data type?
(A) class (B) float (C) int (D) object
4. The identifiable entity with some characteristics and behaviour is.
(A) class (B) object (C) structure (D) member
5. The mechanism by which the data and functions are bound together into a single unit is known as
(A) Inheritance (B) Encapsulation (C) Polymorphism (D) Abstraction
6. Insulation of the data from direct access by the program is called as
(A) Data hiding (B) Encapsulation (C) Polymorphism (D) Abstraction
7. Which of the following concept encapsulate all the essential properties of the object that are to be
created?
(A) class (B) Encapsulation (C) Polymorphism (D) Abstraction
8. Which of the following is the most important advantage of inheritance?
(A) data hiding (B) code reusability (C) code modification (D) accessibility
9. “Write once and use it multiple time” can be achieved by
(A) redundancy (B) reusability (C) modification (D) composition
10. Which of the following supports the transitive nature of data?
(A) Inheritance (B) Encapsulation (C) Polymorphism (D) Abstraction
Part –II
Answer to all the questions (2 Marks):
1. How is modular programming different from procedural programming paradigm?
MODULAR PROGRAMMING PROCEDURAL PROGRAMMING
Paradigm consists of multiple modules, each Procedural means a list of instructions were given
module has a set of functions of related types. to the computer to do something. Procedural
Data is hidden under the modules. programming aims more at procedures.
Features: Features:
Programs are divided into individual modules. Programs are organized in the form of
Each modules are independent of each other subroutines or sub programs.
and have their own local data. All data items are global.
CLASS OBJECT
Class is a user defined data type. Class represents Objects are the basic unit of OOP. It represents
a group of similar objects. data and associated function together in to a single
unit.
Objects are share common properties and An identifiable entity with some characteristics
relationship. and behavior.
3. What is polymorphism?
Polymorphism is the ability of a message or function to be displayed in more than one form.
Example:
Draw_square() Draw_circle() Draw_rectangle()
Abstract attributes are Encapsulate all the essential properties of the object that are to be created.
The attributes are called data members because they hold information.
Abstraction refers to showing only the essential features without revealing background details.
Part – III
Answer to all the questions (3 Marks):
1. What is paradigm? Mention the different types of paradigm.
Paradigm means organizing principle of a program. It is an approach to programming.
There are different approaches available for problem solving using computer. They are,
1. Procedural programming
2. Modular Programming
3. Object Oriented Programming
Part –IV
Answer to all the questions (5 Marks):
1. Write the differences between Object Oriented Programming and procedural programming.
In OOP where the program can be Programs are organized in the form of
decomposed into modules. subroutines or sub programs.
Programs are designed around the data Suitable for small sized software
being operated. application.
Example: C++, Java, VB.Net, Python etc. Example: FORTRAN and COBOL.
1. Re-usability:
“Write once and use it multiple times” you can achieve this by using class.
2. Redundancy:
Inheritance is the good feature for data redundancy. If you need a same functionality in multiple
class you can write a common class for the same functionality and inherit that class to sub class.
3. Easy Maintenance:
It is easy to maintain and modify existing code as new objects can be created with small
differences to existing ones.
4. Security:
Using data hiding and abstraction only necessary data will be provided thus maintains the
security of data.
Disadvantages of OOP:
1. Size: Object Oriented Programs are much larger than other programs.
2. Effort: Object Oriented Programs require a lot of work to create.
3. Speed: Object Oriented Programs are slower than other programs, because of their size.
The Object Oriented Programming has been developed to overcome the drawbacks of procedural and
modular programming. It is widely accepted that object-oriented programming is the most important and
powerful way of creating software.
Data Abstraction
Encapsulation
Modularity
Inheritance
Polymorphism
1. Encapsulation
The mechanism by which the data and functions are bound together into a single unit is known as
Encapsulation.
This encapsulation of data from direct access by the program is called data hiding or information
hiding.
2. Data Abstraction
Abstraction refers to showing only the essential features without revealing background details. Classes
use the concept of abstraction to define a list of abstract attributes and function which operate on these
attributes.
3. Modularity
Modularity is designing a system that is divided into a set of functional units (named modules) that can
be composed into a larger application.
4. Inheritance
Inheritance is the technique of building new classes (derived class) from an existing Class (base class).
The most important advantage of inheritance is code reusability.
5. Polymorphism
Polymorphism is the ability of a message or function to be displayed in more than one form.
www.nammakalvi.org
in
Vijay Guide
Mobile No : 9655826843 Email : [email protected]