REVATURE PRACTICE SOLUTION TEST
2026 COMPLETE QUESTIONS AND
CORRECT ANSWERS GRADED A+
●● OOP Components.
Answer: Object
Classes
Inheritance
Polymorphism
Abstraction
Encapsulation
●● Object.
Answer: - Any entity that has state and behavior
- defined as an instance of a class
- contains an address and takes up some space in memory
- can communicate without knowing the details of each other's data or
code
●● Class.
Answer: - templates that are used to create objects, and to define object
data types and methods
,- Class doesn't consume any space
●● Object-Oriented vs. Procedure-Oriented.
Answer: - OOPs makes development and maintenance easier whereas in
a procedure-oriented programming language it is not easy to manage if
code grows as project size increases.
- OOPs provides data hiding whereas in a procedure-oriented
programming language a global data can be accessed from anywhere.
●● Constructor.
Answer: - a special type of method which is used to initialize the object
- called when an instance of the object is created, and memory is
allocated for the object
●● Rules on Creating a Constructor.
Answer: 1. Constructor name must be the same as its class name
2. A Constructor must have no explicit return type
3. A Java constructor cannot be abstract, static, final, and synchronized
●● Types of Constructors.
Answer: Default Constructor - default call to super()
Parameterized Constructor
,●● Constructor Overloading.
Answer: a technique of having more than one constructor with different
parameter lists
●● Constructor vs. Method: Constructor.
Answer: 1. A constructor is used to initialize the state of an object.
2. A constructor must not have a return type.
3. The constructor is invoked implicitly.
4. The Java compiler provides a default constructor if you don't have any
constructor in a class.
5. The constructor name must be same as the class name.
●● Constructor vs. Method: Method.
Answer: 1. A method is used to expose the behavior of an object.
2. A method must have a return type.
3. The method is invoked explicitly.
4. The method is not provided by the compiler in any case.
5. The method name may or may not be same as class name.
●● Inheritance.
Answer: - one object acquires all the properties and behaviors of a
parent object
, - create new classes that are built upon existing classes (reuse methods
and fields of parent class)
- IS-A relationship (parent-child)
●● Advantages of Inheritances.
Answer: - For Method Overriding (so runtime polymorphism can be
achieved).
- For Code Reusability.
●● Sub Class.
Answer: Subclass is a class which inherits the other class. It is also
called a derived class, extended class, or child class.
●● Super Class.
Answer: Superclass is the class from where a subclass inherits the
features. It is also called a base class or a parent class.
●● Reusability.
Answer: a mechanism which facilitates you to reuse the fields and
methods of the existing class when you create a new class. You can use
the same fields and methods already defined in the previous class.
●● Syntax for Inheritance.
Answer: class SubclassName extends SuperclassName {}
2026 COMPLETE QUESTIONS AND
CORRECT ANSWERS GRADED A+
●● OOP Components.
Answer: Object
Classes
Inheritance
Polymorphism
Abstraction
Encapsulation
●● Object.
Answer: - Any entity that has state and behavior
- defined as an instance of a class
- contains an address and takes up some space in memory
- can communicate without knowing the details of each other's data or
code
●● Class.
Answer: - templates that are used to create objects, and to define object
data types and methods
,- Class doesn't consume any space
●● Object-Oriented vs. Procedure-Oriented.
Answer: - OOPs makes development and maintenance easier whereas in
a procedure-oriented programming language it is not easy to manage if
code grows as project size increases.
- OOPs provides data hiding whereas in a procedure-oriented
programming language a global data can be accessed from anywhere.
●● Constructor.
Answer: - a special type of method which is used to initialize the object
- called when an instance of the object is created, and memory is
allocated for the object
●● Rules on Creating a Constructor.
Answer: 1. Constructor name must be the same as its class name
2. A Constructor must have no explicit return type
3. A Java constructor cannot be abstract, static, final, and synchronized
●● Types of Constructors.
Answer: Default Constructor - default call to super()
Parameterized Constructor
,●● Constructor Overloading.
Answer: a technique of having more than one constructor with different
parameter lists
●● Constructor vs. Method: Constructor.
Answer: 1. A constructor is used to initialize the state of an object.
2. A constructor must not have a return type.
3. The constructor is invoked implicitly.
4. The Java compiler provides a default constructor if you don't have any
constructor in a class.
5. The constructor name must be same as the class name.
●● Constructor vs. Method: Method.
Answer: 1. A method is used to expose the behavior of an object.
2. A method must have a return type.
3. The method is invoked explicitly.
4. The method is not provided by the compiler in any case.
5. The method name may or may not be same as class name.
●● Inheritance.
Answer: - one object acquires all the properties and behaviors of a
parent object
, - create new classes that are built upon existing classes (reuse methods
and fields of parent class)
- IS-A relationship (parent-child)
●● Advantages of Inheritances.
Answer: - For Method Overriding (so runtime polymorphism can be
achieved).
- For Code Reusability.
●● Sub Class.
Answer: Subclass is a class which inherits the other class. It is also
called a derived class, extended class, or child class.
●● Super Class.
Answer: Superclass is the class from where a subclass inherits the
features. It is also called a base class or a parent class.
●● Reusability.
Answer: a mechanism which facilitates you to reuse the fields and
methods of the existing class when you create a new class. You can use
the same fields and methods already defined in the previous class.
●● Syntax for Inheritance.
Answer: class SubclassName extends SuperclassName {}