CH – 10 AN INTRODUCTION TO OBJECT ORIENTED PROGRAMMING
1. SHORT ANSWER QUESTIONS
a. What do you mean by programming paradigm?
Ans: The programming paradigm is all about the writing style and organizing the program code in a specific way. It is framework that defines how the programmer can conceptualize and model complex problem to be solved.
b. Define object.
Ans: Object is a basic unit of Object Oriented Programming and represents the real life entities. An object is a thing in real world which has certain properties and methods.
c. Define class
Ans: A class is a user defined blueprint or prototype from which objects are created. It represents the set of properties or methods that are common to all objects of one type.
d. What is encapsulation?
Ans: Encapsulation is the process of binding data members and methods of a program together to do a specific job, without revealing unnecessary details.
e. What is data hiding?
Ans: Data hiding in encapsulation is the process of hiding unwanted data, such as restricting access to any member of an object.
f. What is polymorphism?
Ans: Poly means many and morphs mean form. So polymorphism means one name multiple forms. Polymorphism refers to a single function or multi-functioning operator performing in different ways.
g. Name four object oriented programming languages.
Ans: Java, C++, C#, Python.
h. Name two procedure oriented programming languages.
Ans: C, FORTRAN.
i. Name the first object oriented language
J. What is abstraction?
Ans: In abstraction, it displays only the important information by hiding the implementation part. Abstraction is the most important features of OOP. It allows us to show only essential data or information to the user and hides the implementation details from the user.
II. LONG ANSWER QUESTIONS:
a. Mention four characteristics of procedure oriented programming.
Ans: CHARACTERISTICS OF OOP:-
i. Emphasis is on data rather than procedure.
ii. Programs are divided into objects.
iii. Data structures are designed such that they characterize the objects.
iv. Functions that operate on data of an object are tied together in the data structure.
b. Mention two advantages and two disadvantages of procedure oriented programming
Ans: Following are the advantages and disadvantages of POP:
i) The procedural programming languages are relatively much easier to learn as first programming language for beginners.
ii) The straight forward program organization makes it ideal choice as a general purpose language.
i) The procedural programming is not suitable for large and complex software.
ii) It is difficult to represent the real world objects.
c. Explain four features of OOP
Ans: The four features of object oriented programming are-encapsulation, abstraction, inheritance and polymorphism.
Encapsulation – It is the process of binding data members and methods of a program together to do a specific job, without revealing unnecessary details.
In abstraction, it displays only the important information by hiding the implementation part. Abstraction is the most important features of OOP. It allows us to show only essential data or information to the user and hides the implementation details from the user.
Inheritance is the process of acquiring or inheriting properties of one class to the other. By using inheritance, the programmer makes use of the existing code already previously written. The inheritance helps to reduce the overall development time for the software development.
Poly means many and morphs mean form. So polymorphism means one name multiple forms. Polymorphism refers to a single function or multi-functioning operator performing in different ways.
d. List four advantages of OOP
Ans: FOUR ADVANTAGES OF OOP:-
a. OOP can support large scale and complex software development project.
b. OOP offers better data protection. In OOP, the data access permissions are tightly controlled.
c. It allows us the code re-usability.
d. Better representation of real world objects. The programmer can easily represent real world objects realistically into the program code.
e. Differentiate between procedure oriented programming and object oriented programming.
|Procedural Programming||Object oriented programming|
|Program is divided into functions.||Program is divided into objects|
|Top-down approach.||Bottom-up approach.|
|It doesn’t use access specifier.||It uses access specifier.|
|Procedural programming does not have any proper way for hiding data so it is less secure.||Object oriented programming provides data hiding so it is more secure.|
|Inheritance is not allowed.||Inheritance property is used.|
|No data hiding.||Encapsulation is used to hide the data.|
|It is difficult to represent the real world objects||It is much easier to represent the real world objects in OOP.|
|Adding new data and functions is not easy.||Adding new data and function is easy.|
|Overloading is not possible.||Overloading is possible.|
|Function is more important than data.||Data is more important than function.|