1.

If a pointer to an object is created and the object gets deleted without using the pointer then __________(a) It becomes void pointer(b) It becomes dangling pointer(c) It becomes null pointer(d) It becomes zero pointerI had been asked this question in an online interview.The question is from Pointer to Objects in division Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming

Answer»

Right choice is (b) It becomes DANGLING pointer

The explanation: When the address POINTED by the object pointer gets deleted, the pointer now POINTS to an invalid address. Hence it becomes a dangling pointer. It can’t be null or VOID pointer since it doesn’t point to any specific LOCATION.



Discussion

No Comment Found

Related InterviewSolutions