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


    Question

    What is Encapsulation in

    OOP?
    A The ability of an object to take on many forms. Correct Answer Incorrect Answer
    B The process of creating new classes from existing ones. Correct Answer Incorrect Answer
    C Bundling data and methods that operate on the data within a single unit (class), and restricting direct access to some of the object's components. Correct Answer Incorrect Answer
    D Hiding the implementation details from the user. Correct Answer Incorrect Answer
    E Defining a contract for classes to implement. Correct Answer Incorrect Answer

    Solution

    Encapsulation is the mechanism of wrapping the data (variables) and code (methods) together as a single unit. It also involves data hiding, where the internal state of an object is protected from direct external access, typically through access modifiers.

    Practice Next
    ask-question