Question: In the context of OOP, what is composition?

  1. Composition is the act of one object passing to another object an operation to be performed on behalf of the initial object.
  2. Composition is a part/hole relationship where an object is composed of one or more other objects, each of which is considered a part of the whole.
  3. Composition is a binding where the class/name association is not made until the object designated by the name is created at execution time
  4. Composition is a process of collecting classes that provide a set of services for a particular domain

Answer: The correct answer of the above question is Option B:Composition is a part/hole relationship where an object is composed of one or more other objects, each of which is considered a part of the whole.