Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
7 views5 pages

11CS 13 Introduction To Object Oriented Programming v6

Uploaded by

yashwanthsubha16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views5 pages

11CS 13 Introduction To Object Oriented Programming v6

Uploaded by

yashwanthsubha16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

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

Page 1 of 5
Part –II

Answer to all the questions (2 Marks):

1) How is modular programming different from procedural programming paradigm?


MODULAR PROGRAMMING PROCEDURAL PROGRAMMING
multiple modules, each module has a set of list of instructions were given to the
functions of related types. computer to do something.
Data are hidden Data are not hidden
Example: Pascal and C Example: FORTRAN and COBOL

2) Differentiate classes and objects.


Class Object
Class is a mechanism of hiding data members Object is the instance of the class. It is also
and associated methods in a single unit . called Class variables.
It generates the objects It gives life to the class
Memory space is not allocated, when it is Memory space is allocated, when it is created
created
Eg. Eg.
Car is the class BMW, Audi are the objects

3) What is polymorphism?
Polymorphism is the ability of a message or function to be displayed in more than one form.

4) How is encapsulation and abstraction are interrelated?


 Abstraction and Encapsulation look similar to each other by its definition.
 Abstraction is showing only necessary features to the user and hides its implementation. On the
other hand, Encapsulation is hiding the complexity from the outer world.
 Encapsulation is wrapping data into single unit(eg. A class). Abstraction is hiding unessential parts
and showing only essential data.

5) Write the disadvantages of OOP.


Size: Object Oriented Programs are much larger than other programs.
Effort: Object Oriented Programs require a lot of work to create.
Speed: Object Oriented Programs are slower than other programs, because of their size.

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 : It aims more at procedures

Page 2 of 5
2. Modular Programming : It consists of multiple modules. Each module has a set of functions of
related types.
3. Object Oriented Programming : It is widely accepted that Object Oriented Programming is
the most important and powerful way of creating software.

2) Write a note on the features of procedural programming.


 Programs are organized in the form of subroutines or sub programs
 All data items are global
 Suitable for small sized software application
 Difficult to maintain and enhance the program code as any change in data type needs to be
propagated to all subroutines that use the same data type. This is time consuming.
Example: FORTRAN and COBOL.

3) List some of the features of modular programming.


 Emphasis on algorithm rather than data
 Programs are divided into individual modules
 Each modules are independent of each other and have their own local data
 Modules can work with its own data as well as with the data passed to it.
Example: Pascal and C

4) What do you mean by modularization and software reuse?


 Modularisation: Where the program can be decomposed into modules.
 Software re-use: Where a program can be composed from existing and new modules.

5) Define information hiding.


 Encapsulation is the process of binding data and its related function.
 The data is not accessible to the outside world, and only those functions which are
wrapped in the class can access it.
 These functions provide the interface between the object’s data and the program.
 Encapsulation of data from direct access by the program is called data hiding or
information hiding.

Part –IV
Answer to all the questions (5 Marks):
1) Write the differences between Object Oriented Programming and procedural programming
OBJECT ORIENTED PROGRAMMING PROCEDURAL PROGRAMMING
Bottom Up Approach Top Down Approach
main modules are classes modules are a sequence of statements.
importance is given to the data rather Importance given to function and not given to
than procedures data
private, protected and public are the no access specifiers
access specifiers

Page 3 of 5
overloading is possible. Overloading is NOT possible
data hiding is possible. data hiding is not possible.
addition of new data and function is addition of new data and function is not easy.
easy.
create classes and objects that model Procedures are a sequence of imperative
real world objects. statements,
C++, Java, VB, NET FORTRAN, C, Pascal

2) What are the advantages of OOPs?

Advantages of OOP:

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.

3) Write a note on the basic concepts that support OOPs?


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.

The Object-Oriented Programming approach mainly encourages:

 Modularisation: where the program can be decomposed into modules.


 Software re-use: where a program can be composed from existing and new modules.

1. Encapsulation

 The mechanism by which the data and functions are bound together into a single unit is known
as Encapsulation.

Page 4 of 5
 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.

Page 5 of 5

You might also like