Question
Which of the following best illustrates the concept of
polymorphism in Object-Oriented Programming (OOP)?Solution
Polymorphism in OOP refers to the ability of a function, method, or object to take on multiple forms. This characteristic allows developers to design interfaces or methods that can perform different tasks based on context. 1. Method Overloading: One of the primary examples of polymorphism is method overloading, where multiple methods share the same name but differ in argument types or counts. 2. Dynamic Behavior: Polymorphism also enables dynamic method invocation at runtime, allowing a subclass to provide a specific implementation for a method defined in its superclass. 3. Extensibility: By allowing objects to process different behaviors through a unified interface, polymorphism enhances code flexibility and scalability. Why Other Options Are Incorrect: • B) A class inheriting properties: This describes inheritance, not polymorphism. • C) Combining multiple objects: This relates to composition, which involves creating a complex object from simpler ones. • D) Restricting access: This refers to encapsulation, which controls data accessibility within a class. • E) Relationships between objects: This describes association or aggregation, not polymorphism.
Consider the following statements:
(1) Article 21 talks about the protection of life and personal liberty.
(2) Article 21 is a part of t...
Who among the following won the prestigious Sir Richard Hadlee Medal in the New Zealand Cricket Award 2020?
The following two (2) items consist of two statements, Statement I and Statement II. Examine these two statements carefully and select the correct answ...
They are high-profile institutional investors that are allotted shares before the subscription opens for retail and other investors, and have to commit...
What is the average of first 21 multiples of 2.1?
Consider the following statements: India had plan holiday during 1966-69 due to
1. Indo-Pakistan conflict in 1965.
2. Severe drought fo...
How many numbers in the range from 100 to 800 are divisible by 8, 12, and 16?
Which of the following is an example of a cash outflow from operating activities?
Consider the following statements regarding National Child Labour Project Scheme (NCLP Scheme):Â
1. NCLPS is a Secondary sector scheme where fun...
Which one of the following elements is not naturally found in human beings?