Exam 1z0-808 All QuestionsBrowse all questions from this exam
Question 73

Which two are benefits of polymorphism? (Choose two.)

    Correct Answer: C, D

    Polymorphism allows objects to be treated as instances of their parent class rather than their actual class. This results in more dynamic code at runtime as the method to be invoked is determined at runtime rather than compile-time. Additionally, it creates more flexible and reusable code because the same method can operate on objects of different classes, provided they follow a common interface or inherit from a common superclass.

Discussion
winfred_luOptions: CD

C: Method overriding is runtime polymorphism. The process in which call to the overridden method is resolved at runtime, also known as dynamic method dispatch. D: Method overriding works together with inheritance to enable code reuse of existing classes without the need for re-compilation.

dsmsOptions: BD

B: More flexible and reusable code: Polymorphism makes code more flexible and reusable because it allows objects of different classes to be treated as if they are objects of the same class. This means that if you have a method that works with an object of a particular class, you can also use that method with objects of other classes that inherit from that class or implement the same interface. This can save a lot of time and effort because you don't have to write a separate method for each class.

dsms

C: More dynamic code at runtime: Polymorphism makes code more dynamic at runtime because it allows the actual method that gets called to be determined at runtime rather than at compile time. This means that if you have a method that is overridden in a subclass, the version of the method that gets called will depend on the type of the object at runtime. This can lead to more flexible and powerful code that can adapt to different situations.

dsms

made a misprint. I mean D , not C

anmoldev2java

why cant C

iSnoverOptions: BD

The correct answer is BD, not much to explain. Polymorphism makes the code more efficient in the sense that an object accesses features of the parent or child class and it also makes the code more flexible.

netoplaxeOptions: CD

CD is the correct Answer. In Enthuware Exam-Pool you will find the same question and the correct answer which is CD