1.

Which of the following is the most suitable definition for encapsulation?(a) Ability of a class to derive members of another class as a part of its own definition(b) Means of bundling instance variables and methods in order to restrict access to certain class members(c) Focuses on variables and passing of variables to functions(d) Allows for implementation of elegant software that is well designed and easily modifiedThe question was asked in a job interview.I would like to ask this question from Encapsulation in section Classes and Objects, Inheritance, Polymorphism, Encapsulation and Exception Handling of Python

Answer»

The correct CHOICE is (b) Means of bundling instance VARIABLES and methods in order to restrict access to certain class MEMBERS

To EXPLAIN: The values assigned by the constructor to the class members is used to create the object.



Discussion

No Comment Found

Related InterviewSolutions