Certified Associate in Python Programming (PCAP-31-03) — Question 34
What is true about Python class constructors? (Choose two.)
Answer options
- A. the constructor’s first parameter identifies an object currently being created
- B. super-class constructor is invoked implicitly during constructor execution
- C. the constructor can be invoked directly under strictly defined circumstances
- D. the constructor cannot use the default values of the parameters
Correct answer: A, B
Explanation
Option A is correct because the first parameter in a Python constructor, typically named 'self', refers to the instance being created. Option B is also correct as Python automatically calls the super-class constructor when a subclass constructor is invoked. Options C and D are incorrect; the constructor can be invoked directly, but under limited conditions, and it can indeed use default parameter values.