MCQ (Multiple-select): prevent selecting ALL

MCQ (Multiple-select): prevent selecting ALL

by Ken Masters -
Number of replies: 4
Hi

(Using ver. 1.9.3+)

I have a an MCQ which contains 2 correct answers, and both must be selected to achieve full marks (i.e. each is worth 50%).

When setting the question, however, the options for selecting are
"One answer only" OR
"Multiple answers allowed"

This does not, however, prevent the student from selecting ALL the options, and achieving full marks.

I know I can have a "work-around" in which I have 2 correct answers, 4 incorrect answers, and the correct answers are worth 50% each and the incorrect answers are worth -25% each. This means that, if a student selects all, then they get 0. But if the department / school / instituion forbids any kind of negative marking, then this is not possible. It's also messy if the student select one correct answer and one incorrect answer: they get a score of 0.25 (or 0.3) / 1. Yuck.

So, in Moodle, how does one restrict the students to selecting ONLY 2 options in a multiple-select MCQ?

Thanks

Ken

Average of ratings: -
In reply to Ken Masters

Re: MCQ (Multiple-select): prevent selecting

by Pierre Pichet -
Hi Ken,
The best way to have the grading you want, will be to create a one answer MCQ question which put in only one choice the two valid answers. The other options are a mix of other valid and invalid answers.

Say A and B and the good ones and C, D, E, F and bad ones so
  • A and B (100%)
  • A and C (50%)
  • A and D (50%)
  • A and E (50%)
  • A and F (50%)
  • B and C (50%)
  • B and D (50%)
  • B and E (50%)
  • B and F (50%)
  • C and D (0%)
  • C and E (0%)
  • C and F (0%)
  • D and E (0%)
  • D and F (0%)
If the list is that long you should perhaps not mix the values so that the choices are more easy to see.
However you create different version of the same question with different answers order (B being the first etc.) and put them in one category.
Use Add random question from this category to put one version in the quiz attempt so that the students have no cue about the good answer.

Pierre


In reply to Ken Masters

Re: MCQ (Multiple-select): prevent selecting ALL

by Adriane Boyd -
Hi Ken,

Pierre's solution is a good workaround if you need to do this with the core multiple choice question type, but if you can install additional question types on your site, please take a look at the all-or-nothing multiple choice question type, which gives a grade of 100% for selecting exactly the required answers or 0% for selecting any other combination. It looks just like the core multiple choice with multiple answers for the students, but changes the grading underneath. Let me know if you have any problems or questions!

-Adriane
Average of ratings: Useful (1)
In reply to Adriane Boyd

Re: MCQ (Multiple-select): prevent selecting ALL

by Ken Masters -
Hi

Thanks for these attempts at solutions (I'm afraid that list would be very long, and I don't wish to have an all-or-nothing, because I want a student to be rewarded if s/he knows only one of the answers).

Still, thanks anyway.

Ken

In reply to Ken Masters

Re: MCQ (Multiple-select): prevent selecting ALL

by Adriane Boyd -
I see that I misunderstood what you were asking for. With a little hacky javascript (really not the right way to do this*), you can indeed limit the number of checkboxes checked for 1.9 as long as your students have javascript enabled and you're willing to jump through a couple annoying hoops while editing the question.

Copy the attached script.js to /yourmoodlesite/question/type/multichoice. Then in each question where to want to enforce this, add the following to the bottom of your question text, substituting the question id for QID (you should see id=NNN in the editing url when you edit a question you've already created, e.g., http://yoursite/moodle/question/question.php?id=280&courseid=2) and the max number of checked boxes for MAX:

<script type="text/javascript">
multichoiceAddEvent(window, 'load', function() { multichoiceEnforceCheckboxCount(QID, MAX); });
</script>

I had to turn off the HTML editor in my user preferences to be able to edit the question properly after adding this code, because the HTML editor majorly screws up the javascript. Do choose HTML format, just don't let the HTML editor reformat the code or you will get a lot of meaningless ampersands.

If your students turn off javascript, nothing will prevent them from checking more than MAX boxes, because there's no way to do this in plain old HTML. It would be a lot nicer to do this using the YUI libraries, but that would require modifying the existing multichoice code, rather than just adding an extra file. I also don't have any recent IE versions to test with, so it's possibly there are bugs there, although it should work in theory.

-Adriane

*It is really quite hacky. It wouldn't be that much work to integrate this properly into the multichoice type, but I don't think it's a feature that enough people are interested in for changes to be made to such a basic core question type. In any case, it should be mostly harmless even if you screw things up. Be aware that if anything causes the question id to change (backup/restore, import/export), it will stop working until you update the id in the javascript section in the question text. You could also get some weird cross-question interference if you add the code to one question with the QID of another question that's on the same page of the same quiz, but that's not all that likely to happen. You should also only be able to screw up your own questions, not some other teacher's innocent questions. Was that enough caveats?