⟩ Explain shallow and deep copy?
A shallow copy just copies the values of the data as they are. Even if there is a pointer that points to dynamically allocated memory, the pointer in the copy will point to the same dynamically allocated.
A shallow copy just copies the values of the data as they are. Even if there is a pointer that points to dynamically allocated memory, the pointer in the copy will point to the same dynamically allocated.
To ensure that every object in the array receives a destructor call, always delete memory allocated as an array with operator __________ . A. destructor B. delete C. delete[] D. kill[] E. free[]
Which of the following gets called when an object is being created? A. constructor B. virtual function C. destructor D. main
Which of the following statement is correct whenever an object goes out of scope? A. The default constructor of the object is called. B. The parameterized destructor is called. C. The default destructor of the object is called. D. None of the above.
Can a class have virtual destructor? A. Yes B. No
What happens when a class with parameterized constructors and having no default constructor is used in a program and we create an object that needs a zero-argument constructor? A. Compile-time error. B. Preprocessing error. C. Runtime error. D. Runtime exception.
A constructor that accepts __________ parameters is called the default constructor. A. one B. two C. no D. three
Destructor has the same name as the constructor and it is preceded by ______ . A. ! B. ? C. ~ D. $
Which of the following statement is correct? A. A constructor of a derived class can access any public and protected member of the base class. B. Constructor cannot be inherited but the derived class can call them. C. A constructor of a derived class cannot access any public and protected member of the base class. D. Both A and B.
Destructors __________ for automatic objects if the program terminates with a call to function exit or function abort. A. are called B. are inherited C. are not called D. are created
A class's __________ is called when an object is destroyed. A. constructor B. destructor C. assignment function D. copy constructor