Question
Answer
What is unlawful is for the student to cheat by looking at a cheat sheet or at another student’s paper. In this case, the student is benefiting from knowledge that he or she does not really possess and is therefore guilty of a deliberate deception.
It is up to the test developers to decide how to handle guesses and uncertain answers. If a test developer wants to, he or she can give a penalty for wrong answers (usually a -1/4 point on a test where a correct answer is valued at a single point) to discourage guessing. This is a lawful practice for the test developers as long as it is applied to all students equally, just as guessing is a lawful practice for the test takers, since no dishonesty is involved.
And Allah knows best.