@@ -219,7 +219,7 @@ Python script that you create and embed in the problem. These problems
...
@@ -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
can be any type. Numerical input and text input problems are the most
popular write-your-own-grader.
popular write-your-own-grader.
.. image:: Images/WriteYourOwnGraderExample.gif
.. image:: Images/CustomPythonExample.png
:alt: Image of a write your own grader problem
:alt: Image of a write your own grader problem
Create a Write-Your-Own-Grader Problem
Create a Write-Your-Own-Grader Problem
...
@@ -295,22 +295,53 @@ To create a image mapped input problem:
...
@@ -295,22 +295,53 @@ To create a image mapped input problem:
Math Expression Input
Math Expression Input
---------------------
---------------------
In math expression input problems, students enter text that represents
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.
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.
When you create a math expression input problem for your students in
.. image:: Images/MathExpressionInputExample.gif
Studio, you'll use `MathJax <http://www.mathjax.org>`_ to change your
:alt: Image of math expression input problem
plain text into "beautiful math." For more information about how to use
MathJax in Studio, see :ref:`MathJax in Studio`.
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.
.. 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
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`.
:alt: Image of math expression input problem
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.
This appendix provides information about the XML for most problem and tool types in Studio:
===============
The Option Response input type allows the student to choose from a collection of
* :ref:`Checkbox`
answer options, presented as a drop-down list.
* :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`
Option Response is structurally similar to Multiple Choice. Some conceptual
.. _Checkbox:
differences between the two include the following.
* The Multiple Choice radio button format makes it easier for students to read very long response options.
Choice Response (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.
Sample Problem:
Sample Problem:
.. image:: ../Images/image287.png
.. image:: ../Images/CheckboxExample.gif
:width: 600
:alt: Image of a checkbox problem
:alt: Image of an option response problem
**Problem Code:**
**Sample Problem XML**
.. code-block:: xml
.. code-block:: xml
<problem>
<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>
<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>
<optionresponse>
<solution>
<optioninput
<div class="detailed-solution">
options="('Multiple Choice','String Response',
<p>Explanation</p>
'Numerical Response','External Response',
<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>
<p>Like Option Response, Multiple Choice also allows students to select
<p>Explanation text</p>
from a variety of pre-written responses.</p>
</div>
</div>
</solution>
</solution>
</choiceresponse>
</problem>
</problem>
.. _Chemical Equation Response:
**Template**
Chemical Equation Response
--------------------------
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.
**Sample Problem**
.. image:: ../Images/ChemicalEquationExample.png
:alt: Image of a chemical equation response problem
**Sample Problem XML**:
.. code-block:: xml
.. code-block:: xml
<problem>
<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^-'):
<div class="detailed-solution">
correct = ['correct']
</div>
else:
</solution>
correct = ['incorrect']
</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/>
<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>
</problem>
.. _Custom Response:
**XML Attribute Information**
Custom Response ("Write-Your-Own-Grader")
------------------------------------------
<optionresponse>
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.
**Sample Problem**
.. image:: ../Images/option_response1.png
.. image:: ../Images/CustomPythonExample.png
:alt: Image of a custom response problem
<optioninput>
**Sample Problem XML**:
.. image:: ../Images/optionresponse2.png
.. code-block:: xml
<problem>
<p>This question has two parts.</p>
.. raw:: latex
<script type="loncapa/python">
\newpage %
def test_add(expect, ans):
try:
a1=int(ans[0])
a2=int(ans[1])
return (a1+a2) == int(expect)
except ValueError:
return False
def test_add_to_ten(expect, ans):
return test_add(10, ans)
Multiple Choice
</script>
===============
<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>
The Multiple Choice input type allows the student to select at most one choice
<p>Part 2: Enter two integers that sum to 20. </p>
from a collection of answer choices, presented as a list of radio buttons.
<customresponse cfn="test_add" expect="20">
<textline size="10"/><br/>
<textline size="10"/>
</customresponse>
A Multiple Choice problem can have more than one correct answer, depending on
<solution>
how many choices are marked as correct in the underlying XML. If all choices are
<div class="detailed-solution">
marked as incorrect, there is no correct response.
<p>Explanation</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>
Multiple Choice is structurally similar to Option Response. Some conceptual
**Templates**
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 following template includes suggested correct answers (to include these, add a ``correct_answer`` attribute to the ``<textline>`` tag).
• 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.
.. code-block:: xml
• 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.
<problem>
Sample Problem:
<script type="loncapa/python">
def test_add(expect,ans):
a1=float(ans[0])
a2=float(ans[1])
return (a1+a2)== float(expect)
</script>
.. image:: ../Images/image289.png
:width: 600
:alt: Image of a multiple choice problem
**Problem Code:**
<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.
.. code-block:: xml
.. code-block:: xml
<problem>
<problem>
<p><b>Example Problem</b></p>
<p>How many correct responses can a Multiple Choice question have?</p>
The Checkbox input type allows the student to select zero or more choices from a
Image Response
collection of answer choices, presented as a list of checkboxes.
--------------
Remark: Questions with one Checkbox input type have exactly one correct
The Image Response input type presents an image and accepts clicks on the image as an answer.
response. All the choices marked as correct="true" have to be selected for the
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.
submitted answer (i.e. the response) to be considered correct.
In particular, the response of no boxes checked off could be the single correct
*Note The Mozilla Firefox browser is currently not supported for this problem type.*
response, and a Checkbox question, unlike a Multiple Choice question, cannot
have zero correct responses.
Sample Problem:
Sample Problem:
.. image:: ../Images/image290.png
.. image:: ../Images/image294.png
:width: 600
:width: 600
:alt: Image of a checkbox problem
**Problem Code:**
**Problem Code**:
.. code-block:: xml
.. code-block:: xml
<problem>
<problem>
<p><b>Example Problem</b></p>
<startouttext/>
<startouttext/>
<p>How many correct responses can a Checkbox question have?</p>
<p>You are given three shapes. Click on the triangle.</p>
The String Response input type provides an input box in which the student can
.. image:: ../Images/imageresponse2.png
enter a line of text, which is then checked against a specified expected answer.
A String Response input does not provide any answer suggestions, so it can be a
.. _Multiple Choice:
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.
Note that a student's answer in a String Response is marked as correct if it
Multiple Choice
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.
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:
Sample Problem:
.. image:: ../Images/image291.png
.. image:: ../Images/image289.png
:width: 600
:width: 600
:alt: Image of a string response problem
:alt: Image of a multiple choice problem
**Problem Code:**
**Problem Code:**
.. code-block:: xml
.. code-block:: xml
<problem>
<problem>
<p><b>Example Problem</b></p>
<p><b>Example Problem</b></p>
<p>What is the name of this unit? (What response type is this?)</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>
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 The Mozilla Firefox browser is currently not supported for this problem type.*
Sample Problem:
.. image:: ../Images/image294.png
:width: 600
**Problem Code**:
.. code-block:: xml
<problem>
<p><b>Example Problem</b></p>
<startouttext/>
<p>You are given three shapes. Click on the triangle.</p>
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.
.. _Option Response:
Sample Problem:
Option Response (Dropdown)
--------------------------
.. image:: ../Images/image295.png
:width: 600
:alt: Image of a custom response problem
**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>
The Option Response input type allows the student to choose from a collection of
<p>First, enter two integers which sum to 10. </p>
answer options, presented as a drop-down list.
<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>
Option Response is structurally similar to Multiple Choice. Some conceptual
<customresponse cfn="test_add" expect="20">
differences between the two include the following.
<textline size="40" /><br/>
<textline size="40" />
</customresponse>
<solution>
* The Multiple Choice radio button format makes it easier for students to read very long response options.
<div class="detailed-solution">
<p>Explanation</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>
</div>
</solution>
</problem>
**Templates**
* 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/image287.png
:width: 600
:alt: Image of an option response problem
*With displayed suggested correct answers*
**Problem Code:**
.. code-block:: xml
.. code-block:: xml
<problem>
<problem>
<script type="loncapa/python">
<p>Option Response is most similar to __________.</p>
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>
<optionresponse>
<customresponse cfn="test_add" expect="20">
<optioninput
<textline size="40" correct_answer="11"/><br/>
options="('Multiple Choice','String Response',
<textline size="40" correct_answer="9"/>
'Numerical Response','External Response',
</customresponse>
'Image Response')"
correct="Multiple Choice"/>1
</optionresponse>
<solution>
<solution>
<div class="detailed-solution">
<div class="detailed-solution">
</div>
<p>Explanation</p>
</solution>
<p>Like Option Response, Multiple Choice also allows students to select
from a variety of pre-written responses.</p>
</div>
</solution>
</problem>
</problem>
**Templates**
*With NO suggested correct answers*
**Template**
.. code-block:: xml
.. code-block:: xml
<problem>
<problem>
<script type="loncapa/python">
<optionresponse>
def test_add(expect,ans):
options="('A','B')"
a1=float(ans[0])
correct="A"/>
a2=float(ans[1])
</optionresponse>
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>
<solution>
<div class="detailed-solution">
<div class="detailed-solution">
</div>
</div>
</solution>
</solution>
</problem>
</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:
**XML Attribute Information**
.. image:: ../Images/image296.png
<optionresponse>
:width: 600
:alt: Image of a chemical equation response problem
**Problem Code**:
.. code-block:: xml
.. image:: ../Images/option_response1.png
<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>
if chemcalc.chemical_equations_equal(submission[0], 'H2SO4 -> H^+ + HSO4^-'):
<optioninput>
correct = ['correct']
else:
correct = ['incorrect']
</answer>
.. image:: ../Images/optionresponse2.png
</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>
So, you can enter "H2SO4 -> H^+ + HSO4^-".</p>
<endouttext/>
</problem>
.. raw:: latex
\newpage %
.. _Schematic Response:
Schematic Response
Schematic Response
==================
------------------
The Schematic Response input type provides an interactive grid on which the
The Schematic Response input type provides an interactive grid on which the
student can construct a schematic answer, such as a circuit.
student can construct a schematic answer, such as a circuit.
...
@@ -1135,3 +938,169 @@ Sample Problem:
...
@@ -1135,3 +938,169 @@ Sample Problem:
</div>
</div>
</solution>
</solution>
</problem>
</problem>
.. _String Response:
String Response
---------------
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.
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.
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/image291.png
:width: 600
:alt: Image of a string response problem
**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>
<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>