How do I create a calculated question?

This allows for a calculated question to be added to a new or existing assessment. A calculated question calculates new answers for every test, based on variables whose value changes each time. The answer is based on a formula, using those variables.

Go to Tests & Quizzes.

Select the Tests & Quizzes tool from the Tool Menu of your course.

Select an assessment.

Questions may be added to any assessment. Select an existing assessment or create a new one.

Note: You may also add a question directly to a question pool.

Create a New Assessment.

Click Add.

Create a new assessment.

For more information on creating new assessments, see How do I create an assessment?

  1. Enter an Assessment Title.
  2. Select the Create using assessment builder radio button.
  3. Click Create.

Or edit an existing assessment.

Select Calculated Question from drop-down menu.

After selecting Calculated Question from the drop-down menu, the program will open options for the question.

Set the point value for the question.

Enter the point value for this question. Questions may be worth any point value you choose.  

Tip: Keep in mind that the point value of all the questions in the assessment will equal the point value of the assessment in the Gradebook. So if you want your assessment to be worth a total of 100 points, you should assign point values to your questions accordingly.

Display points?

If you want students to see the point value as they are taking the test, leave the default setting of Yes. If you prefer that students do not see the point value for the question, select No.

Extra Credit. (Optional)

Selecting this option lets you mark a question as extra credit. This means that the points awarded for this question are not counted as part of the "total points" for the assessment and there are no points deducted for skipping this question or answering incorrectly. However, users answering correctly will receive the question point value added on top of their total points earned in the assessment.

Description and Instructions

A description of the Calculated question type, including examples and instructions for creating a Calculated question follow.

What is a Calculated Question

A calculated question calculates new answers for every test, based on variables whose value changes each time. The answer is based on a formula, using those variables. That is, the variables will be randomly generated from your specified minimum and max range and the formula will be the input the student would be asked for.

A variable definition has a name, a minimum and maximum value, and a number of decimal places. A formula definition has a name, an mathematical expression that uses the variables, and a tolerance, so that answers within that tolerance of the answer are also considered correct.

Example 1

Kevin has {x} apples. He buys {y} more. Now Kevin has [[{x}+{y}]]. Jane eats {z} apples. Kevin now has {{w}} apples.

The formula w in the example above would be defined as: {x} + {y} - {z}.

The above question will then be displayed as the following question for the student: Kevin has 4 apples. He buys 2 more. Now Kevin has 6 apples. Jane eats 2 apples. Kevin now has ___ apples.

Example 2

Solve: cos({a}) * ({c} - {b}) = {{z}}.

The formula z in the example above would be defined as: cos({a}) * ({c} - {b}).

Instructions

Steps to create a Calculated Question

  1. Fill out the Question Text with the information that the student will see, including the variable and formula placeholders (see examples below).
  2. Press the "Extract Variables, Global Variables, Calculations, and Formulas from Question Text" button to create the variables and formulas.
  3. Change the Min, Max, and Decimal Places for all of the variables to define their ranges of valid values.
  4. Enter the mathematical expression for each Formula, inserting the Variables where needed.
  5. Press the Save button to save your work.
  6. Any errors will be displayed at the top of the page. They must be fixed before saving. Fields with errors will be highlighted to show you where you have problems.

Syntax Guidelines

Create variables

  • {}
  • Use curly braces {} around a letter to create variables.
  • Kevin has {x} apples.

Calculations

  • [[]]
  • Internal calculations using the variables can be added using double square brackets [[]].
  • The area of a square is [[ {s} * {s} ]]m. Find the side length {{Z}}. Formula Z would be {s}.

Create formulas for student input

  • {{}}
  • Use double curly braces {{}} around a letter to create a formula.
  • Kevin has {x} apples. He buys {y} more. Now Kevin has [[{x}+{y}]]. Jane eats {z} apples. Kevin now has {{w}} apples. The formula w in the example above would be defined as: {x} + {y} - {z}.

Create Global Variables

  • @@
  • Global variables are intermediate formulas that can be used within the instructions, other global variables, answer formula, or feedback. Use @@ around the variable names to create a global variable. To display the value of the global variable in the question, rather than the formula, use the double square brackets for internal calculations around the global variable placeholder.
  • @x1@ or [[@x1@]]

Definitions

Variables: These are random numbers generated from the minimum and maximum range specified in the 'variables' section. Variables are uniquely generated for each student and quiz attempt based on this range.

Formulas: Formulas are pre-defined relationships between the variables.

Creating global variables: In a global variable you can store a formula and in other sections (instructions, global variables, solution, feedback) you can use this global variable to refer to the calculation.

Additional Information

  1. You may define acceptable tolerance as a constant (0.01) or percentage (1.5%) of the answer. (Defaults to 0.01).
  2. Variables and formulas support decimals. Default is 3.
  3. Warning! When setting the number of decimals to be applied in the FORMULA, you must use the same (or less) number of decimals in the TOLERANCE field, otherwise you may get unexpected results in the correction of the question.
  4. Valid operators: + - * / ^ ! # ()
  5. You can use many math functions including: sin, cos, tan, asin, acos, atan, abs, exp, sgn, sqrt, log10, and ln.
  6. Characters └ and ┐ are reserved characters and cannot be used in the question text.
  7. You can use scientific notation in variables, global variables, formulas and calculations (e.g 6.02310e23 or 1.67e-27).
  8. There are built-in constants like pi(3.14...), e(2.718...), or [phi](1.618..). Use them in your formula expression.
  9. Variables, Global Variables and formulas names are alpha-numeric but must begin with an alpha character.
  10. Variables, Global Variables and formulas cannot have the same name.

Add Question Text.

Type the Question Text into the text box provided. This is the information that the student will see, including the variable and formula placeholders (see examples below).

Variables: Define variables to use in this question below. Reference them in the question text by putting them in single curly braces (e.g., {x}). Variable names are alpha-numeric but must begin with an alpha character.

Example: Kevin has {x} apples. Jane eats {y}. How many does Kevin have now? {{z}}

Formulas: Place double curly braces (e.g., {{y}}) around a formula name to define where the student's input box will display. Formula names are alpha-numeric but must begin with an alpha character.

Example: Solve: cos({a}) * ({c} - {b}) = {{z}}.

The formula z in the example above would be defined as: cos({a}) * ({c} - {b}).

Keep in mind the following:

  • You may define acceptable tolerance as a constant (0.01) or percentage (1.5%) of the answer. (Defaults to 0.01.)
  • Variables and formulas support decimals. Default is 3.
  • Valid Operators: + - * / ^ ! # ( )
  • You can use many math functions including: sin, cos, tan, asin, acos, atan, abs, exp, sgn, sqrt, log10, and ln.
  • There are two built-in constants, PI(3.14...) and e(2.718...). Use them in your answer expression.
  • Variables and Formulas cannot have the same name.
  • See http://mathparser.org/mxparser-math-collection/ for the full set of valid math functions and operators.

Note: To edit with Rich Text Editor, click the hyperlink to open the full menu.

Add attachment. (Optional)

Click Add Attachments to browse for and select a file attachment if desired.

Click Extract Variables, Calculations, and Formulas.

Click the Extract Variables, Calculations, and Formulas from Question Text button to create the variables and formulas.

Define ranges of variable values.

Change the Min, Max, and Decimal Places for all of the variables to define their ranges of valid values.

Enter the formula.

Enter the mathematical expression for each Formula, inserting the Variables where needed.

Click the Check Formulas button once you have entered the formula.

If the formula is valid, you will see an OK status message.

Is it timed? (Optional)

This setting allows you to specify a time limit for an individual question. If timed, students have until the end of the time limit, or until the Final Submission Deadline, whichever comes first, to submit their work. Their answers will be automatically saved and submitted at the expiration of the timer.

Setting a time limit for an individual question can be useful if you would like to time students' responses per question, rather than setting a time limit for the entire assessment which may contain several different questions.

Assign to part. (Optional)

If you have multiple parts in your assessment, you may assign the question to a different part.

Assign to pool. (Optional)

If you have an existing question pool and would like to copy this question to the pool, select the pool name here.

Add feedback for correct answer and/or incorrect answer. (Optional)

Feedback is optional text available for the student to review after the particular question is graded. For numeric response questions, the feedback option is offered for correct and/or incorrect answers, if desired.

Note: To edit with the Rich Text Editor, click the hyperlink to open the full menu.

Click Save.

Click Save to save the question (or Cancel to exit).