As a general rule, you would be better off checking this with your professor. The point is that in some cases, students may use contractions in essays and some other papers.