1. What is this pointer?
    this pointer is accessible only inside the member functions of a class and points
    to the object which has called this member function.
  2. When is it necessary to use this pointer?
    Suppose we have two local variables with the same name as the data members’
    names. Suppose you want to assign the local variable value to the data
    members. In that case, you won’t be able to do until unless you use this pointer
    because the compiler won’t know that you are referring to the object’s data
    members unless you use this pointer.
  3. What is similar between deep copy and shallow copy?
    Both are used to copy data between objects.
  4. What is the difference between deep copy and shallow copy?
    Shallow Copy Deep Copy
    Shallow Copy stores the references of
    objects to the original memory
    address.
    Deep copy stores copies of the
    object’s value.
    Shallow Copy reflects changes made
    to the new/copied object in the
    original object.
    Deep copy doesn’t reflect changes
    made to the new/copied object in the
    original object.
    Shallow Copy stores the copy of the
    original object and points the
    references to the objects.
    Deep copy stores the copy of the
    original object and recursively copies
    the objects as well.
    Shallow copy is faster. Deep copy is comparatively slower.
    1