Question
Which of the following statements best describes polymorphism in object-oriented programming?
Solution
Polymorphism is a core concept of Object-Oriented Programming (OOP) that allows objects to respond to the same method call in different ways based on their type. This is particularly useful in scenarios where a parent class defines a method, and child classes override this method to provide specific behavior. Polymorphism can occur in two forms:
- Compile-Time Polymorphism (Static) : Achieved using method overloading.
- Run-Time Polymorphism (Dynamic) : Achieved using method overriding, where the method to be invoked is determined during runtime.
More Data Structure Questions
- In CI/CD pipelines, which of the following is NOT a key benefit of Continuous Integration (CI)?
- Which of the following best differentiates between server-based virtualization and hypervisor-based virtualization?
- Which protocol provides secure authentication by encrypting credentials before transmission and uses a challenge-response mechanism?
- Natural Language Processing (NLP) In the context of sentiment analysis, which of the following NLP techniques provides the most accurate classification of...
- Which data structure uses FILO (First In, Last Out) order?
- What is the primary disadvantage of using a singly linked list compared to an array for random access (e.g., accessing the 50th element)?
- What is the purpose of the keys() method in a dictionary?
- In a data warehousing environment, what is the primary purpose of an OLAP (Online Analytical Processing) cube?
- Which of the following allows dynamic memory allocation?
- Which SQL command is used to remove only specific rows from a table while preserving the structure and other rows?