Numeric questions and dropped leading zeroes

Numeric questions and dropped leading zeroes

by Janet DiVincenzo -
Number of replies: 13
I have numeric questions for which the correct answers are numbers such as 00000 and 001011. The problem is that Moodle drops the leading zeroes.

When setting up the quiz, is there a character I can add to tell Moodle to not drop the leading zeroes?

Thank you for your help!


Average of ratings: -
In reply to Janet DiVincenzo

Re: Numeric questions and dropped leading zeroes

by John Rodgers -
Unless you require a tolerance in your answers, you can just go with a short answer type question and it will have the same result.
Average of ratings: Useful (1)
In reply to John Rodgers

Re: Numeric questions and dropped leading zeroes

by Janet DiVincenzo -
In case anyone else is following this, I thought I would report back.

I changed my question type from numeric to short answer, but Moodle still shows the correct answer as 0 (when I ask it to display the correct answer), even though the correct answer is 000000. It grades it correctly, which is more important, but it is still truncating the six zeroes to one zero when it displays the correct answer. I think for this quiz, I will suppress showing the right answers during feedback, just to avoid confusion. Not optimal but it will work.
In reply to Janet DiVincenzo

Re: Numeric questions and dropped leading zeroes

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

Janet "Moodle still shows the correct answer as 0 (when I ask it to display the correct answer)..."

I don't understand what you mean, on attached screenshot all 6 zeroes are displayed.

Joseph

Attachment image01.jpg
In reply to Joseph Rézeau

Re: Numeric questions and dropped leading zeroes

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Well, Janet, what do you say?
Joseph
In reply to Joseph Rézeau

Re: Numeric questions and dropped leading zeroes

by Janet DiVincenzo -
Joseph,

It is really puzzling to me that you were able to make it work. I could not get either the numeric question type OR the short-answer question type to return a string of zeroes back to me in the form of the correct answer or the student-supplied answer.

I am using Moodle. 1.9.7.

Janet
In reply to Joseph Rézeau

Re: Numeric questions and dropped leading zeroes

by Itamar Tzadok -
Joseph, I think Janet is referring to the cloze shortanswer whereas your screenshot above is of the short-answer question type. I've just reproduced the problem in 1.9.4+. The question cloze code is: {:SHORTANSWER:=00000#00000} smile
Attachment quiz-cloze-00000.png
In reply to Itamar Tzadok

Re: Numeric questions and dropped leading zeroes

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

Itamar, I'm surprised that Janet would have been referring to the Cloze question originally, because in a later post she wrote "I changed my question type from numeric to short answer...". The numeric question type does not exist in Cloze!

Janet, what do you say?

Joseph

PS.- I am of opinion that it often makes things much easier to understand and saves a lot of guess-work when people can post screenshots to complement their posts (like we both do wink).

In reply to Joseph Rézeau

Re: Numeric questions and dropped leading zeroes

by Itamar Tzadok -
It was precisely the Unbearable Lightness of Changing that the clause you quoted seemed to convey that made me think of the cloze type despite the possible terminological imprecision in 'numeric' as opposed to 'numerical'.

{:NUMERICAL:=00000:0.0#00000}

=>

{:SHORTANSWER:=00000#00000}

But that may just be the roundabout way I sometimes see things. wink

In reply to Joseph Rézeau

Re: Numeric questions and dropped leading zeroes

by Itamar Tzadok -
Seems to be fixed on Moodle demo so it might have been reported and fixed between 1.9.7 and latest 1.9.x. smile
Attachment quiz-cloze-00000-1.png
In reply to Janet DiVincenzo

Re: Numeric questions and dropped leading zeroes

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
As others have said, those answers are not numerical quantities, because you are interested in the specific form of the answer, not just the numerical quantity.

Therefore, you should be using the short answer question type.

In the past, there have been bugs where the shortanswer question type got confused by string like '0'. This is to do with with some of the weird things that PHP (the computer language that Moodle is written in) does by default. I thought we had successfully found an fixed all of those, but if you do find a situation where an answer like 00000 is not processed correctly, please report it, but be very specific about exactly where the problem is. (For example, if you can make a screen-grab that demonstrates the problem, that would be good.)
In reply to Tim Hunt

Re: Numeric questions and dropped leading zeroes

by John Rodgers -
While we're talking about zero's, GIFT format chokes when importing numeric answers of 0, I guess for some obvious reasons. (moodle 1.9.8 I think) Is that Howard's purview?
In reply to John Rodgers

Re: Numeric questions and dropped leading zeroes

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Would be great if you could make a really simple import file that demonstrates this problem with one question. Then file an issue at http://tracker.moodle.org/ and assign it to Howard.