You could have multiple choice questions, or you could use pattern matching with alternatives that you would hope would catch the acceptable answers.
But why not, in this day and age, give students something better? Why not have the students write short mathematical essays in notebook form on various topics where they might explain how they got an answer and the principles behind it? Of course, that means the teacher would have to actually read the notebooks, and the student would also have to learn how to write readable and clear presentations.
I'm building a little Mathematica system that checks answers entered by students. Suppose the question is "what is Sin'[x]?" ad the student responds: Sin'[x] which is "correct", but not the intended answer (Cos[x]). I'm wondering if there is a general way to approach this sort of problem. In particular, is there a way to find out whether a given expression includes certain elements (like Derivative)?