Regarding the question at hand, we quote a fatwa by the late Sheikh `Abdullah ibn Jibrin, a prominent Muslim scholar, who said,

Such students have no other option, so they have to try hard tolower their gaze, protect themselves and keep away from temptation whichcould lead them into Haram actions.

Excerpted with slight modifications from

There is nothing wrong in asking your female teachers during lectures and your study related matters while in a modest and respectful way. Difference of sex should not be an obstacle in your study life. Your relation with your teachers, males or females, should be based on mutual understanding and respect. The teacher should treat the students as his or her own children, and the students should consider the teacher as their own parent.