If company x offer you a better package than us, what would you do? This question is asked by an interviewer, what do I reply to this question?

The perfect answer would be that I will not only look for the compensation part but also the work domain and the learning curve of the company and the company reputation offcource.

This is a very subjective question. There is no perfect answer to it . This is usually asked to test how diplomatic is the candidate because being diplomatic is again a very high rated skill which is needed in the job and also in the personal life . There will be many situations in the job where your diplomatic behaviour will save your ass . This may sound harsh but this is reality. The perfect answer would be that I will not only look for the compensation part but also the work domain and the learning curve of the company and the company reputation offcource. Explain your situation properly the interviewer won’t mind it . After all he is also in same boat like you whom you will also find leaving the present company for the better opportunities.