Certified Associate in Python Programming (PCAP-31-03) — Question 53
What is true about Python class constructors? (Choose two.)
Answer options
- A. the constructor's first parameter must always be named self
- B. there can be only one constructor in a Python class
- C. the constructor cannot be invoked directly under any circumstances
- D. the constructor cannot return a result other than None
Correct answer: A, B
Explanation
Option A is correct because the first parameter of a constructor in Python is always named 'self', which refers to the instance of the class. Option B is also correct since Python allows only one constructor method (__init__) per class, as it does not support method overloading like some other languages. Options C and D are incorrect because constructors can be invoked directly in certain contexts and they do not have to return None, although returning a value other than None is not typical practice.