MCQ – Java Polymorphism

(Last Updated On: March 13, 2019)

ULTIMATE MCQs – Multiple Choice Questions on Porlymorphism in java oops concept with Answer and Explanation to polish your concepts and help in written test in job interviews.

MCQs on Polymorphism in Java

Q) What concepts come under Polymorphism in java?

  1. Method overloading
  2. Constructor overloading
  3. Method overriding
  4. All the above
View Answer
Answer: D

Explanation: All mentioned features come under polymorphism in java oop.


Q) Which polymorphism behavior do you see in below class?

 

  1. Method overloading
  2. Constructor overloading
  3. Method overriding
  4. Run time polymorphism
View Answer
Answer: A

Explanation:
Method with same name with different number of arguments or same number of arguments with different data types is method overloading in java programming.


 

Q) Which polymorphism concept is applied to inheritance relationship in java programming?

  1. Method overloading
  2. Constructor overloading
  3. Method overriding
  4. None
View Answer
Answer: C

Explanation: Method overriding concept is related with inheritance in java. Both base and derived class contains methods with same name and signature. Read method overriding concept in java oop.


Q) Which feature comes under compile time polymorphism?

  1. Method overloading
  2. Constructor overloading
  3. Method overriding
  4. Both A and B
  5. Bothe A and C
View Answer
Answer: D
Method overloading, and constructor overloading come under compile time polymorphism. as compiler resolves overloaded method at compile time. in simple word, compiler can understand which overloaded method or constructor to call at compile time itself.
Read more on compile time and run time polymorphism in java with example.


 

Q) In below java code, whose “Car” will be called?

 

  1. Father’s Car
  2. Son’s Car
  3. There is an ambiguity, so no one Car
  4. Compiler Error
View Answer
Answer: B
Explanation: Since, both Father class and Son class contain car () method, So, on object creation of Son class, the son’s car() method will be called. Son has overrides car method of base class Father.
Note that if son does not contain car method, then father class car () method will be called.