@@ -219,7 +219,7 @@ Python script that you create and embed in the problem. These problems
can be any type. Numerical input and text input problems are the most
popular write-your-own-grader.
.. image:: Images/WriteYourOwnGraderExample.gif
.. image:: Images/CustomPythonExample.png
:alt: Image of a write your own grader problem
Create a Write-Your-Own-Grader Problem
...
...
@@ -295,22 +295,53 @@ To create a image mapped input problem:
Math Expression Input
---------------------
In math expression input problems, students enter text that represents
a mathematical expression, and Studio changes that text to a symbolic
expression that appears below the field where the student is typing.
Unlike numerical input problems, which only allow integers and a few
select constants, math expression problems can include more complicated
symbolic expressions.
In math expression input problems, students enter text that represents a mathematical expression into a field, and the LMS changes that text to a symbolic expression that appears below that field.
When you create a math expression input problem for your students in
Studio, you'll use `MathJax <http://www.mathjax.org>`_ to change your
plain text into "beautiful math." For more information about how to use
MathJax in Studio, see :ref:`MathJax in Studio`.
.. image:: Images/MathExpressionInputExample.gif
:alt: Image of math expression input problem
Unlike numerical input problems, which only allow integers and a few select constants, math expression problems can include unknown variables and more complicated symbolic expressions. The grader uses a numerical sampling to determine whether the student's response matches the instructor-provided math expression, to a specified numerical tolerance. The instructor must specify the allowed variables in the expression as well as the range of values for each variable.
.. warning:: Math expression input problems cannot currently include negative numbers raised to fractional powers, such as (-1)^(1/2). Math expression input problems can include complex numbers raised to fractional powers, or positive non-complex numbers raised to fractional powers.
.. image:: Images/MathExpressionInputExample.gif
:alt: Image of math expression input problem
When you create a math expression input problem in Studio, you'll use `MathJax <http://www.mathjax.org>`_ to change your plain text into "beautiful math." For more information about how to use MathJax in Studio, see :ref:`MathJax in Studio`.
The LMS automatically converts the following Greek letter names into the corresponding Greek characters when a student types them in the answer field:
.. list-table::
:widths: 20 20 20 20
:header-rows: 0
* - alpha
- beta
- gamma
- delta
* - epsilon
- varepsilon
- zeta
- eta
* - theta
- vartheta
- iota
- kappa
* - lambda
- mu
- nu
- xi
* - pi
- rho
- sigma
- tau
* - upsilon
- phi
- varphi
- chi
* - psi
- omega
-
-
note:: ``epsilon`` is the lunate version, whereas ``varepsilon`` looks like a backward 3.
The Option Response input type allows the student to choose from a collection of
answer options, presented as a drop-down list.
This appendix provides information about the XML for most problem and tool types in Studio:
Option Response is structurally similar to Multiple Choice. Some conceptual
differences between the two include the following.
* :ref:`Checkbox`
* :ref:`Chemical Equation Response`
* :ref:`Custom Response`
* :ref:`Formula Response`
* :ref:`Image Response`
* :ref:`Multiple Choice`
* :ref:`Numerical Response`
* :ref:`Option Response`
* :ref:`Schematic Response`
* :ref:`String Response`
* The Multiple Choice radio button format makes it easier for students to read very long response options.
.. _Checkbox:
* The Option Response drop-down input format makes it more likely for students to think of an answer and then search for it, rather than relying purely on recognition to answer the question. The Multiple Choice format is more explicit and visual. This makes it a more appropriate choice for presenting tricky or complicated answer options which are intended to get the student to pause and think.
Choice Response (Checkbox)
---------------------------
Sample Problem:
.. image:: ../Images/image287.png
:width: 600
:alt: Image of an option response problem
.. image:: ../Images/CheckboxExample.gif
:alt: Image of a checkbox problem
**Problem Code:**
**Sample Problem XML**
.. code-block:: xml
<problem>
<startouttext/>
<p>Learning about the benefits of preventative healthcare can be particularly difficult. Check all of the reasons below why this may be the case.</p>
<p>Option Response is most similar to __________.</p>
<optionresponse>
<optioninput
options="('Multiple Choice','String Response',
'Numerical Response','External Response',
'Image Response')"
correct="Multiple Choice"/>1
</optionresponse>
<choiceresponse>
<checkboxgroup>
<choice correct="true"><text>A large amount of time passes between undertaking a preventative measure and seeing the result.</text></choice>
<choice correct="false"><text>Non-immunized people will always fall sick.</text></choice>
<choice correct="true"><text>If others are immunized, fewer people will fall sick regardless of a particular individual's choice to get immunized or not.</text></choice>
<choice correct="true"><text>Trust in healthcare professionals and government officials is fragile.</text></choice>
</checkboxgroup>
<solution>
<div class="detailed-solution">
<p>Explanation</p>
<p>Like Option Response, Multiple Choice also allows students to select
from a variety of pre-written responses.</p>
<p>People who are not immunized against a disease may still not fall sick from the disease. If someone is trying to learn whether or not preventative measures against the disease have any impact, he or she may see these people and conclude, since they have remained healthy despite not being immunized, that immunizations have no effect. Consequently, he or she would tend to believe that immunization (or other preventative measures) have fewer benefits than they actually do.</p>
The chemical equation problem type allows the student to enter chemical equations. The grader evaluates student responses by using a Python script that you create and embed in the problem.
.. image:: ../Images/option_response1.png
**Sample Problem**
.. image:: ../Images/ChemicalEquationExample.png
:alt: Image of a chemical equation response problem
<optioninput>
**Sample Problem XML**:
.. image:: ../Images/optionresponse2.png
.. code-block:: xml
<problem>
<startouttext/>
<p>Some problems may ask for a particular chemical equation. Practice by writing out the following reaction in the box below.</p>
if chemcalc.chemical_equations_equal(submission[0], 'H2SO4 -> H^+ + HSO4^-'):
correct = ['correct']
else:
correct = ['incorrect']
Multiple Choice
===============
</answer>
</customresponse>
<p>Some tips:</p>
<ul>
<li>Use real element symbols.</li>
<li>Create subscripts by using plain text.</li>
<li>Create superscripts by using a caret (^).</li>
<li>Create the reaction arrow (\(\longrightarrow\)) by using "->".</li>
</ul>
<endouttext/>
The Multiple Choice input type allows the student to select at most one choice
from a collection of answer choices, presented as a list of radio buttons.
<solution>
<div class="detailed-solution">
<p>Solution</p>
<p>To create this equation, enter the following:</p>
<p>H2SO4 -> H^+ + HSO4^-</p>
</div>
</solution>
</problem>
A Multiple Choice problem can have more than one correct answer, depending on
how many choices are marked as correct in the underlying XML. If all choices are
marked as incorrect, there is no correct response.
Multiple Choice is structurally similar to Option Response. Some conceptual
differences between the two include the following.
.. _Custom Response:
• The Multiple Choice radio button format makes it easier for students to read very long response options.
Custom Response ("Write-Your-Own-Grader")
------------------------------------------
• The Option Response drop-down input format makes it more likely for students to think of an answer and then search for it, rather than relying purely on recognition to answer the question.
In write-your-own-grader problems (also called “custom Python-evaluated input” problems), the grader evaluates a student’s response using a Python script that you create and embed in the problem. Students can enter more than one line of text.
• The Multiple Choice format is more explicit and visual. This makes it a more appropriate choice for presenting tricky or complicated answer options which are intended to get the student to pause and think.
**Sample Problem**
Sample Problem:
.. image:: ../Images/CustomPythonExample.png
:alt: Image of a custom response problem
.. image:: ../Images/image289.png
:width: 600
:alt: Image of a multiple choice problem
**Problem Code:**
**Sample Problem XML**:
.. code-block:: xml
<problem>
<p><b>Example Problem</b></p>
<p>How many correct responses can a Multiple Choice question have?</p>
<p>Part 1: Enter two integers that sum to 10. </p>
<customresponse cfn="test_add_to_ten">
<textline size="10" correct_answer="3"/><br/>
<textline size="10" correct_answer="7"/>
</customresponse>
<p>Part 2: Enter two integers that sum to 20. </p>
<customresponse cfn="test_add" expect="20">
<textline size="10"/><br/>
<textline size="10"/>
</customresponse>
<solution>
<div class="detailed-solution">
<p>Explanation</p>
<p>It depends on how many choices are marked as correct in the underlying XML.</p>
<p>Note that if all choices are marked as incorrect, there is no
correct response.</p>
<p>For part 1, any two numbers of the form <i>n</i> and <i>10-n</i>, where <i>n</i> is any integer, will work. One possible answer would be the pair 0 and 10.</p>
<p>For part 2, any pair <i>x</i> and <i>20-x</i> will work, where <i>x</i> is any real number with a finite decimal representation. Both inputs have to be entered either in standard decimal notation or in scientific exponential notation. One possible answer would be the pair 0.5 and 19.5. Another way to write this would be 5e-1 and 1.95e1.</p>
</div>
</solution>
</problem>
**Templates**
**Template**
The following template includes suggested correct answers (to include these, add a ``correct_answer`` attribute to the ``<textline>`` tag).
.. code-block:: xml
<problem>
<multiplechoiceresponse>
<choicegroup type="MultipleChoice">
<choice correct="false" name="a">A</choice>
<choice correct="true" name="b">B</choice>
</choicegroup>
</multiplechoiceresponse>
<script type="loncapa/python">
def test_add(expect,ans):
a1=float(ans[0])
a2=float(ans[1])
return (a1+a2)== float(expect)
</script>
<p>Enter two real numbers that sum to 20: </p>
<customresponse cfn="test_add" expect="20">
<textline size="10" correct_answer="11"/><br/>
<textline size="10" correct_answer="9"/>
</customresponse>
<solution>
<div class="detailed-solution">
</div>
</solution>
</problem>
The following template does not include suggested correct answers.
The String Response input type provides an input box in which the student can
enter a line of text, which is then checked against a specified expected answer.
Image Response
--------------
A String Response input does not provide any answer suggestions, so it can be a
good way to get the students to engage with the material more deeply in a
sequence and look up, figure out, or remember the correct answer themselves.
The Image Response input type presents an image and accepts clicks on the image as an answer.
Images have to be uploaded to the courseware Assets directory. Response clicks are marked as correct if they are within a certain specified sub rectangle of the image canvas.
Note that a student's answer in a String Response is marked as correct if it
matches every character of the expected answer. This can be a problem with
international spelling, dates, or anything where the format of the answer is not
clear.
*Note The Mozilla Firefox browser is currently not supported for this problem type.*
Sample Problem:
.. image:: ../Images/image291.png
.. image:: ../Images/image294.png
:width: 600
:alt: Image of a string response problem
**Problem Code:**
**Problem Code**:
.. code-block:: xml
<problem>
<p><b>Example Problem</b></p>
<p>What is the name of this unit? (What response type is this?)</p>
The Multiple Choice input type allows the student to select at most one choice
from a collection of answer choices, presented as a list of radio buttons.
A Multiple Choice problem can have more than one correct answer, depending on
how many choices are marked as correct in the underlying XML. If all choices are
marked as incorrect, there is no correct response.
Multiple Choice is structurally similar to Option Response. Some conceptual
differences between the two include the following.
• The Multiple Choice radio button format makes it easier for students to read very long response options.
• The Option Response drop-down input format makes it more likely for students to think of an answer and then search for it, rather than relying purely on recognition to answer the question.
• The Multiple Choice format is more explicit and visual. This makes it a more appropriate choice for presenting tricky or complicated answer options which are intended to get the student to pause and think.
Sample Problem:
.. image:: ../Images/image289.png
:width: 600
:alt: Image of a multiple choice problem
**Problem Code:**
.. code-block:: xml
<problem>
<p><b>Example Problem</b></p>
<p>How many correct responses can a Multiple Choice question have?</p>
<td>(optional) “[ci] [regex]”. Add “ci” if the student response should be graded case-insensitively. The default is to take case into consideration when grading. Add “regexp” for correct answer to be treated as regular expression.</td>
<td> </td>
</tr>
<tr class="row-odd"><td>answer</td>
<td>The string that is used to compare with student answer. If "regexp" is not presented in value of <em>type</em> attribute, student should enter value equal to exact value of this attribute in order to get credit. If "regexp" is presented in value of <em>type</em> attribute, value of <em>answer</em> is treated as regular expression and exact match of this expression and student answer will be done. If search is successful, student will get credit.</td>
kappa lambda mu nu xi pi rho sigma tau upsilon phi varphi chi psi omega``
* The Multiple Choice radio button format makes it easier for students to read very long response options.
Note: ``epsilon`` is the lunate version, whereas ``varepsilon`` looks like a
backward 3.
* The Option Response drop-down input format makes it more likely for students to think of an answer and then search for it, rather than relying purely on recognition to answer the question. The Multiple Choice format is more explicit and visual. This makes it a more appropriate choice for presenting tricky or complicated answer options which are intended to get the student to pause and think.
Sample Problem:
.. image:: ../Images/image293.png
.. image:: ../Images/image287.png
:width: 600
:alt: Image of a formula response problem
:alt: Image of an option response problem
**Problem Code**:
**Problem Code:**
.. code-block:: xml
<problem>
<p><b>Example Problem</b></p>
<p>This is a short introduction to the Formula Response editor.</p>
<p>Write an expression for the product of R_1, R_2, and the inverse of R_3.</p>
The Image Response input type presents an image and accepts clicks on the image as an answer.
Images have to be uploaded to the courseware Assets directory. Response clicks are marked as correct if they are within a certain specified sub rectangle of the image canvas.
Schematic Response
------------------
*Note The Mozilla Firefox browser is currently not supported for this problem type.*
The Schematic Response input type provides an interactive grid on which the
student can construct a schematic answer, such as a circuit.
Sample Problem:
.. image:: ../Images/image294.png
.. image:: ../Images/image297.png
:width: 600
:alt: Image of a schematic response problem
.. image:: ../Images/image298.png
:width: 600
:alt: Image of a schematic response problem
.. image:: ../Images/image299.png
:width: 600
:alt: Image of a schematic response explanation
**Problem Code**:
.. code-block:: xml
<problem>
<p><b>Example Problem</b></p>
<startouttext/>
<p>You are given three shapes. Click on the triangle.</p>
<p>A voltage divider that evenly divides the input voltage can be formed with two identically valued resistors, with the sampled voltage taken in between the two.</p>
<p>A simple high-pass filter without any further constaints can be formed by simply putting a resister in series with a capacitor. The actual values of the components do not really matter in order to meet the constraints of the problem.</p>
The String Response input type provides an input box in which the student can
enter a line of text, which is then checked against a specified expected answer.
Custom Response
===============
A String Response input does not provide any answer suggestions, so it can be a
good way to get the students to engage with the material more deeply in a
sequence and look up, figure out, or remember the correct answer themselves.
A Custom Response input type accepts one or more lines of text input from the student and evaluate the inputs for correctness using an embedded Python script.
Note that a student's answer in a String Response is marked as correct if it
matches every character of the expected answer. This can be a problem with
international spelling, dates, or anything where the format of the answer is not
clear.
Sample Problem:
.. image:: ../Images/image295.png
.. image:: ../Images/image291.png
:width: 600
:alt: Image of a custom response problem
:alt: Image of a string response problem
**Problem Code**:
**Problem Code:**
.. code-block:: xml
<problem>
<p><b>Example Problem</b></p>
<script type="loncapa/python">
def test_add_to_ten(expect,ans):
try:
a1=int(ans[0])
a2=int(ans[1])
except ValueError:
a1=0
a2=0
return (a1+a2)==10
def test_add(expect,ans):
try:
a1=float(ans[0])
a2=float(ans[1])
except ValueError:
a1=0
a2=0
return (a1+a2)== float(expect)
</script>
<p>This question consists of two parts. </p>
<p>First, enter two integers which sum to 10. </p>
<customresponse cfn="test_add_to_ten">
<textline size="40" /><br/>
<textline size="40" />
</customresponse>
<p>Now enter two (finite) decimals which sum to 20.</p>
<customresponse cfn="test_add" expect="20">
<textline size="40" /><br/>
<textline size="40" />
</customresponse>
<p>What is the name of this unit? (What response type is this?)</p>
<p>For the first part, any two numbers of the form <i>n</i>
and <i>10-n</i>, where <i>n</i> is any integer, will work.
One possible answer would be the pair 0 and 10.
</p>
<p>For the second part, any pair <i>x</i> and <i>20-x</i> will work, where <i>x</i> is any real number with a finite decimal representation. Both inputs have to be entered either in standard decimal notation or in scientific exponential notation. One possible answer would be the pair 0.5 and 19.5. Another way to write this would be 5e-1 and 1.95e1.
</p>
<p>The name of this unit is "String Response," written without the punctuation.</p>
<p>Arbitrary capitalization is accepted.</p>
</div>
</solution>
</problem>
**Templates**
*With displayed suggested correct answers*
**Template**
.. code-block:: xml
<problem>
<script type="loncapa/python">
def test_add(expect,ans):
a1=float(ans[0])
a2=float(ans[1])
return (a1+a2)== float(expect)
</script>
<p>Enter two real numbers which sum to 20: </p>
<customresponse cfn="test_add" expect="20">
<textline size="40" correct_answer="11"/><br/>
<textline size="40" correct_answer="9"/>
</customresponse>
<stringresponse answer="REPLACE_THIS" type="ci">
<textline size="20"/>
</stringresponse>
<solution>
<div class="detailed-solution">
</div>
...
...
@@ -976,162 +998,109 @@ Sample Problem:
</problem>
**Templates**
This response type allows to add more than one answer. Use `additional_answer` tag to add more answers.
*With NO suggested correct answers*
You can add `regexp` to value of `type` attribute, for example: `type="ci regexp"` or `type="regexp"` or `type="regexp cs"`.
In this case, any answer and hint will be treated as regular expressions.
Regular expression has to match whole answer, for answer to be correct.
Student answers "foobar", "o foo" or " ==foo==", will be correct if teacher has set answer=".*foo.*" with type="regexp".
**Template**
.. code-block:: xml
<problem>
<script type="loncapa/python">
def test_add(expect,ans):
a1=float(ans[0])
a2=float(ans[1])
return (a1+a2)== float(expect)
</script>
<p>Enter two real numbers which sum to 20: </p>
<customresponse cfn="test_add" expect="20">
<textline size="40" /><br/>
<textline size="40" />
</customresponse>
<solution>
<div class="detailed-solution">
</div>
</solution>
<stringresponse answer="a1" type="ci regexp">
<additional_answer>\d5</additional_answer>
<additional_answer>a3</additional_answer>
<textline size="20"/>
<hintgroup>
<stringhint answer="a0" type="ci" name="ha0" />
<stringhint answer="a4" type="ci" name="ha4" />
<stringhint answer="^\d" type="ci" name="re1" />
<hintpart on="ha0">
<startouttext />+1<endouttext />
</hintpart >
<hintpart on="ha4">
<startouttext />-1<endouttext />
</hintpart >
<hintpart on="re1">
<startouttext />Any number+5<endouttext />
</hintpart >
</hintgroup>
</stringresponse>
</problem>
.. raw:: latex
\newpage %
.. _Chemical Equation Response:
Chemical Equation Response
==========================
The Chemical Equation Response input type is a special type of Custom Response
that allows the student to enter chemical equations as answers.
Sample Problem:
.. image:: ../Images/image296.png
:width: 600
:alt: Image of a chemical equation response problem
**Problem Code**:
**XML Attribute Information**
.. code-block:: xml
<stringresponse>
<problem>
<p><b>Example Problem</b></p>
<startouttext/>
<p>Some problems may ask for a particular chemical equation. Practice by writing out the following reaction in the box below.</p>
<td>(optional) “[ci] [regex]”. Add “ci” if the student response should be graded case-insensitively. The default is to take case into consideration when grading. Add “regexp” for correct answer to be treated as regular expression.</td>
<td> </td>
</tr>
<tr class="row-odd"><td>answer</td>
<td>The string that is used to compare with student answer. If "regexp" is not presented in value of <em>type</em> attribute, student should enter value equal to exact value of this attribute in order to get credit. If "regexp" is presented in value of <em>type</em> attribute, value of <em>answer</em> is treated as regular expression and exact match of this expression and student answer will be done. If search is successful, student will get credit.</td>
<td> </td>
</tr>
</tbody>
</table>
</answer>
</customresponse>
<p> Some tips:<ul><li>Only real element symbols are permitted.</li><li>Subscripts are entered with plain text.</li><li>Superscripts are indicated with a caret (^).</li><li>The reaction arrow (\(\longrightarrow\)) is indicated with "->".</li></ul>
<p>A voltage divider that evenly divides the input voltage can be formed with two identically valued resistors, with the sampled voltage taken in between the two.</p>
<p>A simple high-pass filter without any further constaints can be formed by simply putting a resister in series with a capacitor. The actual values of the components do not really matter in order to meet the constraints of the problem.</p>