跳至主內容

Multiple Answer Question - Version 3.2.1

Multiple Answer Question - Version 3.2.1

Michael Kiff發表於
Number of replies: 8
Hello,

Hoping someone can help me, I am trying to create a short answer question with multiple correct answers that can be given in any order as follows:

Q - What are the 4 main risk areas identified when working with chemicals?

A - Absorption, Ingestion, Inhalation, Explosion

All 4 risks in any order should give one full mark.

3 risks in any order 0.75

2 risks in any order 0.50

1 risks in any order 0.25

I'm pulling my hair out, I have tried wild cards with no joy.

Thanks in advance
評比平均分數: -
In reply to Michael Kiff

Re: Multiple Answer Question - Version 3.2.1

Joseph Rézeau發表於
Core developers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片 Testers的相片 Translators的相片

Hi Michael,

What you want to achieve is much more complicated than you think. wink

You want to achieve a partial permutation. A partial permutation of k items out of n consist in the list of all possible permutation of each combination of k out of n. You can try this for yourself on this webpage: https://www.dcode.fr/partial-k-permutations

What you want to achieve would yield:

permutations 4 -> 24
permutations 3 -> 24
permutations 2 -> 12
permutations 1 -> 4
TOTAL 64 combinations!

I have managed to achieve it in my own REGEXP question type and you can test it on my moodle test site at http://www.rezeau.org/moodle

log in as student01 and go to test course 01 (the only one) and go to Quiz for Michael Kiff

Joseph

評比平均分數:Useful (1)
In reply to Michael Kiff

Re: Multiple Answer Question - Version 3.2.1

Dominique Bauer發表於
Documentation writers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片

Hello to all,

Michael's question is so simple that it's surprising that you can't do it in Moodle.

We could easily do it with a small script, for example the one below that I sketched in a few minutes. The question is where to place this script?

The Formulas question allows to include some programming and we could use it to do Michael's question if it were not that the Formulas question does not deal with strings (except for algebraic expressions). Processing string answers in the Formulas question is on my wish list.


if (answer_1 == "string_1" || answer_1 == "string_2" || answer_1 == "string_3" || answer_1 == "string_4") {
  mark = 0.25;
}
if (answer_2 == "string_1" || answer_2 == "string_2" || answer_2 == "string_3" || answer_2 == "string_4" && answer_2 != answer_1) {
  mark = mark + 0.25;
}
if (answer_3 == "string_1" || answer_3 == "string_2" || answer_3 == "string_3" || answer_3 == "string_4" && answer_3 != answer_1 && answer_3 != answer_2) {
  mark = mark + 0.25;
}
if (answer_4 == "string_1" || answer_4 == "string_2" || answer_4 == "string_3" || answer_4 == "string_4" && answer_4 != answer_1 && answer_4 != answer_2 && answer_4 != answer_3) {
  mark = mark + 0.25;
}
In reply to Michael Kiff

Re: Multiple Answer Question - Version 3.2.1

Marcus Green發表於
Core developers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片 Testers的相片

Hi Michael

If you go to 

https://m.vledevelop.co.uk/course/view.php?id=4

And login with credentials

username
s1
password
Password1

And take the Risks with Chemicals quiz, you will find it has a single question which may address your requirements. 


評比平均分數:Useful (2)
In reply to Marcus Green

Re: Multiple Answer Question - Version 3.2.1

Joseph Rézeau發表於
Core developers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片 Testers的相片 Translators的相片
Hi Marcus,
Yours is quite simply the best solution to the OP's requirements!
In my reply I got carried away with trying to put all items in a single answer, like a kind of sentence. That was not necessary in the case at hand. But it may be useful in other contexts.
評比平均分數:Useful (3)
In reply to Joseph Rézeau

Re: Multiple Answer Question - Version 3.2.1

Marcus Green發表於
Core developers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片 Testers的相片
I have been working on an idea to create a new question that inherits all the code from gapfill but with tweaks to make it a dedicated 'Word list' Question type so it defaults to that style of question and just does type into the box to keep things simple. Although Gapfill can do what I have shown there it requires a few more steps that Joe Q Normalperson would want to do.

I really need to have a look at the formula question type as it seems to offer some very nice features. 
評比平均分數:Useful (2)
In reply to Marcus Green

Re: Multiple Answer Question - Version 3.2.1

Michael Kiff發表於
Sorry for the late reply, its been a little bit crazy of late. Thanks for your help.
In reply to Michael Kiff

Re: Multiple Answer Question - Version 3.2.1

Michael Kiff發表於
Sorry for the late reply, its been a little bit crazy of late. Thanks to everyone for your assistance.