MCQsSpecialized MCQsSmart PointersSmart Pointers 1).What is a smart pointer in C++?1) A pointer that manages dynamic memory2) A pointer that always points to a valid memory3) A pointer that can be dereferenced4) None of the above 2).Which type of smart pointer automatically deallocates memory when it goes out of scope?1) std::unique_ptr2) std::shared_ptr3) std::weak_ptr4) None of the above 3).What is the purpose of `std::shared_ptr`?1) To manage shared ownership of a dynamically allocated object2) To avoid memory leaks3) To allocate memory for variables4) None of the above 4).Which of the following smart pointers allows multiple pointers to share ownership of the same object?1) std::unique_ptr2) std::shared_ptr3) std::weak_ptr4) None of the above 5).What is the purpose of `std::weak_ptr`?1) To observe an object without affecting its reference count2) To provide exclusive ownership3) To manage multiple references4) None of the above 6).How does `std::unique_ptr` ensure there is only one owner of the object?1) By deleting the object when it goes out of scope2) By preventing copying of the pointer3) By allowing shared ownership4) None of the above 7).What happens if a `std::shared_ptr` is copied?1) It creates a new pointer pointing to the same object2) It deletes the object3) It throws an exception4) None of the above 8).Which of the following is true about `std::weak_ptr`?1) It does not contribute to reference counting2) It manages the memory of the object3) It is used for unique ownership4) None of the above 9).Can you assign a `std::unique_ptr` to a `std::shared_ptr`?1) Yes2) No3) It depends on the compiler4) None of the above 10).Which of the following smart pointers should be used when you want shared ownership and the possibility of multiple owners?1) std::unique_ptr2) std::shared_ptr3) std::weak_ptr4) None of the above