small refactoring in the exam.js file
Refactoring in the exam.js file