I factored these functions out of view_exam.html, so that we can also show explanations in the preview.