Q: How does OOP enhance software scalability?
-
A
By reducing the number of classes.
-
B
By enabling code reuse through inheritance and polymorphism.
-
C
By eliminating the need for objects.
-
D
By making all methods private.
B
Answer:
B
Explanation:
Object-oriented programming enhances software scalability by enabling code reuse through inheritance and polymorphism. Inheritance allows new classes to be built on existing ones, inheriting their properties and methods, which reduces redundancy and facilitates the addition of new features without modifying existing code. Polymorphism allows methods to operate on objects of different classes through a common interface, making it easier to extend and modify the software as requirements change. These mechanisms promote modularity, where the software is composed of self-contained units (classes and objects) that can be developed, tested, and maintained independently. This modular approach makes it easier to scale the software, as new functionality can be added by creating new classes or extending existing ones without impacting other parts of the system. The encapsulation of data within objects also helps manage complexity, making the software more adaptable to growth and change.
Related Topic:
Share Above MCQ