Skills101
← All practice quizzes

Quiz: Encapsulation and Abstraction

5 questionsNo time limitPass: 60%+10 XP on first pass

Encapsulation protects an object's data; abstraction hides complexity behind a simple interface. Learn both with pictures, Python and Java examples, and the interview answer.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    Making a field private and allowing changes only through a method that validates input is:

  2. Question 2

    An interface PaymentMethod with a method pay(), used without knowing how each payment works, is an example of:

  3. Question 3

    Which statement is correct?

  4. Question 4

    In Python, what happens when you try to create an object of a class with an @abstractmethod that isn't implemented?

  5. Question 5

    Why is a setter like setAge(int a) { age = a; } weak encapsulation?