Search Tutorials


Java Method Overriding MCQ Questions And Answers | JavaInUse

Java Method Overriding MCQ Questions And Answers

Q. What is method overriding in Java?

A. Creating a new method with the same name in a subclass
B. Modifying an existing method in a superclass
C. Redefining a method in a subclass with the same signature as in the superclass
D. Hiding a method in a superclass

Q. In method overriding, can the return type of the overriding method be different from the return type of the overridden method?

A. Yes
B. No

Q. Which keyword is used to indicate that a method is being overridden in Java?

A. override
B. implements
C. extends
D. @Override

Q. Can the access modifier of an overriding method be more restrictive than the access modifier of the overridden method?

A. Yes
B. No

Q. When is method overriding used in Java?

A. When a subclass wants to hide a method from its superclass
B. When a subclass wants to extend the functionality of a method in its superclass
C. When a subclass wants to create a new method with the same name as a method in its superclass
D. When a subclass wants to call a method in its superclass

Q. Is it mandatory to use the @Override annotation when overriding a method?

A. Yes
B. No

Q. Can a subclass call the overridden method in Java?

A. Yes, by using the super keyword
B. No, it is not possible

Q. When is dynamic method dispatch used in Java?

A. When calling static methods in a class hierarchy
B. When calling final methods in a class hierarchy
C. When calling overridden methods through a superclass reference
D. When calling private methods in a class hierarchy

Q. What is the purpose of the super keyword in method overriding?

A. To override the superclass method
B. To hide the superclass method
C. To call the superclass method from the subclass
D. To access private methods of the superclass

Q. Can a subclass change the number of parameters of an overridden method in Java?

A. Yes
B. No