Today we got an interesting query from a lecturer who said that the Short Answer wildcard options did not work properly when marking student responses. He pointed out to a quiz in his course that did not seem to correctly mark the student attempts correctly for a particular short answer question. We spent a lot of time trying to find out why things did not work properly and this is what we found:
(We use Moodle v2.7.3 at the moment.)
Say there is a C++ programming short answer question as such:
Correct the line marked in red.
int main()
{
cout >> "Hello!" >> endl;
system("PAUSE");
return 0;
}
And lets say that the answer set defined for this short answer question is:
Answer | Mark |
---|---|
cout << "Hello!" << endl; | 100% |
cout<<"Hello!"<<endl; | 100% |
cout*<<*"Hello*"*<<*endl; |
50% |
*end1* |
0 |
When viewing the Statistics page for this question, you get something like this:
Notice how cout<<"Hello!"<<endl; isn't displayed correctly. Instead <endl; is treated as a HTML tag.
Perhaps, htmlentities() needs to be called before displaying the response data. I see that in /mod/quiz/report/statistics/staticstics_question_table.php, raw values are used.