📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    Question

    Which of the following is NOT a direct benefit of

    encapsulation?
    A Flexibility: The internal implementation of a class can be changed without affecting external code. Correct Answer Incorrect Answer
    B Modularity: Classes become self-contained units. Correct Answer Incorrect Answer
    C Testability: Easier to test individual components in isolation. Correct Answer Incorrect Answer
    D Reduced code duplication across different classes. Correct Answer Incorrect Answer
    E Improved security: Prevents direct manipulation of internal state. Correct Answer Incorrect Answer

    Solution

    While encapsulation contributes to good design, reducing code duplication is more directly addressed by principles like inheritance or composition, and by using well-designed functions/methods. Encapsulation primarily focuses on data protection and controlled access within a single class.

    Practice Next
    ask-question