Certified Professional in Python Programming (PCPP-32-101) — Question 23
What is a method?
Answer options
- A. It is a function built into a class that is executed on behalf of the class or an object.
- B. It is another name for a function - the only difference is that a method cannot be abstract.
- C. It is a callable variable that is specific only to objects.
- D. It is another name for a function - the only difference is that a method always returns a value.
Correct answer: A
Explanation
The correct answer, A, accurately describes a method as a function associated with a class or its instances. Options B, C, and D contain inaccuracies; B incorrectly states that methods cannot be abstract, C mischaracterizes methods as callable variables, and D wrongly claims that methods must always return a value.