Multiple Choice Questions and Feedback

Multiple Choice Questions and Feedback

by Stephen Francis -
Number of replies: 31
Hi,

Forgive my ignorance but when the student has completed a test i would like them to view the feedback for all the answers not just the for the answer they selected. Is this possible?
If this is not possible then perhaps it could only show the feedback for the correct answer irrelevant for whether the student got it right or wrong?

Steve
Moodle.1.6.2
Average of ratings: -
In reply to Stephen Francis

Re: Multiple Choice Questions and Feedback

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Stephen,
What type of questions do you have in your quiz: MCQ, short answer, cloze, etc. ?
Joseph
In reply to Stephen Francis

Re: Multiple Choice Questions and Feedback

by Jeff Eldridge -
Can't you use the General Feedback field? Whatever you include there will display regardless of which answer the student selects.
In reply to Stephen Francis

Re: Multiple Choice Questions and Feedback

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Stephen,

This is an excellent suggestion, however it is not currently possible in Moodle.

When a quiz's settings are such that Students may review: Responses, Scores, Feedback & Answers, then, for reviewing of Multiple Choice questions, it would make sense to display the feedback messages for all the questions, regardless of the student's actual choice.

The (pedagogic) reason being that the student should know not only why the correct choice is correct but why the wrong choices are wrong. Of course, this option is of interest only for teachers who, like myself, use quizzes for learning purposes, not for testing purposes.

If you are able/allowed to hack your Moodle core files, here's how to obtain what you wish (tested on Moodle 1.6.3). In file moodle/question/type/multichoice/questiontype.php, around line 315, change this:

$a->feedback = (($options->feedback || $options->correct_responses) && $checked) ? $feedback = format_text($answer->feedback, true, $formatoptions, $cmoptions->course) : '';

to that:

$a->feedback = (($options->feedback || $options->correct_responses) && ($checked || $options->readonly)) ? $feedback = format_text($answer->feedback, true, $formatoptions, $cmoptions->course) : '';

See result on attached screenshot.

If this solution is satisfactory for a number of users, maybe I could file an improvement bug report for it.

Joseph

Attachment image00.jpg
Average of ratings: Useful (3)
In reply to Joseph Rézeau

Re: Multiple Choice Questions and Feedback

by Art Lader -
If this solution is satisfactory for a number of users, maybe I could file an improvement bug report for it.

Well, count me in!

-- Art
In reply to Joseph Rézeau

Re: Multiple Choice Questions and Feedback

by Stephen Francis -
Please Please suggest an improvement bug, this functionality would be excellent!
From what I gather, the General Feedback can do what I want, but were using 1.6.4+ which doesn't have it.
Thanks for the help

Steve
In reply to Stephen Francis

Re: Multiple Choice Questions and Feedback

by Deleted user -

I'm wondering about the following functionality, which I don't think is available yet, but may be something that fits this category...

On a multiple choice question where a student has to pick more than one answer, is there anyway to show which answers were WRONG, without showing them which answer is correct.

Since our students can retake the test as many times as they like, we want them to know when they get answer right and when they get an answer wrong, but we do not want them to know which answers (from the remaining ones that they didn't choose) are correct.

I understand now, that we could have included feedback for each incorrect answer that says "incorrect", but with close to 1000 questions (and 4000 answers) that would now be a lot of manual work to add/change the word "incorrect" to each incorrect answer. We unforetunately didn't think in advance far enough to do this at the beginning.

It would be nice if there was another column of checkboxes for the STUDENT MAY REVIEW: that says "Incorrect Answers", and then incorrect answers would show up and be highlighted in red (just like the correct ones are highlighted in green).

If anybody has any other suggestions on how we can solve our little problem, they would be appreciated.

Thanks

In reply to Deleted user

Re: Multiple Choice Questions and Feedback

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Jeff,

As you say yourself in your message, the "normal" way to tell students whether they selected the correct or incorrect answers in MCQ questions is to display the "Correct" or "Incorrect" feedback message upon their entering their answer (or later on, when reviewing). I am amazed at the large quantity of questions and answers in your questions database and also surprised that - when those questions were authored - you never thought of entering any feedback in them.

I do not think what you suggest, i.e. having another column in "Student may review" quiz parameters is feasible. The quiz settings interface is already far too complex (I'm sure Tim will agree).

On the other hand, it might be possible to automatize (partly) the insertion of Correct and Incorrect feedback messages into your bank of existing questions, depending on what is already in them, which tool you used to author those questions in the first place, etc. If you can attach here a short, typical extract, say of 10 or 20 questions (preferably in Moodle XML format) I can take a look.

Joseph

In reply to Joseph Rézeau

Re: Multiple Choice Questions and Feedback

by Deleted user -

 Joseph Rézeau wrote "I am amazed at the large quantity of questions and answers in your questions database and also surprised that - when those questions were authored - you never thought of entering any feedback in them."

When the project was started, it was "all new" to those involved... meaning that no one had any experience with Moodle or with testing processes. The problem wasn't noticed until after everything was up and running. The biggest issue really comes from not understanding how Moodle works... you can't really put any blame on anybody! There was an expectation of how they thought it should work, versus how it actually works, and since they didn't match, we are now faced with our current issue, and trying to find a workaround solution!

Joseph Rézeau wrote On the other hand, it might be possible to automatize (partly) the insertion of Correct and Incorrect feedback messages into your bank of existing questions, depending on what is already in them, which tool you used to author those questions in the first place, etc. If you can attach here a short, typical extract, say of 10 or 20 questions (preferably in Moodle XML format) I can take a look.

I was hoping somebody would make a suggestion like this!!!smile I'll try and get some questions together for you today or tomorrow, and attach them later on. I appreciate the help.

Thanks

In reply to Deleted user

Re: Multiple Choice Questions and Feedback

by Jean-Michel Védrine -
Why not directly modify all records in the database (for instance with phpMyAdmin)
UPDATE `mdl_question_answers` SET `feedback` = 'Incorrect' WHERE `fraction` <=0;
UPDATE `mdl_question_answers` SET `feedback` = 'Correct' WHERE `fraction` >0 ;
Of course make a database backup first just in case, I don't want to be help responsible for the lost of thousand of questions !!
This assume that there is no valuable feedback already in the database, if this is not the case you must modify the SQL statments so that no existing feedback is lost :
UPDATE `mdl_question_answers` SET `feedback` = 'Incorrect' WHERE `fraction` <=0 AND `feedback` = '' ;
UPDATE `mdl_question_answers` SET `feedback` = 'Correct' WHERE `fraction` >0 AND `feedback` = '' ;
(note that last characters are 2 single quotes, not a double one !)
Finding somebody familiar with SQl and phpMyAdmin will help you of course to do this without any mistake!
In reply to Jean-Michel Védrine

Re: Multiple Choice Questions and Feedback

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Jean-Michel,
That is a very good suggestion, provided of course that Jeff's admin is confident with updating their database.
Joseph
In reply to Jean-Michel Védrine

Re: Multiple Choice Questions and Feedback

by Deleted user -

jean-michel vedrine wrote "Why not directly modify all records in the database (for instance with phpMyAdmin) UPDATE `mdl_question_answers` SET `feedback` = 'Incorrect' WHERE `fraction` <=0 "

I like that!!! Where can I find more detailed instructions on all the commands that can be run from phpMyAdmin command line?

The examples you provide will add "incorrect" or "correct" to the feedback if it's blank, or skip it if it's already got feedback in it. Is there a way to have it insert "incorrect" or "correct" at the beginning of the feedback, even if their is already feedback there (so it does not overwrite the existing feedback)? Here's my version of what I'd like phpMyAdmin to do, based on how I would program it in BASIC. I don't know if it will work, I'm just writing it so you might understand better what I'm asking...

UPDATE `mdl_question_answers` SET `feedback` = 'Incorrect ' + 'feedback' WHERE `fraction` <=0;


Or is there a way to write a script or batch file that can run in phpMyAdmin, that would do this with a few UPDATES and if/then statements?

In reply to Deleted user

Re: Multiple Choice Questions and Feedback

by Andrew Walbran -
This should work:

UPDATE mdl_question_answers SET feedback = 'Incorrect ' || feedback WHERE fraction <= 0;
In reply to Andrew Walbran

Re: Multiple Choice Questions and Feedback

by Jean-Michel Védrine -
Are you sure MySql support pipes(||) when not in ANSI mode ? I was thinking you had to use CONCAT.
But I am certainly not a MySql guru.
In reply to Jean-Michel Védrine

Re: Multiple Choice Questions and Feedback

by Andrew Walbran -
It looks like you are right (I normally use PostgreSQL). This should work instead:

UPDATE mdl_question_answers SET feedback = CONCAT('Incorrect ', feedback) WHERE fraction <= 0;
In reply to Andrew Walbran

Re: Multiple Choice Questions and Feedback

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Thanks to Jean-Michel and Andrew for giving us some insights in the mySQL syntax.

To further refine the mySql "formula", I suggest the following, which will set the feedback text at Correct for Grade = 100%, Partially correct for Grade <100% but >0% and Incorrect for Grade = 0% (normally it is not possible to record a Grade <0% in Moodle questions), while preserving actual feedback text if any.

UPDATE mdl_question_answers SET feedback = CONCAT('Correct. ', feedback) WHERE fraction = 100; UPDATE mdl_question_answers SET feedback = CONCAT('Partially Correct. ', feedback) WHERE fraction < 100 && fraction > 0; UPDATE mdl_question_answers SET feedback = CONCAT('Incorrect. ', feedback) WHERE fraction = 0;

Tried and tested on my local Moodle install mySql database, with phpMyAdmin.

Joseph

In reply to Joseph Rézeau

Re: Multiple Choice Questions and Feedback

by Deleted user -

Thanks Joseph, Andrew and Jean-Michel...

This looks like exactly what I want to do. I'll let you know how it turns out!!!

Where can I find a list of available commands (like Update, Set, Concat, Where, etc) that can be run on the command line for phpMyADMIN?

In reply to Deleted user

Re: Multiple Choice Questions and Feedback

by Deleted user -

SUCCESS!!!!

After checking our database, I found we had almost 7500 answers. About 6300 had no feedback at all, and the rest had some kind of partial feedback.

I ran the following in phpMyAdmin on the mdl_question_answers table:

UPDATE mdl_question_answers SET `feedback` = CONCAT('CORRECT. ', `feedback`) WHERE `fraction` = 1

UPDATE mdl_question_answers SET `feedback` = CONCAT('INCORRECT. ', `feedback`) WHERE `fraction` = 0

UPDATE mdl_question_answers SET `feedback` = CONCAT('Partially CORRECT. ', `feedback`) WHERE `fraction` < 1 && `fraction` > 0

Even with 7500 entries to go thru, each line took less than 1 second to complete. My feedbacks now appropriately display whether or not the students selected answer is Correct, Partially Correct or Incorrect, and it also includes any existing feedback that was already in the feedback field.

Thanks everybody for your help in solving this problem!!

In reply to Joseph Rézeau

Re: Multiple Choice Questions and Feedback

by Deleted user -

I downloaded the MySQL reference manual (Thanks again Joseph), but I don't think I'll be "quickly" reading thru all 2000+ pages in the next day or two!!!

How would I do the following with the phpMyADMIN?

I want to set any fraction=0 to fraction=-100, but only if it's a multiple choice question with more than one answer. Because the values are in different tables, will this cause a problem, or is it "smart" enough to link up the questions in different tables

IF mdl_questions_answers fraction = 0

AND mdl_questions qtype = 'multichoice'

AND mdl_question_multichoice single = 0

THEN mdl_questions_answers fraction = -100

Something like this???

UPDATE mdl_questions_answers SET fraction = -100 WHERE fraction = 0 && mdl_question_qtype = 'multichoice'  && mdl_question_multichoice_single = 0

Thanks again

In reply to Deleted user

Re: Multiple Choice Questions and Feedback

by Andrew Walbran -
You will need to use either a subquery or a join to do this.

Something like this will hopefully work:

UPDATE mdl_question_answers SET fraction = -100 WHERE fraction = 0 AND (SELECT qtype FROM mdl_question WHERE mdl_question.id = mdl_question_answers.question) = 'multichoice' AND (SELECT single FROM mdl_question_multichoice WHERE mdl_question_multichoice.question = mdl_question_answers.question) = 0;

I am not entirely sure that single = 0 is the right condition to use for what you want to do. You may have to count the number of commas in mdl_question_multichoice.answers.

There is probably a more efficient way to do this using joins. It would be a good idea to read the sections of the manual about SELECT, UPDATE, joins and subqueries.
In reply to Andrew Walbran

Re: Multiple Choice Questions and Feedback

by Deleted user -

Andrew Walbran wrote "You will need to use either a subquery or a join to do this."

I was actually reading the manual, specifically on the JOIN command, when I received your reply. I have created a couple test tables in my database, to try and see if I can change an item in one table, based on the setting in the other.

Does anybody know if there is a "limit" to the length of the string you can type into phpMySQLAdmin?

The following line works fine as I expect it to, with no errors, and gives the appropriate output:

SELECT * FROM jefftest_shuffle INNER JOIN jefftest_answer ON jefftest_shuffle.id = jefftest_answer.id WHERE jefftest_answer.answer = 'all'

But this line below gives the following error (note that this line is exactly the same from the word FROM to the end):

UPDATE jefftest_shuffle SET shuffle = 0 FROM jefftest_shuffle INNER JOIN jefftest_answer ON jefftest_shuffle.id = jefftest_answer.id WHERE jefftest_answer.answer = 'all'

Error

SQL query:

UPDATE jefftest_shuffle SET shuffle =0 FROM jefftest_shuffle INNER JOIN jefftest_answer ON jefftest_shuffle.id = jefftest_answer.id WHERE jefftest_answer.answer = 'all'

MySQL said:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM jefftest_shuffle INNER JOIN jefftest_answer ON jefftest_shuffle.id = jeffte' at line 1
I can't figure out what my error in syntax is, other than possibly that my query is too long, and it's cutting it off. Any ideas?
In reply to Deleted user

Re: Multiple Choice Questions and Feedback

by Andrew Walbran -
You cannot have a FROM clause in an UPDATE query. I cannot remember what the syntax for a join in an UPDATE is.
In reply to Andrew Walbran

Re: Multiple Choice Questions and Feedback

by Deleted user -

 Andrew Walbran wrote "You cannot have a FROM clause in an UPDATE query. I cannot remember what the syntax for a join in an UPDATE is."

Okay thanks, that explains my error. I'll keep reading through the MySQL manual to see if I can figure it out (only another 1800 pages or so to go) !!!

In reply to Andrew Walbran

Re: Multiple Choice Questions and Feedback

by Deleted user -

There is probably a more efficient way to do this using joins.

You can't use FROM with the UPDATE query.

Okay, I found it...

You have to do the JOIN after the UPDATE, but before the SET. I also figured out that instead of the word JOIN, you can use a comma. So it looks like this:

UPDATE mdl_question_multichoice,mdl_question_answers SET mdl_question_multichoice.shuffleanswers =0 WHERE mdl_question_answers.answer = 'All of the above.' AND mdl_question_answers.question = mdl_question_multichoice.question

The problem we had was that about 450 mutiple choice questions were entered, where one of the answers was ALL OF THE ABOVE, but the Shuffle Answers was set to Yes, so the All Of The Above answer could show up anywhere in the list of answers. We needed to set Shuffle Answers to No on these questions.

Explanation:

UPDATE mdl_question_multichoice,mdl_question_answers  First of all, we pick the two tables we will be using and put a comma between them. This tells MySQL that you are going to do something with both tables.

SET mdl_question_multichoice.shuffleanswers =0  Second, we tell it what we want to change. In this case I want to set the shuffleanswers column equal to zero, in the mdl_question_multichoice table.

WHERE mdl_question_answers.answer = 'All of the above.'  Thirdly we set  a condition. This looks for the exact wording ALL OF THE ABOVE. in the answer column of the mdl_question_answers table.

AND mdl_question_answers.question = mdl_question_multichoice.question  Lastly there is another condition that needs to be met. This checks the question column in one table against the question column in the other table to make sure they are looking at the same question in both tables.

It worked perfectly on our database. Thanks everybody.

In reply to Deleted user

Re: Multiple Choice Questions and Feedback

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Jeff,

I'm glad that you worked it out. As you say the mySql manual is way too big for people who only need an occasional query. It might be a good idea to have (in the Moodle docs) a kind of repository of useful such queries (with lots of clear comments and concrete examples, such as yours). It might take the form of Q/A.

Q.- How do I set the feedback field of the answers of all MCQ type questions with grade = 0 to 'Incorrect'?

A.- Enter the following mySql query:
UPDATE mdl_question_multichoice, mdl_question_answers
First of all, we pick the two tables we will be using and put a comma between them. This tells MySQL that you are going to do something with both tables.
...

What do you think?
Joseph

In reply to Joseph Rézeau

Re: Multiple Choice Questions and Feedback

by Deleted user -

Joseph Rézeau wrote "It might be a good idea to have (in the Moodle docs) a kind of repository of useful such queries (with lots of clear comments and concrete examples, such as yours). It might take the form of Q/A."

Sounds like a good idea to me!!

I always try to give lots of details/examples when I find a solution, so that others searching the forums can hopefully find the info they need easily. I would be willing to provide more examples as well if needed.

In reply to Joseph Rézeau

Re: Multiple Choice Questions and Feedback

by Jean-Michel Védrine -
Yes Joseph you are right in saying that "normally it is not possible to record a Grade <0% in Moodle questions" but here we are looking at mdl_question_answers wich contain answers so the fraction field can be negative.
In reply to Jean-Michel Védrine

Re: Multiple Choice Questions and Feedback

by Deleted user -
In a multiple choice question, with more than one answer, you can assign positive OR negative values to each answer. You could for example assign .333 to each of the three correct answers, and assign -1 to all the incorrect answers. This example would only allow a student to either get full marks or nothing at all. The final score of the question won't be negative (it's always between 0 and 1), but the answers themsleves can have a range of -1 to +1 .
In reply to Joseph Rézeau

Re: Multiple Choice Questions and Feedback

by Deleted user -

Joseph wrote "On the other hand, it might be possible to automatize (partly) the insertion of Correct and Incorrect feedback messages into your bank of existing questions, depending on what is already in them, which tool you used to author those questions in the first place, etc. If you can attach here a short, typical extract, say of 10 or 20 questions (preferably in Moodle XML format) I can take a look."

Joseph, I did not bother getting any questions together, since we came up with the phpMyAdmin solution! Thanks again though.

In reply to Joseph Rézeau

Re: Multiple Choice Questions and Feedback

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
I finally entered bug report MDL-10841. People who are interested can vote for it so it gets into regular Moodle distros instead of remaining an ad hoc hack.
Joseph