MCQ – Java Polymorphism

(Last Updated On: March 13, 2019)


Q) Which is runtime polymorphism in java oops?

  1. Method overloading
  2. Method overriding
  3. Constructor overloading
  4. None
View Answer
Answer: B
Explanation: Method overriding is the run time polymorphism as the methods call get resolved at run time. Compiler will not be able to decide which object’s method to call at compile time.
Recommend reading about run time polymorphism for better understanding. It has been described nicely with example.

Q)In below java program, the class Circle implements the interface Shape. Which polymorphism concept has been applied here?

  1. Method overloading
  2. Method overriding
  3. No polymorphism
View Answer
Answer: B
Explanation: A class implements an interface in java and override all the methods resides in the interface. Note that interface does not have implemented method and whoever class implements it, class must override and give its own definition

You can read interface with example in java programming in detail.

Q) Which polymorphism feature is related to parent and child class relationship in java.

  1. Method overloading
  2. Constructor overloading
  3. Method overriding
  4. Both A and B
  5. Bothe A and C
View Answer
Answer: C
Explanation: Method overriding feature is always used in parent child relationship in inheritance in java. Whatever, the relationship is base class to derived class or interface to class.

Q) Which method of base class X, the derived class Y cannon override?


  1. m1()
  2. m2()
  3. Both m1() and m2() can override
  4. No method can override
View Answer
Answer: A

Explanation: Derive class Y cannot Override base class method m1() as this method is declared as final.
final method in java cannot be overridden by any derived class.

Q) Which are true statements regarding polymorphism concept?

  1. Method overloading is used in same class only
  2. Constructor overloading is used in same class only
  3. Method overriding is used in base class and derived class
  4. All
View Answer
Answer: DExplanation:Method overloading – multiple methods with same name and different number of arguments or data types are written in the same class only.Similar is with constructor overloading. By the way, constructor of a class in java programming cannot be written in other classes.Method overriding is used in inheritance.