How to Create Wildcards and datasets in Moodle

When creating Calculated and Calculated mutichoice questions in the Moodle 2.3 Question Bank, Wildcards and Datasets can be created for randomizing the question answers. For example, If the question is on Addition of integers, the when previewing the question, 2 + 5 will show at one time and 5 + 7 at another time. This allows the questions to be randomized, preventing students from making a answer key for the Quiz. The following article will explain how to make Wildcards and datasets to randomize quiz answers.

What is a Dataset? A Dataset is a group of possible numbers to use in the equation. Datasets are listed as items with a wild card value. For example, if there a 4 items in a dataset that hold a value for the variable (ie. the variables could be represented by the number 5, 10, 12, or 15), Moodle will generate 4 different versions of the question with those parameters.

What is a Wildcard? A Wildcard will use the Dataset to randomize each question that will uses the same data set. For example if the question is {A} + 25 and the Dataset is 5, 10, 12, or 15, then the quiz questions will display either 5 + 25, 10 + 25, 12 + 25, or 15 + 25.

Creating Wildcards and datasets

  1. Log into the Moodle Dashboard
  2. Navigate to Front page settings > Question bank > Questions. Select a Calculated question and click the edit link. If there are no Calculated questions created, create one. After selecting the question to edit, scroll to the bottom and click Save changes.
  3. wildcard-dataset-1-choose-moodle

    The Choose wildcards dataset properties page should display. To create a new dataset for a Wildcard, select will use a new shared dataset. In this example, the wildcard is a newly created one so select Do not synchronize. Click Next page.

    Choose wildcards dataset properties
    Mandatory wild cards present in answerswill use the same existing private dataset as before: This option will use a wildcard that was made previously
    will use a new shared dataset: This option will create a new wildcard dataset
    Possible wild cards present only in the question textThis will show any possible wildcards that can be used in the question.
    Synchronize the data from shared datasets with other questions in a quizDo not synchronize: This will keep the Wildcard dataset for the existing question only.
    Synchronize: This will apply the Wildcard dataset to all questions using the same Wildcard throughout the question bank.
    Synchronize and display the shared datasets name as prefix of the question name: This synchronizes the Wildcard with other questions and append the question name to it.


  4. wildcard-dataset-2-add-moodle

    On the Edit the wildcards datasets page, Fill in the parameters for the Item to add. Below is a table of the definitions of the values.

    Item to add
    Shared wild cardThe Shared wild card field is for setting the value of what the variable will be.
    Range of Values MinimumThe Range of values will allow Moodle to generate a number between these values..
    Decimal placesThe question can be set to have a decimal up to 9 places.
    DistributionUniform or Loguniform can be selected here. Uniform will use the entire range of values. Loguniform will use values from the lower limit of the range of values.
  5. Answers tolerance parameters can be set here. this will use the parameters set when creating the question. The Tolerance can be edited here as well. For more information on editing the Tolerance of a question please see Working with the calculated question Tolerance in Moodle 2.3
  6. wildcard-dataset-3-reuse-moodle

    Add a Dataset. Leave the radio button checked and select the quantity of wildcard sets to create. Click Add. In this tutorial, 4 datasets were added to the Wildcard.

    Important! You must add at least one dataset item before you can save this question.


    Edit the wildcards datasets
    Next ‘Item to Add’reuse previous value if available: If there are previous sets of the same wildcard, this option will allow that same set to be used.
    forceregeneration of only non-shared wildcards: This will forcibly generate the new item not based off any shared wild cards.
    forceregeneration of all wildcards: This will forcibly generate the new item regardless of if the wildcard is shared or not.
    Add itemIn this section, a group of random new set(s) of wild card(s) values can be created. The items can be generated one at a time or in groups of 10 up to 100.
  7. wildcard-dataset-4-set-moodle

    When the Dataset is added, the Set will show at the bottom. The Shared wild card number will be generated and the equation will display. Below will show the Tolerance of what the correct answer will be.
    wildcard-dataset-4-shared-moodle

    Now at the top of the Edit the wildcards datasets page, the Question will show the quantity of datasets for the Question in the Items Count column.

    wildcard-dataset-5-final-moodle

    When previewing the question, each time the question is accessed, the question will change depending on the amount of datasets. In this case, 4 datasets were created so there are 4 different equations available for the question. Datasets can be reused for different questions as well. For example, when using the {A} wildcard in other questions, the question can use the same randomized dataset.


This concludes the article for Setting up Wildcards and datasets in Moodle 2.3. Please check the next article on Setting up a Calculated Simple question in Moodle 2.3.

InMotion Hosting Contributor
InMotion Hosting Contributor Content Writer

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

2 thoughts on “How to Create Wildcards and datasets in Moodle

  1. how would you use logical statements (if else if or else) in the calculating the answers with wild cards?

    1. Hi Heinrich. I think I see what you’re going for; are you trying to create questions that follow a simple logical pattern, or questions that go down a tree of answers based on a previous one that requires students to choose the right path of reasoning? If so, that’s going to be some rather advanced functionality for this question type. There may be a way to set that up using the wildcards to follow Boolean logic, but I’m not aware of what it is.

      I’d suggest checking the Moodle plugins directory, to see if someone has already come up with a solution to this issue, and then consider reaching out to the Moodle development team or other Moodle developers for Moodle-specific assistance. Hope that helps!

Was this article helpful? Join the conversation!

Server Madness Sale
Score Big with Savings up to 99% Off

X