This question will gauge your ability to adapt to certain situations. Interviewers ask this question because they want to know how well you can manage problems and changes at work. A lot of people might be tempted to simply say, "I have never had problems when things do not go as planned" or worse, "I have never experienced that before". The first answer is fine as long as you are able to provide a supporting answer to it and be able to really show that you are, in fact, someone who can easily adjust yourself when changes occur.
On the other hand, saying you have never had any experience on the matter would only make the interviewer think of how naive you are, which is not really going to help you land the job.
Employers want their people to be adaptable and flexible. This is necessary because changes happen in the workplace and those who show adaptability and flexibility are the ones who are still able to perform well in spite of the change. The interviewer, therefore, will give plus points to candidates who are able to prove that they possess these qualities. They are looking for people who are able to respond quickly and positively to changes and unexpected demands. Moreover, they also want people who can adapt their style and mindset positively in the event that problems and challenges take place.
Many first time applicants (and even those who have applied for jobs several times before) tend to stammer and not be able to give a direct answer to this question especially if they did not bother to prepare. It is recommended that you summarize your answer in one sentence and then expound further later on.
This way your interviewer will have a clear idea about how well you can really adapt to a situation. Answers such as "When things do not go as planned, the first thing I do is to take a deep breath and tell myself it will be okay". An answer like this can immediately give the interviewer an idea that you are a levelheaded person who knows how to handle situations properly.
Now that you have established a good first impression for this question, the next thing to do is to cite an example. The reason why an example is important is that a lot of people can say anything just to win the approval of others and yet not everyone is really being honest with what they are saying.
An example can validate or invalidate your main answer, which is why when citing an example, see to it that your interviewer will be able to comprehend and follow your thoughts. Moreover, make sure that the example you give should be relevant and helpful to prove to the interviewer how capable you are of adapting to changes in the workplace. If you do not have a work experience yet, citing an example on your experience in school would do.