This question can be asked in many different formats and manners but the purpose is always the same. By asking this type of question the interviewer is hoping to find out whether you will be able to work in an effective manner with the people on the team if you are hired for that job. There is a good chance when an interviewer asks this type of question that they already have a particular personality on that team in mind and are attempting to find out whether you will be able to get along with that person. This means that in order to respond well to this question you will need to make sure that you stick to an answer that is neutral and safe. The last thing that you want to do is provide an answer that is too specific and risk having it look as though you would not be able to get along with others in that department or in that team.
For example, you might state that you have found in the past that you are able to get along with a variety of different personalities but that you tend to get along best with people who value teamwork and who are highly organized if you are working on a joint project. This is fairly neutral territory but it shows the interviewer that you have given the matter some thought and also that you are flexible enough to be able to work with a variety of different personalities.
What you should not do when responding to this type of interview question is to begin to name off the various types of personalities that you have experienced in the past and which you have had terrible working relationships with. Remember that this is not the time when you want to give the impression that you hold a grudge or that you assess blame against others. You certainly do not want to fall into a situation where you speak n a negative manner against former co-workers. This is a fairly common interview question that you may frequently encounter so it can certainly benefit you to take the time to form a response that give the interviewer some insight into your own personality while also remaining in neutral territory to avoid problems.