menu

Polymorphism in Java

Polymorphism in Java - Important Points


21. Which of the following is a benefit of polymorphism in Java?

A. Code reusability

B. Improved performance

C. Strong typing

D. None of the above

Discuss Work Space

Answer: option a

Explanation:

Polymorphism allows you to reuse code by creating methods that can work with objects of multiple types. This improves code reusability and reduces code duplication.

22. Which of the following is an example of dynamic polymorphism?

A. Method overloading

B. Method overriding

C. Operator overloading

D. None of the above

Discuss Work Space

Answer: option b

Explanation:

Dynamic polymorphism is achieved through method overriding, where a subclass provides its own implementation of a method that is already defined in its parent class.

23. Which keyword is used to implement method overriding in Java?

A. super

B. this

C. override

D. None of the above

Discuss Work Space

Answer: option c

Explanation:

The @Override annotation is used to indicate that a method in a subclass is intended to override a method with the same name and signature in its parent class.

24. Which of the following is an example of a compile-time polymorphism?

A. Method overloading

B. Method overriding

C. Operator overloading

D. None of the above

Discuss Work Space

Answer: option a

Explanation:

Compile-time polymorphism is achieved through method overloading, where multiple methods with the same name but different parameter lists are defined in a class.

25. Which of the following is true about static methods and polymorphism?

A. Static methods can be overridden in Java

B. Static methods can be overloaded in Java

C. Static methods can participate in polymorphism in Java

D. None of the above

Discuss Work Space

Answer: option d

Explanation:

Static methods cannot be overridden in Java, and they are not involved in polymorphism. However, they can be overloaded.


Subscribe for Latest Career Trends
Subscribe Now
Use AI and ChatGPT for Career Guidance

Unlock Your Future

Join Now
Worried for Placements in 2024?

Join FAST TRACK Course

Join Now
Supercharge Your SUCCESS

Join All in One Placement Mock Tests-2024

Join Now