Python OOPs Concepts
Python OOPs Concepts - Important Points
6. | What is the purpose of encapsulation in object-oriented programming? |
---|
A. To hide implementation details
B. To define variables in a class
C. To create new objects
D. To call methods from other classes
View Answer Discuss Work SpaceAnswer: option a
Explanation:
7. | Which method is automatically called when an object is created in Python? |
---|
A. new
B. init
C. str
D. repr
View Answer Discuss Work SpaceAnswer: option b
Explanation:
8. | Which method is used to convert an object to a string in Python? |
---|
A. str
B. init
C. repr
D. new
View Answer Discuss Work SpaceAnswer: option a
Explanation:
9. | What is a constructor in Python? |
---|
A. A special method that is automatically called when an object is created
B. A method that is used to define a new object
C. A method that is used to create a new instance of a class
D. A method that is used to convert an object to a string
View Answer Discuss Work SpaceAnswer: option a
Explanation:
10. | Which keyword is used to refer to the current object in a class method in Python? |
---|
A. self
B. this
C. me
D. current
View Answer Discuss Work SpaceAnswer: option a
Explanation: