Important Java Mcq 1

Which of the following best describes polymorphism?

a) Ability of a class to derive members of another class as a part of its own definition

b) Means of bundling instance variables and methods in order to restrict access to certain class members

c) Focuses on variables and passing of variables to functions

d) Allows for objects of different types and behavior to be treated as the same general type

Answer:

d) Allows for objects of different types and behavior to be treated as the same general type

Explanation:

Polymorphism is a feature of object-oriented programming languages. It allows for the implementation of elegant software that is well designed and easily modified. Allows us to perform a single action in different ways. In other words, polymorphism allows you to define one interface and have multiple implementations.

Related MCQs

A java exception is an instance of

a. RuntimeException b. Exception c. Error d. Throwable e. NumberFormatException Answer: d. Throwable Explanation: Every exception is represented by an instance of the class Throwable.

Object-oriented inheritance models the

a. “is a kind of” relationship b. “has a” relationship c. “want to be” relationship d. “contains” of relationship Answer: a. “is a kind of”

Aniket Malik

Aniket Malik

CERTIFIED TUTOR/TRAINER WITH 300+ REVIEWS

Facing difficulty with

this concept?