Question
Which of the following best represents the concept of
polymorphism in Object-Oriented Programming?ÂSolution
Polymorphism in Object-Oriented Programming (OOP) allows methods to be defined in different forms across different derived classes, typically by overriding or overloading methods. This enables a single method to exhibit multiple behaviors, depending on the object that invokes it. For example, a base class method draw() in a shape class could be defined differently in derived classes like Circle and Rectangle, where each class implements its unique version of draw(). This approach promotes flexibility, reduces code duplication, and allows developers to manage code easily as new classes are added, embodying one of OOP’s core principles. Polymorphism is critical for creating extensible and maintainable code, as it enables a system to process objects of various types through a common interface. Option A (Encapsulation) - Encapsulation is the OOP principle of hiding internal details and exposing only necessary features through a class interface, which differs from polymorphism’s focus on varied behaviors. Option C (Aggregation) - Aggregation describes a "has-a" relationship between classes, where one class contains references to another, unrelated to polymorphic behavior. Option D (Encapsulation) - This concept of grouping related fields and methods within a class refers to encapsulation, not polymorphism. Option E (Unrelated Classes) - Allowing objects of unrelated classes to connect without a common functionality does not represent polymorphism, which requires shared interfaces or inheritance.
What is the square root of 5476?
Find the Square root of √14641
What is the smallest natural number that should be added to 1030 so that the square root of the sum is a natural number?
If the average of two numbers is 13 and the square root of their product is 12, then the difference between the numbers is:
Solve the following :-
Two times a number, added to the square of that number, gives 3. What could be the possible answer for this number?
Find the Square root of √1681
Find the square of 572
Find the square root of 0.0324.
A horse is tethered to a peg fixed at one corner of a rectangular grass field measuring 45 metres in length and 25 metre...