Moodle: Activities & Resources: Quiz Question Types: Regular Expression Short Answer


Regular Expression Short Answer is an enhanced short answer question type that analyzes the student's response more thoroughly by using regular expression (RegExp) syntax. It is best used with questions that require natural language answers and not mathematical or scientific answers.

Possible answers must be written using RegExp syntax. Question settings allow entry of several possible answers, and the first answer entered must be the best possible answer.Learning RegExp syntax can take some time, so be sure to use the following reference pages before attempting to create this question type.

Examples

Here is an example of a regular expression short answer response in sentence form with a symbol, still marked correct because of how the RegExp was written in the question settings.

Correct Regular expression short answer example

Here is an example of where all possible answers were entered in an attempt to fish for points but earned zero based on the RegExp constructed.

Example of regex short answer marked incorrect

The following explains how to enter these questions in the question bank.


Adding a Regular Expression Short Answer Question to the Question Bank
 

  1. In your Moodle course, click on a quiz or on your Course Administration menu.
     
  2. In either the Quiz Administration menu or the Course Administration menu, click Question Bank and then Questions.

    Course Administration menu with question bank and questions links highlighted
     
  3. Inside the question bank, click Create a new question.

    question bank with "create new question" selected
     
  4. Select Regular expression short answer from the list of question types and then click Add.
     
  5. Complete the general settings, including the selected category, Question name, and Question text.

    NOTE: It is suggested that the instructor make sure that the category is correct for better organization and that the question name is specific to the question or section topic so that it is easier to find and edit later.
     
  6. Answer 1 must be a correct answer that does not use RegExp syntax. It will also be the first or only correct answer shown depending on whether Show alternate is set to Yes (not recommended when generating a large number of answers using RegExp). Custom feedback can also be added.

    Answer 1 must be correct and not use regular expression.
     
  7. In the subsequent Answers, use RegExp syntax to provide more correct and incorrect responses. Custom feedback can also be added for each answer.

    Answers 2-4 that use RegExp to generate more correct and incorrect answers.
     
  8. After clicking Save changes and continue editing, you will be able to see errors if you have any in your RegExp. You can also click Show/Hide alternate answers and (Re-)Calculate alternate answers to preview all possible generated correct answers.

    Preview of generated correct responses.
     
  9. Finally, if your quiz setting for How questions behave is set to Adaptive mode (with or without penalties), the Help button mode can be set to None, Letter, Word, or Word or punctuation. If a penalty is to be set with the use of the help button, options for Settings for multiple tries and Buying letters or words appear below the answer blanks. If How questions behave is set to Interactive with multiple tries, then Hints provided under this setting will be presented to the test taker.
     
  10. When you are finished creating the question, answers, and reviewing the additional settings, Save your changes.
     
  11. To add your newly created question to a Quiz, see the GROK article Adding Quiz Questions to a Quiz.

 

Additional Resources

For more information on using Quizzes and RegExp syntax, see the following resources:

Support & Training

The Faculty Technology Center (FTC) provides Moodle support by email, by phone, or live through Zoom. For contact information, please see the article Faculty Technology Center: LSU Overview. To connect through Zoom and for further information on support services and training, see the LSU Online & Continuing Education Faculty Resources & Support page.

The FTC also provides just-in-time faculty training opportunities and recorded training sessions. Attending at least one training session for Moodle upgrades is highly recommended. For a comprehensive list of available workshops and recordings, please see the LSU Online & Continuing Education Technology Training page.

20525
2/23/2024 12:27:44 PM