Polymorphism is a fundamental concept in object-oriented programming (OOP) that allows objects of different classes to respond to the same message (method call or function call) in different ways. The word itself means "many forms". In the context of the question, it refers to how data or a message can be handled or processed.
Let's examine each option to see which one best defines polymorphism:
This description is incorrect. While polymorphism deals with messages, processing them all in strictly "one way" contradicts the core idea of "many forms". This sounds more like a single, specific operation.
This is the opposite of what polymorphism means. If a message can only be processed in one form, it lacks flexibility and the "many forms" aspect is missing.
This is the correct definition. Polymorphism allows the same message or data to be interpreted and acted upon in multiple different ways, depending on the context or the object receiving it. For example, a 'speak()' message might result in a 'bark' from a Dog object and a 'meow' from a Cat object.
This option is vague and incorrect. Polymorphism applies to defined messages and data types, not "undefined" ones. While it requires processing in at least one way, the key is the possibility of *multiple* ways.
Based on the analysis, polymorphism fundamentally means that a single interface (like a message or function name) can be used to represent different underlying forms or implementations. Option 3 accurately captures this essence.
| List I | List II |
| A. Overloading | I. Since function call is resolved during run time, the execution is Slow. |
| B. Early binding | II. Since function call is resolved during compilation time, the execution is much faster. |
| C. Overriding | III. Supports compile-time polymorphism. |
| D. Late Binding | IV. Supports run-time polymorphism. |
Which operator is used for dynamic memory allocation in C++?
| LIST-I (file mode parameters) | LIST-II (Meaning) |
|---|---|
| A. ios::ate | I. Go to end of file on opening |
| B. ios::in | II. Open fails if the file already exists. |
| C. ios::nocreate | III. Open file for reading only |
| D. ios::noreplace | IV. Open fails if the file does not exist. |