Suppose that a function dynamically allocates a block of memory with a local pointer variable p pointing to the allocated block. Suppose further that there are no other pointers referencing that block of memory, and the function returns without doing a delete on p. Then
A) the pointer p becomes a dangling pointer.
B) the compiler will automatically deallocate the memory pointed to by p.
C) the program will suffer from memory leaks.
D) the returning function will throw the bad_alloc exception.
E) None of the above
Correct Answer:
Verified
Q16: Which of the following statements is not
Q28: The statement cout << &num1; will output
A)
Q29: The expression s->m has the same meaning
Q30: C++ does not perform array bounds checking.
Q31: When the _ is placed in front
Q32: If arr is an array identifier and
Q34: The statement int *ptr; means
A) the variable
Q35: The set of operations supported by the
Q37: You may use the type pointer to
Q38: To dereference a structure pointer and simultaneously
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents