0% found this document useful (0 votes)
5 views2 pages

Complete_Questions......

The document provides a comprehensive overview of Object-Oriented Programming (OOP) principles, features of Java, and types of inheritance. Key OOP principles include Encapsulation, Inheritance, Polymorphism, and Abstraction, with examples illustrating each concept. Additionally, it describes various inheritance types in Java, such as Single, Multilevel, Hierarchical, and Multiple Inheritance through interfaces.

Uploaded by

karth2054
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)
5 views2 pages

Complete_Questions......

The document provides a comprehensive overview of Object-Oriented Programming (OOP) principles, features of Java, and types of inheritance. Key OOP principles include Encapsulation, Inheritance, Polymorphism, and Abstraction, with examples illustrating each concept. Additionally, it describes various inheritance types in Java, such as Single, Multilevel, Hierarchical, and Multiple Inheritance through interfaces.

Uploaded by

karth2054
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/ 2

Complete Set of Questions & Answers

2 MARKS QUESTIONS

Q: What is Object-Oriented Programming?


A: Object-Oriented Programming (OOP) is a programming paradigm based on objects, which
contain data (fields/attributes) and code (methods/functions). OOP ensures modular, reusable, and
scalable code. The four key principles are Encapsulation, Inheritance, Polymorphism, and
Abstraction.

Q: Write two features of Java.


A: - Platform Independence: Java code compiles into bytecode, which can run on any platform using
the Java Virtual Machine (JVM).
- Object-Oriented: Java follows OOP principles, making it modular and easy to manage.

Q: Define:
A: Class: A blueprint for creating objects, defining fields and methods.
Object: An instance of a class containing state and behavior.
Inheritance: A mechanism allowing one class to acquire properties and behavior of another class.

5 MARKS QUESTIONS

Q: Explain the key principles of OOP.


A: The four main principles of OOP are:
1. Encapsulation: Groups data and methods, restricting direct access to some components.
2. Inheritance: Allows one class to inherit attributes and methods from another, promoting code
reuse.
3. Polymorphism: Enables a method to perform different tasks based on the object calling it.
4. Abstraction: Hides implementation details and exposes only relevant functionalities.

Q: Describe the different types of inheritance in Java.


A: Java supports:
- Single Inheritance: A class inherits from one superclass.
- Multilevel Inheritance: A class inherits from another derived class.
- Hierarchical Inheritance: Multiple classes inherit from a single parent.
- Multiple Inheritance (via Interfaces): Java allows multiple inheritance using interfaces.

8 MARKS QUESTIONS

Q: Explain the key principles of OOP with examples.


A: The four main principles of OOP are:
1. Encapsulation: Groups data and methods, restricting direct access to some components.
Example: Private variables accessed through getters and setters.
2. Inheritance: Allows one class to inherit attributes and methods from another, promoting code
reuse. Example: A Car class inheriting from a Vehicle class.
3. Polymorphism: Enables a method to perform different tasks based on the object calling it.
Example: Method overloading and overriding.
4. Abstraction: Hides implementation details and exposes only relevant functionalities. Example:
Using abstract classes and interfaces.

Q: Describe different types of inheritance in Java with examples.


A: Java supports:
- Single Inheritance: A class inherits from one superclass. Example: class Dog extends Animal.
- Multilevel Inheritance: A class inherits from another derived class. Example: class Puppy extends
Dog.
- Hierarchical Inheritance: Multiple classes inherit from a single parent. Example: class Car and Bike
extend Vehicle.
- Multiple Inheritance (via Interfaces): Java allows multiple inheritance using interfaces. Example:
class Car implements Engine, Wheels.

You might also like