Prepare for the 241 Computer Science Certification Exam with comprehensive flashcards and multiple choice questions. Enhance knowledge with explanations and hints to excel in your test journey!

Multiple Choice

What describes the ability of a program to decide at runtime which subclass implementation to run?

Polymorphism describes the ability of a program to decide at runtime which subclass implementation to run. This happens through dynamic binding, where a call to a method is resolved to the subclass’s overridden version based on the actual object type at runtime. For example, if you have a base class with a method like makeSound, and Dog and Cat override it, a reference typed as the base class that points to a Dog will execute Dog’s makeSound, while pointing to a Cat will execute Cat’s makeSound. This runtime decision lets a single interface work consistently across different concrete types. Encapsulation is about bundling data and behavior and controlling access; abstraction focuses on exposing essential features while hiding details; inheritance is about defining a new class from an existing one.

Polymorphism describes the ability of a program to decide at runtime which subclass implementation to run. This happens through dynamic binding, where a call to a method is resolved to the subclass’s overridden version based on the actual object type at runtime. For example, if you have a base class with a method like makeSound, and Dog and Cat override it, a reference typed as the base class that points to a Dog will execute Dog’s makeSound, while pointing to a Cat will execute Cat’s makeSound. This runtime decision lets a single interface work consistently across different concrete types. Encapsulation is about bundling data and behavior and controlling access; abstraction focuses on exposing essential features while hiding details; inheritance is about defining a new class from an existing one.