0% found this document useful (0 votes)
30 views

Class, Object in Java

The document discusses the key concepts of object-oriented programming including classes, objects, encapsulation, inheritance, and polymorphism. It compares procedural programming and object-oriented programming, outlines their characteristics, limitations, and provides examples. The relationships between classes and objects are explained. The four pillars of OOP - abstraction, encapsulation, inheritance, and polymorphism are defined along with other important OOP concepts like data hiding.

Uploaded by

ROHIT DSUZA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Class, Object in Java

The document discusses the key concepts of object-oriented programming including classes, objects, encapsulation, inheritance, and polymorphism. It compares procedural programming and object-oriented programming, outlines their characteristics, limitations, and provides examples. The relationships between classes and objects are explained. The four pillars of OOP - abstraction, encapsulation, inheritance, and polymorphism are defined along with other important OOP concepts like data hiding.

Uploaded by

ROHIT DSUZA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

CHAPTER 1 – INTRODUCTION TO OBJECT ORIENTED

PROGRAMMING CONCEPTS

1. Define the following –


a. Programmer : A programmer is a person who writes a computer program.
b. Programming : Programming is the process of writing a computer program
c. Programming language : Programming language is a set of commands and syntax used to
create computer program.

2. What is programming paradigm ? Name 2 types of programming paradigm.

A programming paradigm is an approach or style of programming that is used to classify


programming language.
2 types of programming paradigm are –
1. Procedure Oriented Programming (POP)
2. Object Oriented Programming (OOP)

3. What is Procedure Oriented Programming (POP) ? Name the approach it follows. Give examples.

A programming paradigm where a complex programming problem is solved by dividing it into


smaller problems using functions or procedures is known as Procedure Oriented Programming
(POP).
It follows top-down approach.
Examples – FORTRAN,BASIC,COBOL, C.

4. What is Object Oriented Programming (OOP) ? Name the approach it follows. Give examples.

A programming paradigm in which data and functions are bind together in a single unit called
class is known as Object Oriented Programming (OOP).
It follows bottom-up approach.
Examples – C++, C#, JAVA.

5. Mention 4 characteristics of Procedure Oriented Programming (POP).

4 characteristics of Procedure Oriented Programming (POP) are –


1. Procedure Oriented Programming (POP) follows a top-down approach.
2. The program is divided into smaller parts called procedures or functions, where each
function performs a specific task.
3. The data and functions are detached from each other.
4. The data can move freely in the program.
6. Mention 4 characteristics of Object Oriented Programming (OOP).

4 characteristics of Object Oriented Programming (OOP) are –


1. Object Oriented Programming (OOP) follows a bottom-up approach.
2. The program result from Object Oriented Programming (OOP) is a collection of objects
where each object has its own data and a set of operations.
3. The data and functions are bind together in single unit called class.
4. Object Oriented Programming (OOP) restricts the free movement of data and the functions
that operate on it.

7. Mention 4 limitations of Procedure Oriented Programming (POP).

4 limitations of Procedure Oriented Programming (POP) are –


1. Procedure Oriented Programming (POP) mainly focuses on procedures or functions rather
than data.
2. The data and functions are separate from each other.
3. Data are freely moving and is shared among various functions hence it is difficult to fix
issues.
4. Limited and difficult code to reuse the code.

8. Mention 4 limitations of Object Oriented Programming (OOP).

4 limitations of Object Oriented Programming (OOP) are –


1. The size of program created using this approach is larger as compared to Procedure
Oriented Programming (POP).
2. Software developed using this approach require good amount of pre-work and planning.
3. Object Oriented Programming (OOP) code is difficult to understand if it does not have
proper documentation.
4. In certain cases, these programs can consume a lot of memory.

9. What is object? Explain with example.

An object is an identifiable entity with some attributes and behaviour.


For example, if car is an object, then color, model, engine is attributes and speed, breaking,
parking are its behaviour.

10. What is class? Explain with example.

A class is used to describe a group of objects that have some common attributes and behaviour.
For example, lion, cows, dogs all have common attributes like eyes, legs, tails and common
behaviour like eat, sleep, walk. Hence they all can be grouped under single unit called known as
Animals.
11. What is the relationship between class and object?
OR
Explain the phrase “Everything is an object”.

A class can be thought of as a template or blueprint for multiple objects with similar features. An
object belonging to a particular class is known as instance of a class. For example, we can say
that Mango is an instance of the Fruit class.

12. Name the 4 principals of Object Oriented Programming (OOP).

4 principals of Object Oriented Programming (OOP) are –


• Abstraction
• Encapsulation
• Inheritance
• Polymorphism

13. What is data abstraction?

Abstraction refers to the act of representing essential features without including background details.
The user interacts with only the essential features and rest of the complex parts are hidden from the
user.

14. What is encapsulation?

Encapsulation is the mechanism that binds the data and functions together in a single unit called
class and hence keep them safe from outside world by preventing unauthorized access or misuse.

15. What is inheritance?

Inheritance is a powerful mechanism by which a class acquires the properties of another class. It
allows a class to inherit the attributes and behavior of its parent class.

16. What is polymorphism?

Polymorphism is the ability of a function or an object to take multiple forms. In OOP, polymorphism
allows different funtions to exhibit different behavior in different instances.

17. What is data hiding?

Using abstraction, the objects expose only the essential features to the outside world and hide the
rest of the details. The outside world sees a simplified version of the actual object. This is called data
hiding.
18. State 4 differences between Procedure Oriented Programming (POP) and Object Oriented
Programming (OOP).

Procedure Oriented Programming (POP) Object Oriented Programming (OOP)

1. Follows top-down approach. 1. Follows bottom-up approach.


2. Instruction/Procedure oriented in nature. 2. Object Oriented in nature.

3. Data and functions are separate. 3. Data and functions are bind in a single entity.
4. Example – C, COBOL, PASCAL 4. Example - Java, C++, C#

19. What do you mean by a sub class and super class?

Classes can be derived from other classes using the concept of inheritance. The class that is derived
from another class is called subclass. The class from which its derived is called superclass.

You might also like