Java Module 1 – 5 Mark Questions with Answers
1. Explain Object-Oriented Programming (OOP).
Object-Oriented Programming (OOP) is a programming approach that
uses objects to design software.
It models programs using real-world entities.
Key Points:
• Uses objects to represent real-world entities
• Combines data and methods
• Improves security and maintainability
Example:
Car, Student, Bank Account
2. Define Class with an example.
A class is a user-defined data type that acts as a blueprint for creating
objects.
Points:
• Contains data members and methods
• No memory allocated when class is created
• Objects are created from a class
Example:
Class: Car
3. Explain Object with an example.
An object is an instance of a class.
Points:
• Memory allocated when object is created
• Has identity, state, and behaviour
Example:
Dog is an object of Animal class
4. Explain Data Abstraction with example.
Abstraction means showing only essential details and hiding internal
implementation.
Points:
• Reduces complexity
• Improves security
Example:
Car driver uses accelerator without knowing engine working
5. Explain Encapsulation with example.
Encapsulation is wrapping data and methods into a single unit called
class.
Points:
• Data hiding
• Controlled access using methods
Example:
Bank account balance accessed using methods
6. Explain Inheritance and its advantages.
Inheritance allows a child class to acquire properties of parent class.
Advantages:
• Code reusability
• Easy maintenance
Example:
Vehicle → Car
7. Explain Polymorphism with example.
Polymorphism means one method having many forms.
Example:
A person is a father, employee, and customer
8. Explain Message Passing.
Message passing is communication between objects.
Example:
Customer → Order → Payment
9. Explain Modularity with example.
Modularity divides software into smaller modules.
Example:
House has electrical, plumbing modules
10. Explain Features of Object Orientation.
Features:
• Attributes
• State
• Identity
• Operations
• Behaviour
Example:
Car speed change affects behaviour