C. get_product method returns None instead of product
D. Product class is not defined, causing a NameError
Solution
Step 1: Check for class definitions used
The code uses 'Product' but does not define it anywhere, leading to NameError.
Step 2: Verify other method correctness
Methods build_part and get_product are syntactically correct assuming Product exists.
Final Answer:
Product class is not defined, causing a NameError -> Option D
Quick Check:
Undefined Product class = NameError [OK]
Hint: Undefined classes cause NameError, check all class definitions [OK]
Common Mistakes:
Assuming Product class exists by default
Blaming method logic instead of missing class
Ignoring error messages
5. In a large system, why is it beneficial to use creational patterns like Abstract Factory instead of directly instantiating objects with new or constructors?
hard
A. It allows the system to create families of related objects without specifying their concrete classes
B. It guarantees the system uses less memory by reusing objects automatically
C. It forces all objects to be created at compile time for faster execution
D. It removes the need for interfaces or abstract classes in the design