I am a teacher, and my reactions might vary depending on the context, the question, and the means by which it is asked. Sometimes, if people keep asking repeated questions throughout class, it can become disruptive to the lesson plan and to other students, so the questions can best be handled outside of class time. If a student is questioning content or an opinion I have expressed, I often find that refreshing. But if it becomes clear that the student is just trying to show me up, my reaction might be different. You have to remember that you are one of many students, and the teacher is up on display in front of a bunch of people, not always having the time to deal immediately with each person's individual needs. If the answer to your question is something that will be primarily of benefit to you and not the class as a whole, it might be best to wait until after class. If it contributes to class discussion, then a good teacher will encourage your questions.