250+ TOP MCQs on Concepts of OOPs and Answers

This set of Java Multiple Choice Questions & Answers (MCQs) on “Concepts of OOPs”.

But, i have been taking it for about three months. These drugs should not be Hinganghāt used during pregnancy and breastfeeding. The government also has been granted the right to issue a special license to grow medical marijuana in bolivia, the program has received a renewed commitment from the government to allow it to grow in the country.

1. Which of the following is not OOPS concept in Java?
a) Inheritance
b) Encapsulation
c) Polymorphism
d) Compilation

Answer: d
Clarification: There are 4 OOPS concepts in Java. Inheritance, Encapsulation, Polymorphism and Abstraction.

2. Which of the following is a type of polymorphism in Java?
a) Compile time polymorphism
b) Execution time polymorphism
c) Multiple polymorphism
d) Multilevel polymorphism

Answer: a
Clarification: There are two types of polymorphism in Java. Compile time polymorphism (overloading) and runtime polymorphism (overriding).

3. When does method overloading is determined?
a) At run time
b) At compile time
c) At coding time
d) At execution time

Answer: b
Clarification: Overloading is determined at compile time. Hence, it is also known as compile time polymorphism.

4. When Overloading does not occur?
a) More than one method with same name but different method signature and different number or type of parameters
b) More than one method with same name, same signature but different number of signature
c) More than one method with same name, same signature, same number of parameters but different type
d) More than one method with same name, same number of parameters and type but different signature

Answer: d
Clarification: Overloading occurs when more than one method with same name but different constructor and also when same signature but different number of parameters and/or parameter type.

5. Which concept of Java is a way of converting real world objects in terms of class?
a) Polymorphism
b) Encapsulation
c) Abstraction
d) Inheritance

Answer: c
Clarification: Abstraction is the concept of defining real world objects in terms of classes or interfaces.

6. Which concept of Java is achieved by combining methods and attribute into a class?
a) Encapsulation
b) Inheritance
c) Polymorphism
d) Abstraction

Answer: a
Clarification: Encapsulation is implemented by combining methods and attribute into a class. The class acts like a container of encapsulating properties.

7. What is it called if an object has its own lifecycle and there is no owner?
a) Aggregation
b) Composition
c) Encapsulation
d) Association

Answer: d
Clarification: It is a relationship where all objects have their own lifecycle and there is no owner. This occurs where many to many relationships are available, instead of one to one or one to many.

8. What is it called where child object gets killed if parent object is killed?
a) Aggregation
b) Composition
c) Encapsulation
d) Association

Answer: b
Clarification: Composition occurs when child object gets killed if parent object gets killed. Aggregation is also known as strong Aggregation.

9. What is it called where object has its own lifecycle and child object cannot belong to another parent object?
a) Aggregation
b) Composition
c) Encapsulation
d) Association

Answer: a
Clarification: Aggregation occurs when objects have their own life cycle and child object can associate with only one parent object.

10. Method overriding is combination of inheritance and polymorphism?
a) True
b) false

Answer: a
Clarification: In order for method overriding, method with same signature in both superclass and subclass is required with same signature. That satisfies both concepts inheritance and polymorphism.

Leave a Reply

Your email address will not be published. Required fields are marked *