CHAPTER NO.1 OBJECT ORIENTED PROGRAMMING 1. What is OOP? Name any two OOP languages. Object Oriented Programming is an approach to standardize the program by creating portioned memory area for both data and function. It has been developed to increase the programmer s productivity and also to overcome the traditional approach of programming. In this system, the complete problem is decomposed into a number of entitles called objects. OOP languages are C++, Java, Small talk etc. 2. What are the features of OOP? It gives stress on the data items rather than function. It makes the complete program simpler by dividing in into number of objects. You can easily modify the data without any change in the function. 3. Name the Basic Elements (Principles) of OOP. Object, Classes, Data Abstraction, Encapsulation, Data Hiding, Inheritance, Polymorphism and Dynamic Binding. 4. Define the following with examples each. i) Object: It is a unique entity, which contains data and functions (characteristics and behavior) together in an OOP language. Eg. Book: - Characteristics Chapter, pages, topics. Behaviors Used to read, prepare notes. ii) Class: Class is a set of similar objects. Each object of a class possesses same attributes and common behavior defined within the same class. Eg. If we define a class Car , then different types of cars like Maruti, Santro, Indica, Nano are referred as objects under that category. iii) Data Abstraction: Abstraction refers to an act of representing essential features without including background details. In OOP, abstraction is the absolute property of a class. The class encapsulates the data items and the functions to promote abstraction. Eg. If we create an object Employee from a class name Salary and let name, designation and basic pay are the data members and Gross( ), PF( ) and Net ( ) are the methods, then the object Employee allows to access only essential features i.e. the methods, which in turn manage the data internally to perform the tasks. iv) Inheritance: It is the process by which objects of one class can link and share some common properties of the object from another class. Eg. Circle is a part of the class two-dimensional, which is in turn a part of the class Mensuration. v) Polymorphism: It is the process of using a function for more than one purpose. It allows the use of different internal structure of the object by keeping the same external interface. 1 | Page Important Notes for Java
Formatting page ...