(only) cloze question type does not give right answers in the feedback

(only) cloze question type does not give right answers in the feedback

Dirk Cheng གིས-
Number of replies: 17

Dears,

I use several types of questions in our quizzes. All question types disclose the right answer after submission (e.g. question 7). Only the cloze type with SHORTANSWER NEVER shows the right answers (e.g. question 8). It only marks the given answers as correct or incorrect.

Why that? How can I disclose all correct answers in the feedback?

All review options are activated.

དཔྱ་སྙོམས་ཀྱི་སྐུགས་ཚུ།: -
In reply to Dirk Cheng

Re: (only) cloze question type does not give right answers in the feedback

Dave Sherwin གིས-
Particularly helpful Moodlers གི་པར
Dirk - in the structure of the Embedded Answers (Cloze) Question Type setup did you add the option of feedback by using the # mark to add your feedback. This is a little tricky with a short answer because generally M/C questions can explain why each choice is wrong, but a short answer can have various responses. So you can only explain why the correct answer.
In reply to Dave Sherwin

Re: (only) cloze question type does not give right answers in the feedback

Dirk Cheng གིས-
We do not add feedback to specific questions. If a short answer question has several correct answers, the system will automatically disclose the first answer as the correct answer.
The system works well with the short answer type, but doesn't show the correct answer for the questions in the embedded answers question type. For testing reason, I added a cloze question type with specific feedback added to each embedded question/answer (e.g. {5:SA:=2#Correct!~*#Wrong!}), but the review still does not show the correct answers. There is no feedback at all for all questions of that questions type, while all other question types have the feedback showing the correct answer.
In reply to Dirk Cheng

Re: (only) cloze question type does not give right answers in the feedback

Joseph Rézeau གིས-
Core developers གི་པར Particularly helpful Moodlers གི་པར Plugin developers གི་པར Testers གི་པར Translators གི་པར

Is that what you want? Example taken from the documentation.

The capital of France is {1:SHORTANSWER:%100%Paris#Congratulations! ~%50%Marseille#No, that is the second largest city in France (after Paris).~*#Wrong answer. The capital of France is Paris, of course.}.

In reply to Joseph Rézeau

Re: (only) cloze question type does not give right answers in the feedback

Dirk Cheng གིས-
Yes, that is mouse-over. All other question types show the correct answers below, like in the above example question 7. Only the cloze question type doesn't. Is there a way to let moodle show the correct answers for cloze question type in the same way like for the other question types?
In reply to Dirk Cheng

Re: (only) cloze question type does not give right answers in the feedback

Joseph Rézeau གིས-
Core developers གི་པར Particularly helpful Moodlers གི་པར Plugin developers གི་པར Testers གི་པར Translators གི་པར

This is due to the very nature of the Cloze question type, which is supposed to comprise any number of sub-questions. If feedback for each sub-question were displayed under the Cloze question text, how would the student relate which feedback relates to which sub-question? With a fairly large number of sub-questions, the screen could become really cluttered and incomprehensible.😉

I don't quite see how the current behaviour is a problem. All you have to do is to inform your students that they need to hover (or click) on the correct/incorrect icons which follow their response in the Cloze question text. Please note that if a student clicks on the very first response, then they can navigate to the other feedback messages by using the Tab key.

In reply to Joseph Rézeau

Re: (only) cloze question type does not give right answers in the feedback

Dirk Cheng གིས-
How does the "very nature" of the cloze question not enable a correct answer statement? Moodle can produce answers for the embedded answers, so it has everything it needs. Text + answers = answer statement.
In reply to Dirk Cheng

Re: (only) cloze question type does not give right answers in the feedback

Joseph Rézeau གིས-
Core developers གི་པར Particularly helpful Moodlers གི་པར Plugin developers གི་པར Testers གི་པར Translators གི་པར
I can only repeat the explanation I gave in my previous post:
This is due to the very nature of the Cloze question type, which is supposed to comprise any number of sub-questions. If feedback for each sub-question were displayed under the Cloze question text, how would the student relate which feedback relates to which sub-question? With a fairly large number of sub-questions, the screen could become really cluttered and incomprehensible.
That reply was voted "useful" by 4 regular Moodle forum members, so I would expect it to be acceptable. If you don't accept it and have a different opinion and if you have the necessary programming resources, you are welcome to offer a better solution.😉
In reply to Joseph Rézeau

Re: (only) cloze question type does not give right answers in the feedback

Dirk Cheng གིས-

Joseph,

Thank you for your thoughtful and detailed response. It’s clear that you care deeply about Moodle and its community, and I appreciate the time you’ve taken to express your perspective. Let me address your points and clarify my stance, as well as apologize if my tone came across as aggressive—that was never my intention.

On Aggressiveness and Tone

I sincerely apologize if my earlier comments felt harsh or dismissive. That was not my goal. My intention was to provide a clear and direct response to the technical and philosophical challenges of implementing a "correct answer" feature for cloze questions. However, I recognize that tone can be easily misinterpreted in written communication, and I should have taken more care to ensure my message came across as collaborative rather than confrontational. I value open and respectful dialogue, and I’ll strive to be more mindful of this in the future.

On Moodle’s Open Source Culture

You’re absolutely right that Moodle thrives on collaboration, mutual respect, and the energy of its community. I deeply respect the open-source ethos and the contributions of everyone who works to improve Moodle. My earlier comments were not meant to dismiss ideas or discourage participation but rather to highlight the complexities of certain feature requests. I fully agree that fostering a culture of trust and respect is essential, and I appreciate your call for a more inclusive and supportive environment.

On Cloze Questions and Correct Answers
Let me clarify my position on cloze questions and the possibility of displaying correct answers:

1. Technical Feasibility: We agreed that it is technically possible to display correct answers for cloze questions. As you mentioned, Moodle already provides correct answers with the mouse-over hints. However, the challenge lies in designing a solution that works well across the wide variety of cloze question formats and use cases.

2. Complexity of Cloze Questions: Cloze questions are inherently flexible, which is both their strength and their weakness. They can range from simple fill-in-the-blank exercises to highly complex, multi-part questions with interdependent answers. While your example of a fairly large number of sub-questions is at one end of the bandwidth, simple cloze questions like “given this picture, complete the following equation: {1} + {2} = {3}" are a the other end of it.
 
3. Context Matters: As you pointed out, the usefulness of a "correct answer" feature depends to a large extend on the context. For some question types, repeating the question with the correct answers filled in would work well. For others, it might be too complex. This variability makes it difficult to implement a one-size-fits-all solution. Maybe that is the reason why the “correct answers” are varying in quality and providing different levels of context, depending on which question type you choose. Sometimes it gives only the answer without the question, sometimes it repeats the whole question, sometimes it gives a correct answer differing from the correct answer given by the user, sometimes it does not give any answer at all.

4. Our Use Case: We are making about 100-200 questions each week. One have of our questions is keyword practice questions. Those questions work 100% well with the “correct answer” field and it is a great help. However, the other half is math-related questions, often with pictures or tables. If we use the correct answer function there, some questions will have a short answer, some have a long cumbersome answer, and some do not have an answer at all. As a consequence, we cannot use it at all.
 
5. Conclusion: I agree that in a scenario which you described, displaying correct answers would not be straightforward and maybe not even beneficial. However, Moodle’s development priorities often need to balance the needs of diverse users, and implementing features that work well in all cases can be challenging. Not offering the correct answer feature for that type at all reduces the usefulness of that feature for all the other types for reason of consistency. And that cannot be the spirit of this platform - in particular, since there are straight forward solutions which would work well in many situations.

On Community and Collaboration
I appreciate your willingness to contribute suggestions and ideas. Moodle’s strength lies in its community, and your feedback is invaluable. If you have specific proposals or mockups for how a "correct answer" feature could work for cloze questions, I encourage you to share them on the Moodle Tracker or forums. Your hint with the mouse-over is already very helpful since it is not obvious to many users. Concrete suggestions, especially those accompanied by examples or prototypes, are often the most effective way to move discussions forward.

Moving Forward
I agree that we share a common goal: to make Moodle the best platform it can be. Let’s focus on finding constructive ways to address the challenges you’ve raised. If you’d like, we can continue this discussion in a more collaborative spirit, exploring potential solutions or workarounds for the issues you’ve encountered.
Thank you again for your thoughtful response. I’m committed to working together in a spirit of mutual respect and collaboration, and I look forward to hearing your ideas and suggestions. Let’s keep the conversation going!
In reply to Dirk Cheng

Re: (only) cloze question type does not give right answers in the feedback

Joseph Rézeau གིས-
Core developers གི་པར Particularly helpful Moodlers གི་པར Plugin developers གི་པར Testers གི་པར Translators གི་པར
Dirk,
Thanks for your elaborate, thoughtful reply. I agree with most of what you say. Of course context is essential and as is often the case it's difficult for forum members to give a useful reply when people do not give concrete examples of their use case.
You write "4. Our Use Case: We are making about 100-200 questions each week. One have of our questions is keyword practice questions. etc." If you could export a small sample of such questions of yours and attach them to your next post, then it might make your use case more clear to us.
Joseph
In reply to Joseph Rézeau

Re: (only) cloze question type does not give right answers in the feedback

Dirk Cheng གིས-

Joseph,

glad you are with me on this. I put 3 examples into the attachments.

  1. A keyword quiz: these are fine with the auto correct answers. Since the questions are short with only one answer, moodle's auto created correct answers are concise.
  2. A maths quiz with moodle's auto created correct answers: Here it gets messy. I cannot really show this to our students and parents. Have a look first, we can get into details if you want.
  3. Because of 2., I decided to put the correct answers into each questions general feedback. Actually, the extra work is not too much and the result is sooooo much better. However, would be great to have something like this auto created from moodle. All the info is there. Or almost all info, depending on how perfect it should be.

Attachment 1. keywords quiz.jpg
Attachment 2. maths quiz with auto correct answers.jpg
In reply to Joseph Rézeau

Re: (only) cloze question type does not give right answers in the feedback

Dirk Cheng གིས-

and here the third one. sorry for the mess, i was hoping it would show the files as attachments.

Attachment 3. maths quiz with answers in each questions general feedback .jpg
In reply to Dirk Cheng

Re: (only) cloze question type does not give right answers in the feedback

Joseph Rézeau གིས-
Core developers གི་པར Particularly helpful Moodlers གི་པར Plugin developers གི་པར Testers གི་པར Translators གི་པར

Thanks for the screenshots, but to really understand your problem I would need to be able to use the questions themselves. Please export them to a Moodle XML file and attach that file to your reply.

In reply to Joseph Rézeau

Re: (only) cloze question type does not give right answers in the feedback

Dirk Cheng གིས-
They are all in one category, and unfortunately I don't see how I can export a subset.
In reply to Dirk Cheng

Re: (only) cloze question type does not give right answers in the feedback

Joseph Rézeau གིས-
Core developers གི་པར Particularly helpful Moodlers གི་པར Plugin developers གི་པར Testers གི་པར Translators གི་པར
you could create a (temporary) "export category" category and duplicate the questions you want to export to that category and export it
In reply to Joseph Rézeau

Re: (only) cloze question type does not give right answers in the feedback

Dominique Bauer གིས-
Documentation writers གི་པར Particularly helpful Moodlers གི་པར Plugin developers གི་པར

Hello Dirk,

If I understood correctly what you want, it's very easy to do, at least on the front end with a tiny piece of JavaScript code. Here's a simple example where the feedback is generated completely automatically. You can try it here.

<div class="DCcorrectanswers">
    <span class="DCquestion">
        <span class="DCstatement">2 + 2 = </span>
        {1:NUMERICAL:=4}
    </span>
    <br>
    <span class="DCquestion">
        <span class="DCstatement">3 + 2 = </span>
        {1:NUMERICAL:=5}
    </span>
    <br>
    <span class="DCquestion">
        <span class="DCstatement">3 + 3 = </span>
        {1:NUMERICAL:=6}
    </span>
</div>

<!--
© 2025 DynamicCourseware.org (Dominique Bauer)
CC0 1.0 Universal - No copyright / Public domain
-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
    $(".DCcorrectanswers").each(function(index, element){
        $DCexists = $(element).closest(".que").find(".generalfeedback");
        if ( $DCexists.length ) {
            $feedback = "<p>The correct answers are:</p>"
            $DCquestion = $(element).find(".DCquestion");
            $DCquestion.each(function(index, element){
                $DCcorrectanswer = $(element).find("button").attr("data-content");
                $DCcorrectanswer = $DCcorrectanswer.match(/\:(.*?)\</)[1];
                $feedback = $feedback + $(element).find(".DCstatement").text() + $DCcorrectanswer + "<br>";
            });      
            $DCexists.html($feedback);
            $feedback = "";
        }
    });
});
</script>
In reply to Dominique Bauer

Re: (only) cloze question type does not give right answers in the feedback

Dirk Cheng གིས-
Thank you, Dominique.
Yes, that is exactly how the answer should look like. But if I understand it correctly, then it needs some manual change to the auto-created code. The code produced by the editor looks like this:

{3:SA:=3} + {3:SA:=2} = {4:SA:=5}

It is without any DCquestion tag. Adding this alone is already more work than just adding the correct answer in the general feedback field. On top, the app is our students' core platform. We have no realistic chance to rely on the browser - may it be on phone or computer.
But I love your enthusiasm and creativity to create solutions དགའ་འཛུམ་
It is very much appreciated. Thanks for being such a helpful and active member here.
 
PS: for calculated answers this may be a great solution, where the app is not relevant
In reply to Dirk Cheng

Re: (only) cloze question type does not give right answers in the feedback

Dominique Bauer གིས-
Documentation writers གི་པར Particularly helpful Moodlers གི་པར Plugin developers གི་པར
Dirk,

I had heard about what you’re describing—that the Chinese use their phones for almost everything with a nearly universal app. This makes me realize just how important the Moodle mobile app is and that my JavaScript solutions are inadequate if they cannot be applied to it. This is a topic I will need to address seriously, and I appreciate you bringing it to my attention.