Negative marking to questions

Negative marking to questions

by Jack Eapen -
Number of replies: 43

How can i add negative marks to questions in a Moodle quiz?

Thanks

Jack

Average of ratings: -
In reply to Jack Eapen

Re: Negative marking to questions

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Which type of questions do you have in mind? MCQ, short answer, match, etc. ?
Joseph
In reply to Joseph Rézeau

Re: Negative marking to questions

by Jack Eapen -

I'm thinking of MCQ with a unique answer. Though we can provide negative weightage to the wrong answers (like 100% to correct answer and -25% to the wrong answers) , it doesn't seems to be working. please help

Jack

In reply to Joseph Rézeau

Re: Negative marking to questions

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Negative scoring for multiple choice would be helpful in writing quizzes that are based on preparing for standardized tests that use negative scoring - like SAT Preparation Guides, etc. I have had teachers asking for this. I will check and see if there is a feature request already for this feature - if not, I will add one.
In reply to Anthony Borrow

Re: Negative marking to questions

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Multiple choice questions can have individual answers with negative scores, but this is only useful when you are allowing multiple answers. In the end, the score for the question is clamped to between 0 and 1.

There are no plans to change this behavior.
In reply to Tim Hunt

Re: Negative marking to questions

by Brian Mulligan -
Tim,

is there are particular reason why there are no plans to allow negative marks for specific questions? (ie why the mark has to be between 0 and 1)

eg. No demand, no-one has volunteered to develop it, it may cause other problems if allowed.

It would seem like a fairly straightforward programming task, and the current system allows association of negative marks with distractors in quiz questions.

Brian
In reply to Brian Mulligan

Re: Negative marking to questions

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
There is lots of demand. However, it is non-trivial because of adaptive mode. Therefore, no-one has had time to make it work.
In reply to Anthony Borrow

Re: Negative marking to questions

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
I posted this as a response to Bug #5324 perhaps it might be worthy of some discussion or an idea for other workarounds:

One possible work around is to have the multiple choice questions be worth 2 points. A correct answer gets 2 points, no answer gets one point (no deduction) and an incorrect answer gets 0.75 points (a -.25 deduction). The catch is that at the end of the quiz there needs to be a question worth how ever many multiple choice questions there were - for the sake of example lets say there were 10 multiple choice questions, then it would be worth 10 points and no matter what they received zero points. That would then subtract the added ones and get around negative points. It is not an elegant work around but it may provide folks working with standardized testing formats to get the marks that they are looking for. One thing preventing this is the fact that there is no 3/8 point option (37.5%). I do think that the 1/8th options (3/8, 5/8, 7/8) should be in the default list of scales. That would be more easily accomplished then allowing negative point questions. Perhaps this should also be kicked around in a forum.


In reply to Anthony Borrow

Re: Negative marking to questions

by Dave Bethany -

I think this is a "biggie". I'm putting together study courses for CLEP exams, and need to make the quiz scoring reflect the +/- method of the actual scoring done. It works by doing multiple attempts, but I'd sure like for the calculated score to show after each attempt.

Example: quiz has 10 questions, 5 answers each. Each correct is worth 1 pt. Each incorrect has a negative .25 point value. Student gets 6 correct and 4 wrong. The 6 are +6, the 4 are -1 (4*.25). Thus final score is a 5.

Any ideas on a work-around?

In reply to Dave Bethany

Update--Negative marking to questions

by Dave Bethany -

I just reviewed the documentation and it says you can assign negative values to a question. When I try this, no negative values are calculated. Tried this by assigning 1 pt per question and also 10 pts per question. Neither had an effect on a wrong answer.

Answered 4 of 5 questions correct, got percentage of 80% and raw score of 40 out of 50. It should have been 37.5 out of 50 (10 pts per correct, -2.5 for incorrect)

In reply to Anthony Borrow

Re: Negative marking to questions

by John Isner -
This is a biggie for me as well.  I'm doing SAT prep and need the negative marks (negative 1/4 point) for incorrect answers to multiple choice questions.
In reply to John Isner

Re: Negative marking to questions

by Vikram Solia -

In fact, Moodle can be hacked to give negative marks. Tried in successfully with multiple choice questions on moodle 1.6.4+
In reply to Vikram Solia

Re: Negative marking to questions

by Matteo Fraschini -
How? What's the way to have negative marks?
Thank you!
In reply to Matteo Fraschini

Re: Negative marking to questions

by Vikram Solia -
Sorry for the late reply!

Will tell you if you are comfortable with editing program files (i.e. php files).
In reply to Vikram Solia

Re: Negative marking to questions

by Brian Mulligan -
Vikram,

were you going to publish your hack for negative marks, or maybe just contact people privately?

Brian
In reply to Vikram Solia

Re: Negative marking to questions

by udara weerakoon -
It will be a great help for us.because when we try to implement paper based evaluation system as it is negative marks are very very important. so we are greedy to here from you.
In reply to Vikram Solia

Re: Negative marking to questions

by Sai Kumar Potluri -

Hi Vikram,

I am pretty comfortable editing php files. Please tell me what to do to allow negative marking in Moodle for multiple choice questions..

Thanks a ton.

In reply to Vikram Solia

Re: Negative marking to questions

by Vedran Mušica -
Count me for that solution, I'm also interested it that patch/hack... Thank You!
In reply to Vedran Mušica

Re: Negative marking to questions

by Vikram Solia -
Hi guys!

I am extremely sorry sad for replying after such a long time. Actually had forgotten after posting here.

We implemented this for Moodle 1.6.4. If anyone wants the patch I can send them. Did not post here because do not know if it would be useful for the current versions.
In reply to Vikram Solia

Re: Negative marking to questions

by Xavier Forn i Cadafalch -

Hi Vikram,

I am very interested about the patch to allow negative marking in Moodle for multiple choice questions..

Thanks

In reply to Xavier Forn i Cadafalch

Re: Negative marking to questions

by Eamon Costello -
Hi Folks,


Just wanted to add my voice as another vote for negative marking. This is going to turn a lot of people off using Moodle for quizzes. I will have to recommend hot potatoes or questionmark to people if they need this feature.

- Eamon
In reply to Eamon Costello

Re: Negative marking to questions

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Eamon - If you have not already, you may want to cast your vote in the tracker for MDL-1647. As you can see, the request has been around for a while and there are patches that seem to make it possible. I would say it is possible but needs to be improved. Thanks for being part of the conversation. Peace - Anthony
In reply to Eamon Costello

Re: Negative marking to questions

by Stefan Eberhard -
I am also in need for this feature.
Pierre Pichet developed an "all or nothing" cloze-question type called "newmultianswer" It is very useful if you want to have ALL answers correct in a clozequestion (using :NUMERICAL: or :SHORTANSWERsmile. If the student does not have all answers correct within a question, he will receive a score of 0.
In reply to Stefan Eberhard

Re: Negative marking to questions

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Stefan > If the student does not have all answers correct within a question, he will receive a score of 0.
Ouch! black eye
In reply to Joseph Rézeau

Re: Negative marking to questions

by Stefan Eberhard -
Joseph,

it is special for bookkeeping questions. If the student does not have the correct values in 3 or 4 fields he fails answering the question.

In this example only this combination is correct. So I cannot accept any aberrance.

Konto
Betrag Soll
Betrag Haben



Forderungen

11900
Verbindlichkeiten


Bank
11662

Kundenskonti
200

Lieferantenskonti


Vorsteuer


Mehrwertsteuer
38



In reply to Xavier Forn i Cadafalch

Re: Negative marking to questions

by Vikram Solia -
Hi there,

Posting it here in the hope that it might be useful.

This code has been taken from Moodle 1.6.4. This works only for multichoice questions but potentially affects penalty for adaptive questions in all questiontypes. However, our implementation neither uses adaptive questions nor other type of questions.

The following two files were changed. The file names are indicated in bold. In both files, one function each (italicised) is reproduced.

File: moodle\lib\questionlib.php
function question_apply_penalty_and_timelimit(&$question, &$state, $attempt, $cmoptions) {
// deal with penalty
if ($cmoptions->penaltyscheme) {
$state->grade = $state->raw_grade - $state->sumpenalty;
$state->sumpenalty += (float) $state->penalty;
} else {
$state->grade = $state->raw_grade;
}

// deal with timelimit
if ($cmoptions->timelimit) {
// We allow for 5% uncertainty in the following test
if (($state->timestamp - $attempt->timestart) > ($cmoptions->timelimit * 63)) {
$state->grade = 0;
}
}

// deal with closing time
if ($cmoptions->timeclose and $state->timestamp > ($cmoptions->timeclose + 60) // allowing 1 minute lateness
and !$attempt->preview) { // ignore closing time for previews
$state->grade = 0;
}

/* negative marks hack start: commented the line below */
// Ensure that the grade does not go down
$state->grade = max($state->grade, $state->last_graded->grade);
negative marks hack stop */
}


File: moodle\question\type\multichoice\questiontype.php
function grade_responses(&$question, &$state, $cmoptions) {
$answers = $question->options->answers;
$testedstate = clone($state);
$teststate = clone($state);
$state->raw_grade = 0;
foreach($answers as $answer) {
$teststate->responses = array('' => $answer->id);
if($question->options->single) {
if($this->compare_responses($question, $testedstate,
$teststate)) {
$state->raw_grade = $answer->fraction;
break;
}
} else {
foreach($state->responses as $response) {
$testedstate->responses = array('' => $response);
if($this->compare_responses($question, $testedstate,
$teststate)) {
$state->raw_grade += $answer->fraction;
break;
}
}
}
}
if (empty($state->raw_grade)) {
$state->raw_grade = 0;
}

/* negative marks hack start
// Make sure we don't assign negative or too high marks
$state->raw_grade = min(max((float) $state->raw_grade,
0.0), 1.0) * $question->maxgrade; */
$state->raw_grade = min((float) $state->raw_grade, 1.0) * $question->maxgrade;
// Negative marks hack stop
 
// Apply the penalty for this attempt
$state->penalty = $question->penalty * $question->maxgrade;

// mark the state as graded
$state->event = ($state->event == QUESTION_EVENTCLOSE) ? QUESTION_EVENTCLOSEANDGRADE : QUESTION_EVENTGRADE;

return true;
}

Please use this very carefully, if at all and test very thoroughly in a non-production environment first.

Elsewhere on forums, people reported that they have been able to make it work with 1.9 too.

Good Luck and Happy Moodling!
In reply to Vikram Solia

Re: Negative marking to questions

by satish agrawal -

Hi Vikram,

We have changed both the functions mentioned above as per the code written above for implementing negative marking.

But, still our problem was not solve.

Please give us some suggestion regarding this.

We are having moodle 1.6.8+.

Satish

In reply to satish agrawal

Re: Negative marking to questions

by Francisco Garzón -
Hi all,

As Satish, we have also implemented Vikram's hack code in our Moodle 1.6.2 without full success. Now the MCQs are correctly graded on each individual questions but the final qualification still disregard the negative scores. I mean, when reviewing the quiz submitted by the students I can see that the wrong answers have received the negative grade assigned in the quiz, which didn't happen until Vikram's code. But the total mark is the exclusive add up of the positive grades without accounting for the negatives.


Any help?

Regards,

Paco
In reply to Francisco Garzón

Re: Negative marking to questions

by Tieku Bortei-Doku -

I used Vikram's hack successfully in both 1.6 and now 1.9.3. It works perfectly.

However that was after I picked up a little syntax error in his code. He added an extra “*/”) Maybe that's the problem you are seeing. See below (change the line in red to the line in green). Let me know if this fixes it.

Tieku



File: moodle\lib\questionlib.php

function question_apply_penalty_and_timelimit(&$question, &$state, $attempt, $cmoptions) {
// deal with penalty
if ($cmoptions->penaltyscheme) {
$state->grade = $state->raw_grade - $state->sumpenalty;
$state->sumpenalty += (float) $state->penalty;
} else {
$state->grade = $state->raw_grade;
}

// deal with timelimit
if ($cmoptions->timelimit) {
// We allow for 5% uncertainty in the following test
if (($state->timestamp - $attempt->timestart) > ($cmoptions->timelimit * 63)) {
$state->grade = 0;
}
}

// deal with closing time
if ($cmoptions->timeclose and $state->timestamp > ($cmoptions->timeclose + 60) // allowing 1 minute lateness
and !$attempt->preview) { // ignore closing time for previews
$state->grade = 0;
}

/* negative marks hack start: commented the line below */
/* negative marks hack start: commented the line below
// Ensure that the grade does not go down
$state->grade = max($state->grade, $state->last_graded->grade);
negative marks hack stop */
}
In reply to Tieku Bortei-Doku

Re: Negative marking to questions

by Caye Reinaldos -
It's work fine!!! Thanks a lot. I hope Moodle 2.0 include this feature.
In reply to Caye Reinaldos

Re: Negative marking to questions

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I hope so to. I am working on it. Just a question of whether it is finished in time to me included in 2.0 or 2.1
In reply to Tieku Bortei-Doku

Re: Negative marking to questions

by Timothy Takemoto -

So the only thing that changes is the that Vikram is commenting out the code which starts with the comment "make sure that the grade does not go down"

The middle two changes look like they are only about time limit/closing time.
But perhaps the top one is related.



In reply to Tieku Bortei-Doku

Re: Negative marking to questions

by kapil G -

Thank you so much,work fine in Moodle 1.9.10.smile

In reply to Vikram Solia

Re: Negative marking to questions

by Vishal Upadhayay -

Hi vikram. That's very good job but i m having some problem with this hack.

If student answer's two wrong answers with penelty of 1 on each..the negetive marks doesn't sums up to -2.

it jst show -1 as the raw score.

Even during the final review the marks doesnt comes down to negetive its display  0 over there.

Please check the below image..!!

Please reply i need help on this topic.!!

With regards

vishal Upadhayay

smile

Attachment file11.JPG
In reply to Jack Eapen

Re: Negative marking to questions

by Jalpa Bhavsar -

I am trying to apply the patch for negative marking in quiz from the patch uploaded to the tracker (MDL-1647).

MOODLE version is 1.9.3+ and its giving some HUNK error

Any solution ??????????????????????

In reply to Jalpa Bhavsar

Re: Negative marking to questions

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

You will need to ask the person who created it to make a version of the patch that works with moodle 1.9.10.

Alternatively, you could try to apply the rejected sections of the patch by hand.

In reply to Tim Hunt

Re: Negative marking to questions

by Jalpa Bhavsar -

Hi tim,

Does this patch will effects the core functionality of the multiple answers type question in quiz.

I want to ask whether if i apply these patch and if i dont want to the negative marking for other quiz than it will work or not ??

In reply to Jack Eapen

Re: Negative marking to questions

by chandrasekar J -

How can i add negative marks to my quiz in moodle 2.0.1+. Is there any plug-in for that.

In reply to chandrasekar J

Re: Negative marking to questions

by Ali Hastie -
Picture of Particularly helpful Moodlers

Yup! We'r looking for negative marks in Moodle 2.0.1+ also, has this been implemented yet?

Cheers.

In reply to Ali Hastie

Re: Negative marking to questions

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

No, but it will be there in Moodle 2.1.