How can we show our students only the wrong answers

From MoodleDocs

The following JavaScript hides the questions that the students answered correctly from the review of their previous attempts. Hence, only questions that the students answered incorrectly or partially correctly are displayed.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
   $(document).ready(function() {
       // On the review page
       $("body#page-mod-quiz-review .que").each(function() {
           var state = $(this).find(".state").text();
           // Remove correct answers
           if (state == 'Correct') {
               $(this).remove();
           }
       });
   });
</script>

where:

"body#page-mod-quiz-review identifies the review page,
$(this).find(".state").text() captures the status of the question (correct answer or other),
if (state == 'Correct') {$(this).remove();} suppresses the display of the question if it has been answered correctly.

You can place this code in three places depending on what you want to get:

  • In Additional HTML (Site administration / Appearance / Additional HTML)
If you place the script in "Additiona. HTML", it will affect all quizzes on your Moodle site.
  • In an HTML block
You can place the script in an HTML block and display the block according to what you want to get.
  • In the HTML of a question text
You can also place the script in the HTML of the question text of any question.

Reference