In question no 1200 we explained that free mixing between men and women is haraam, and we explained that harm that this causes to people’s spiritual and worldly interests.
As this is the case, then what you must do is not to remain in a place where there is free mixing between men and women, except in cases of necessity. If the university is for girls and the teachers are men, then there is less danger. But those who follow their whims and desires will keep trying to remove every barrier between the sexes. So we advise you to fear Allaah and to remember that He is watching you in private and in public.
See also question no. 8827.
With regard to a woman speaking to a man for some necessary purpose, there is no sin in it, subject to the condition that they should not be alone together (khulwah or seclusion), even if that is in an office or classroom, with no one else present. They should also remain formal and dignified, and observe proper hijab, and take care to speak only about what is necessary without saying anything more, or softening the voice. There should also be no danger of fitnah. If the woman feels any kind of desire or speaks to men simply for fun, or if that applies to the man, then it is haraam for them to speak together, because of the fitnah and sin involved. And Allaah knows best.