6.11 Tutorial: Displaying Answers vs. Formulas for Answers
After grading, for questions answered incorrectly, you can display the:
- calculated value of the answer field
- formula used to define the answer
Depending on your instructional objectives, you can display one or both.
Displaying the answer Field Formula:
In some cases, you may feel that there is extra instructional benefit to be derived from showing the student the correct formula instead of the final answer. If you do not use the comment field in your question definition, the default system behavior after grading is to display the value of the answer field. To return the formula, assign it to the answer field. If the answer field is defined by a formula using variables, the system displays a formula, with algorithmically generated data substituted for the variables.
Example 1 If a student gives the wrong answer to the question:
qu.1.topic=Displaying Answers vs Formulas for Answers@
qu.1.1.mode=Formula@
qu.1.1.name=Kinetic energy of random object@
qu.1.1.algorithm=
$mass=decimal(1,rand(1, 10));
$velocity=decimal(1,rand(10, 15));
@
qu.1.1.question=
An object of mass $mass kg is moving at a speed of $velocity m/s. What is its kinetic energy (in joules)? @
qu.1.1.answer= (1/2)$mass*($velocity)^2@
the system displays the correct answer as:
Correct answer: (1/2) 5.4 * (11.3)^2
(assuming that the randomization set $mass=5.4 and $velocity=11.3).
Displaying the Calculated Final Answer:
In some cases, you will prefer to return only the final answer.
To return only the final answer:
- Do not use the comment field in your question definition.
- Create a variable, $ans, that holds the formula for the answer.
- Use the $ans variable in the answer field instead of the formula for the answer.
Example 2 If a student gives the wrong answer to the question:
qu.1.2.mode=Formula@
qu.1.2.name=Show only final calculated answer@
qu.1.2.editing=useHTML@
qu.1.2.algorithm=
$mass=rand(4,8,2);
$velocity=rand(10,20,2);
$ans=sig(2, (1/2)$mass * ($velocity)^2)
@
qu.1.2.question=
What is the kinetic energy of a body of mass $mass kg moving at $velocity m/s?@
qu.1.2.answer=$ans@
the system displays the correct answer as:
Correct answer: 900
(assuming that the algorithmically generated variables set $mass=4.5 and $velocity=20).
In this case an incorrect response by the student shows only the correct numerical answer (to 2 significant figures).
Displaying Both the Formula for the Answer and the Final, Calculated Answer:
To show the student both the correct formula and the calculated answer, combine these methods and use the comment field.
- Create a variable, $ans, that holds the formula for the answer.
- Use the $ans variable in the comment field, along with the formula for the answer.
Example 3 If a student gives the wrong answer to the question:
qu.1.3.mode=Formula@
qu.1.3.name=Shows both calculated and formula answers@
qu.1.3.comment=
<br>This answer is derived according to the general formula,
<br>kinetic energy = (1/2)mass * (velocity<sup>2</sup>)
<br>In this case, the kinetic energy is
<br>(1/2)$mass * $velocity<sup>2</sup>, or $ans.
@
qu.1.3.editing=useHTML@
qu.1.3.algorithm=
$mass=rand(4,8,2);
$velocity=rand(10,20,2);
$ans=sig(2, (1/2)$mass * ($velocity)^2)
@
qu.1.3.question=
What is the kinetic energy of a body of mass $mass kg moving at $velocity m/s?@
qu.1.3.answer=$ans@
the system displays the correct answer as:
Correct answer:
This answer is derived according to the general formula,
kinetic energy = (1/2)mass * (velocity^{2})
In this case, the kinetic energy is
(1/2)7.6 * 19^{2}, or 1,400.
(assuming that the algorithmically generated variables set $mass=7.6 and $velocity=19).
Consider another example.
Example 4
qu.1.4.mode=formula@
qu.1.4.algorithm=
$a=rint(12)+1;
$b=rint(12)+1;
$c=rint(12)+1;
@
qu.1.4.question=
Find the solution of the linear equation
${a}x + ${b}=${c}.
@
qu.1.4.answer=(${c}-${b})/${a}@
The above code chooses random integer coefficients $a, $b, and $c between 1 and 12. The formula for the answer is calculated in the answer field.
Although the above example does not cause errors, there are several side effects:
- The answer is displayed in the form (7-3)/5 (for example). This provides an indication of the method for obtaining the answer, which may be inappropriate.
- The above format can return answers of the form (7-7)/5, which is more complicated than the simplified form, 0.
To avoid these issues, rewrite this example as follows, using a new variable $ans (so that you return only the final answer (to 3 decimal places)):
Example 5
qu.1.5.mode=formula@
qu.1.5.algorithm=
$a=rint(12)+1;
$b=rint(12)+1;
$c=rint(12)+1;
$ans=decimal(3,($c-$b)/$a);
@
qu.1.5.question=
Find the solution of the linear equation
${a}x+${b}=${c}.
@
qu.1.5.answer=$ans@
See Also:
Adding and Editing Feedback