Certified Professional in Python Programming (PCPP-32-101) — Question 34

Select the true statement about composition.

Answer options

Correct answer: B

Explanation

Option B is correct because composition indeed allows a class to act as a container for multiple classes, emphasizing a 'has a' relationship. Option A is incorrect because it describes modifications rather than the core purpose of composition. Option C misrepresents the primary goals of both concepts, and Option D is wrong as composition can coexist with inheritance; they are not mutually exclusive.