MCQ – Java oops concept

(Last Updated On: March 13, 2019)
Q) Java object oriented programming concepts is/are
  1. Encapsulation
  2. Inheritance
  3. polymorphism
  4. All of the above.
View Answer
Answer: D

 

Q) Java does not support _______________?
  1. Inheritance
  2. Multiple inheritance for classes
  3. multiple inheritance of interfaces
  4. compile time polymorphism
View Answer
Answer: B
Java does not support multiple inheritance for classes but in java multiple inheritance behavior is implemented using interfaces.

Q) Runtime polymorphism feature in java is
  1. method overriding
  2. method overloading
  3. constructor overloading
  4. operator overloading
View Answer
Answer: A
Since in method overriding both the classes(base class and child class) have same method, compile doesn’t figure out which method to call at compile-time. In this case JVM(java virtual machine) decides which method to call at runtime that’s why it is known as runtime or dynamic polymorphism.

Q) Encapsulation concept in java is
  1. Hiding complexity
  2. method hiding
  3. Hiding constructor
  4. None
View Answer
Answer: A