Polymorphism Questions and Answers
100% Pass
Which of the following is true about method overriding?
✔✔A) It allows a subclass to provide a specific implementation of a method already defined in
the parent class
B) It allows multiple methods with the same name but different parameters
C) It is used to define private methods in subclasses
D) It must be done using a different method name
What happens if a subclass has a method with the same name as a method in the parent class but
a different return type?
✔✔A) It results in a compilation error if the return types are not covariant
B) It will always override the parent method
C) It creates a duplicate method in the subclass
D) It forces the parent method to be deleted
Which keyword is used to prevent a method from being overridden?
1
,A) static
✔✔B) final
C) override
D) protected
What is polymorphism in Java?
✔✔A) The ability of a method to take different forms depending on the object calling it
B) The ability to define multiple classes in a single file
C) A mechanism to hide variables from other classes
D) The process of inheriting multiple classes
Which of the following statements about method overloading is true?
A) Overloaded methods must have the same return type
✔✔B) Overloaded methods must have different parameter lists
C) Overloading means redefining a method in a subclass
D) Overloaded methods must be declared as final
Which method is inherited but cannot be overridden?
2
,✔✔A) final methods
B) static methods
C) private methods
D) abstract methods
Which of the following is an example of method overriding?
✔✔A) A subclass redefines a method from its superclass with the same signature
B) A method with the same name but different parameters in the same class
C) A method with the same name but different return types in two classes
D) A private method defined in a parent class and redefined in a subclass
Which of the following statements is true about constructors in inheritance?
✔✔A) A subclass constructor can call a superclass constructor using super()
B) A subclass must always define a constructor
C) A constructor can be inherited like a method
D) A subclass can override a constructor
What happens when a subclass object is created?
3
, A) Only the subclass constructor is called
B) Only the parent class constructor is called
✔✔C) The parent class constructor is called before the subclass constructor
D) The constructors are not called automatically
Which statement is true about abstract classes?
✔✔A) They can have both abstract and concrete methods
B) They must have at least one abstract method
C) They can be instantiated directly
D) They cannot have constructors
Which keyword is used to define an interface?
A) class
B) abstract
✔✔C) interface
D) extends
Which of the following statements is true about interfaces?
4