RE: How will you detect if there is memory leak in you...
Well "Rational Purify" is one way. If I was conducting the interview I would ask a contra question immediately asking how to do that if you do not have a port of the tool for the OS (Riviera Symbian etc.) you are using. In this case you will need to find a way to precisely measure how much memory you have before and after you run the program. If there is a difference than you have a memory leak. How you do that vary from system to system. You will need to dig yourself in the documents for the system.
RE: How will you detect if there is memory leak in your C++ program?
If you are using new and delete operator you can overload both the operators and can count number off heap allocation and deallocation. You can also get the __FILE__ and __LINE__ to get to know the file name and line number. Now the new and delete of a memory location should be in pair and if its not there is a memroy leak. By using line and file utility you can reach upto the exact location.
RE: How will you detect if there is memory leak in your C++ program?
If memory cannot be allocated dynamically new throws bad_alloc such message will be displayed at execution. If so then Use cout statement in destructor to check if it was invoked (i.e. memory deallocated)