Select the true statements about deep copy and shallow copy of objects. (select three)

Questions & AnswersCategory: PythonSelect the true statements about deep copy and shallow copy of objects. (select three)
Lokesh Kumar Staff asked 2 years ago

Select the true statements about deep copy and shallow copy of objects. (select three)
a. Any changes made to the shallow copy of an object are not reflected in the original object.
b. A shallow copy is where you construct a new object and then fill it with references to the child objects found in the original. This means that any changes made to the copy of the object reflect the original object.
c. A deep copy is where you construct a new object and then fill it with references to the child objects found in the original. This means that any changes made to the copy of the object reflect the original object.
d. The difference between shallow and deep copying only applies to complex objects (objects that contain other objects, such as lists or class instances).
e. Deep copy constructs a new object and then recursively fills it with copies of the child objects found in the original. Any changes made to the copy of an object are not reflected in the original object.

1 Answers
Lokesh Kumar Staff answered 2 years ago

b. A shallow copy is where you construct a new object and then fill it with references to the child objects found in the original. This means that any changes made to the copy of the object reflect the original object.
d. The difference between shallow and deep copying only applies to complex objects (objects that contain other objects, such as lists or class instances).
e. Deep copy constructs a new object and then recursively fills it with copies of the child objects found in the original. Any changes made to the copy of an object are not reflected in the original object.