Multiple Choice
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
Correct Answer:
Verified
Q8: A pointer can be passed as an
Q9: With pointer variables you can access, but
Q10: A function may return a pointer, but
Q12: Which arithmetic operations can be performed on
Q13: The statement int *ptr; means<br>A) the variable
Q14: C++ does not perform array bounds checking.
Q15: An array name is a pointer constant
Q16: A statement that displays the address of
Q34: Which of the following statements is not
Q43: A pointer with the value 0 (zero)