What does the "open-closed principle" state?
A) Software entities should be open for modification.
B) Software entities should be closed for modification but open for extension.
C) Classes should be public.
D) Interfaces should not be implemented.
Answer: B) Software entities should be closed for modification but open for extension.
Explanation: The open-closed principle (OCP) is one of the SOLID principles of object-oriented design. It states that software entities (like classes, modules, or functions) should be closed for modification but open for extension. This means that existing code should not be changed when new functionality is added; instead, new code should be written to extend existing behavior.