In C++, new and delete are used for:
-
A
type casting between related classes
-
B
dynamic allocation and release of objects
Correct answer
-
C
exception handling during program run time
-
D
reading and writing files on a disk
Correct answer
B. dynamic allocation and release of objects
12 views
Explanation
new allocates memory on the free store and calls the constructor; delete calls the destructor and releases the memory.
Reference
Asked in: NTS, PPSC IT, Campus Interviews
Doubts & discussion
Not sure why the answer is B? Ask here and get an explanation.
Ask a doubt about this MCQ