Search Google Appliance

Information Technology

Calculated Questions

Calculated questions are individual numerical questions based on a formula using variables or "wild cards" (i.e {x} , {y}). These wild cards are selected randomly from a set of values when the quiz is taken. Note: Calculated questions can be complicated to set up. Consider using a Simple Calculated Question instead.

Example of a Calculated question:

Calculated question example

Edit a Calculated Question

  1. In the Question Bank, select the desired question category, then click Create a new question... and select Calculated simple and click Next. The Adding a question screen will open.
  2. Give the question a descriptive name - this makes it easy to identify it in the question bank. The question name is not visible to students.
  3. Enter question text, include any wild cards (variables) surrounded by curly brackets.
    Example: What is the area of a triangle in square meters with a base of {b} m and a height of {h} m ?
  4. Fill in Correct answer formula using the same wild cards as the question text in order to define how a correct answer will be calculated. Do not include an equal sign (=) in the formula.
    Example: 0.5*{b}*{h}
  5. Set Grade for the correct answer to 100%.
  6. Tolerance will accept answers as correct if they are within a certain range of the correct answer (+/- the tolerance). Set the value for this field; to only accept the exact correct answer, enter 0.
  7. To choose the number of decimal places for the correct answer, set Correct answer shows. Moodle will round the correct answer to the number of places set.
  8. Scroll to the bottom of the screen and click Save changes. The Choose wildcards dataset properties screen will open.
  9. Each wildcard that you specify in the answer formula must have an associated set of possible values - this is its dataset. Each of the wild cards is listed on this page along with a choice of dataset: For each wild card, choose will use a new shared dataset.
    • Private: only used by this question 
    • Shared: shared with other calculated questions in the same category 
      Note: Using a shared dataset can save time when you are creating a lot of similar calculated questions.
    To synchronize the wild card values with the other questions in the quiz, choose Synchronize, then click Next page. The Edit the wildcards datasets screen will open.

Edit the Datasets

There are two ways of creating values - you can type them in yourself and add them to the list, or you can have Moodle generate random values. The table at the top of the page will keep an updating count of how many wild cards have been added to the set.


Add/Delete Your Own Values 

Adding individual values to the list is easy:

  1. In the Item to add section, choose the value you want for each wild card item. You can ignore the Range of values since the values will not be random.
  2. Scroll down to the Add section and click Add (leaving the number of items set to 1)
  3. Repeat the above steps as many times as necessary (the maximum number of items is 100)

To delete values from the list:

  1. In the Delete section, select the number of items to delete
  2. Click Delete.

Let Moodle Generate Values

  1. In the Item to add section choose values for the Range of Values fields, and enter the lower and upper limits for the values you would accept.
  2. Choose a number of decimal places for the value.
  3. Choose the Distribution of values between the limits
    Uniform means any value between the limits is equally likely to be generated.
    Loguniform means that values towards the lower limit are more likely.
  4. Now move down to the Add section and choose Force regeneration of all wildcards.
  5. Next to Add, choose the number of sets of random values (items) you wish to add to the list. (Note that the maximum total number of items in your list is 100.)
  6. Finally, click Add to append the new values to to the dataset. The screen will reload and you will see a preview of the wild card values that have been added to your dataset.
    Note: If you want more control over the items that Moodle adds, you can do them one at a time and preview the values before you add them. Click Get New Item to Add to make Moodle generate new values in the Item to Add section at the top. If you like them, click Add for 1 item; if not, click Get New Item to Add again to get new values.

Finish the Question Set-up

Once you have added wild card values to the question dataset, you can finish creating the question. Click Save changes to save the question. The Question bank will open.

After creating a question, be sure to check to make sure the question works correctly. Click the magnifying glass icon Question preview next to the question in the Question bank to view a preview of the new question.


For additional instructions on setting up this question type including advanced formula options, see Calculated question type on Moodle Docs.