The question is poor and illustrates only a superficial understanding of software design, design patterns in general, and the specific ones highlighted as possible answers.
The question implies and assumes that only one pattern could be used to implement the requirement: "ensure that only the legal combinations could be sold."
The creational patterns are for creating objects, not sellling them. So, the term "sold" is not appropriate and indicates something. Either way, A and D can certainly be used. And it is possible that they could be implemented using a Builder implementation or Prototype implementation as well. And, if a factory is not implemented, the the Builder pattern could certainly be implemented to satisfy the requirement.
"Correct" or "Incorrect" type answers for software design topics typically fail and are often misleading and assume false information. Design is subjective with many possibilities, and is very different than source code statements.
I agree with Jimmy. This can be done with either pattern. I think some key words in the question are "legal combination". This may map to "family of related objects" from the Abstract factory pattern. I may be wrong but that's how I interpreted it.
But I do agree Builder pattern makes sense, since this requires to follow a algorithm to create a common production in multiple steps.
Joined: Apr 16, 2008
An implementation of the Factory Method or Abstract Factory can include a implementation of the Builder pattern. They are all Creational patterns and are complimentary.
A factory can also be passed a Prototype instance to help it create the correct object. The only pattern on the answer options which should never be used to do anything is the Simpleton. A,B,C, and D is the correct answer. But I doubt the test author could understand that