30 August 2012

Grade quiz response by word count

You can use regular expressions to grade automatically the answer to an essay question based on a minimum number of words.
  • Create a new question on a Quiz as a Short Answer
  • Type in the question on the Question Text section.
  • In the Add Blank section:
    • Choose the Rows and Columns for the answer box.
    • Type in the code on the Answer box exactly as it appears below.
    • Type 100 for the Weight
    • Choose the Regular Expression radio button.
([\w\p{P}]*\s){99,}


This set of variables means at least 99 words, each followed by any whitespace character (including space, tab, etc.). This code would work to check for a 100-word essay.

If a student types the minimum number of words based on the regular expression, points will be automatically awarded  based on the Weight assigned to that Answer. You can change these points based on the content of the words by grading students' attempts at this question.

No comments: