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.
The Captain along with (A)/ his team has been (B)/ invited to the function (C)/ No Error (D)
A core network constitutes the network of rural roads in a State necessary to provide basic access for all habitations.
Thousands of scientific investigation have confirmed the association of smoking with the number of  diseases.Â
With the loss, India have put themselves in (1)/ a precarious position and need to win (2)/ at least 4 out of their next 6 Test matches to ensure (3)...
Identify the segment in the sentence that contains a grammatical error-
The taxi driver demanded fifty rupees to carry my luggages.
It farther stipulates that retail sales outlets be set up only in cities with a population of more than 10 lakh.
...In the question given below, a sentence is given, divided into parts. One of the parts may contain an error. Identify the part that contains the error,...
In each of the following questions, a sentence is given with four parts marked (a), (b), (c), and (d). One of these parts may contain an error. Identif...
I was offered a good position outside my hometown but I turned down the offer.
In each of the questions, a sentence has been divided into four parts, one of which may contain an error. Identify that fragment and mark it as your an...