Certified Professional in Python Programming (PCPP-32-101) — Question 3
Which sentence about the @property decorator is false?
Answer options
- A. The @property decorator should be defined after the method that is responsible for setting an encapsulated attribute.
- B. The @property decorator designates a method which is responsible for returning an attribute value.
- C. The @property decorator marks the method whose name will be used as the name of the instance attribute.
- D. The @property decorator should be defined before the methods that are responsible for setting and deleting an encapsulated attribute.
Correct answer: A
Explanation
The correct answer is A because the @property decorator must be defined before the setter method, not after. Options B and C are true as they accurately describe the purpose of the @property decorator, and option D correctly states that the @property decorator should precede the setter and deleter methods.