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.
If the sum of n numbers in the GP 3, 6, 12, ... is 765 then n is?
The 11th term of an AP is 80 less than the first term. If the second term is 88, find the third term.
The current age of Anupama is 25% greater than Chinky's age. Four years ago, the ages of Beena and Chinky were in the ratio of 4:...
The sum of three numbers is 226. If the ratio of the first to the second is 4:5 and that of second to the third is 7: 10 then the second number is?
what is the mean of given numbers 25, 15, 12, 23, 15,
Find the mode of the data: 2, 2, 3, 5, 15, 15, 15, 20, 21, 23, 25, 15, 23, 25.
What is least number which when successively divided by 6, 4 and 4 leaves a remainder 5, 3 and 3 respectively?
The expenditure-to-savings ratio of an individual 'P' is 5:4. If the person's income rises by 25% and their savings increase by 3...
The mean of a distribution is 25 and the standard deviation is 5. What is the value of coefficient variation?
The interest earned when a sum is invested at simple interest of 25% p.a., for 3 years, is Rs. 1875. What will be the total amount received after 2 year...