You can restrict the number of attempts user can take a quiz included in a course (while in a course session). This can be done while adding the quiz in the course by editing the properties of the quiz.
Once this is done, any learner who takes the quiz as a member of course session for this course, would see how many attempts are remaining when they finish the quiz.
course player - learner would see the quiz in a locked state after max number of attempts are exceeded.
Allowing more test attempts to specific user :
As an instructor or administrator, you can clear the recorded attempts by the learner for any quiz in the course. This will allow them to take the quiz again. To do this