Q: Which paradigm emphasizes reusability and modularity through the use of classes and objects?
-
A
Procedural programming
-
B
Functional programming
-
C
Object-oriented programming
-
D
Assembly programming
C
Answer:
C
Explanation:
Object-oriented programming (OOP) emphasizes reusability and modularity through the use of classes and objects. In OOP, a class serves as a blueprint for creating objects, encapsulating data and methods that operate on that data. This modular approach allows developers to create reusable code components that can be easily maintained and extended. By defining classes, developers can create multiple objects with similar properties and behaviors, promoting code reuse and reducing redundancy. Inheritance, one of the core principles of OOP, further enhances reusability by allowing new classes to inherit properties and methods from existing ones, enabling the extension and modification of existing code without altering the original class. Polymorphism allows objects to be treated as instances of their parent class, providing flexibility in how methods are implemented and invoked. Encapsulation ensures that the internal state of objects is protected, enhancing the robustness and maintainability of the code. These principles collectively contribute to the creation of modular, reusable, and scalable software systems.
Related Topic:
Share Above MCQ