Java Polymorphism MCQ Questions And Answers
Q. What is polymorphism in Java?
A. The ability of a subclass to inherit from multiple superclassesB. The ability of a subclass to override a superclass method
C. The ability of an object to take on multiple forms
D. The ability of an object to create multiple instances
Q. Which type of polymorphism is achieved through method overriding in Java?
A. Compile-time polymorphismB. Run-time polymorphism
C. Static polymorphism
D. Dynamic polymorphism
Q. What is method overloading in Java?
A. Creating multiple methods with the same name in a classB. Creating methods with different names in a class
C. Creating methods with the same name but different parameter lists in a class
D. Creating methods with the same name and same parameter lists in a class
Q. What is the superclass reference variable behavior in polymorphism?
A. It only refers to methods and fields of the superclassB. It can refer to methods and fields of both the superclass and the subclass
C. It can only refer to methods and fields of the subclass
D. It can only refer to static methods and fields
Q. Can an overridden method in Java have a different return type than the original method?
A. Yes, as long as the return type is a subclass of the original return typeB. Yes, as long as the return type is a superclass of the original return type
C. No, the return type must be the same as the original method
D. No, the return type is irrelevant in method overriding
Q. Which keyword is used to implement method overriding in Java?
A. finalB. abstract
C. override
D. super
Q. Which of the following is an example of compile-time polymorphism in Java?
A. Method overridingB. Method overloading
C. Dynamic method binding
D. Virtual function
Q. Can constructors be overloaded in Java?
A. Yes, constructors can be overloadedB. No, constructors cannot be overloaded
C. Constructors are automatically overloaded
D. Overloading applies only to methods, not constructors
Q. What is runtime polymorphism in Java?
A. The ability of a subclass to inherit from multiple superclassesB. The ability of a subclass to override a superclass method
C. The ability of an object to take on multiple forms
D. The ability of an object to create multiple instances
Q. Which example demonstrates method overloading in Java?
A. Having multiple methods with the same name in a classB. Having methods with different names in a class
C. Having methods with the same name but different parameter lists in a class
D. Having methods with the same name and same parameter lists in a class