Commit c85a1557 by Sylvia Pearce

Separate each problem type into its own file

Separate all exercise and tool types, and create a new folder to contain them.
parent b2933250
****************** ##################
Format cheat sheet Format cheat sheet
****************** ##################
Levels of Subheads Title: # above and below (as lines 1 and 3 above)
#### *********
text Heading 1
#### *********
****
text
****
text
****
text
====
text
^^^^
=========
Heading 2
=========
Heading 3
*********
Heading 4
=========
Heading 5
^^^^^^^^^
************
Image Format
************
Image format, uses images as a reference from the soure/image file Image format, uses images as a reference from the soure/image file
...@@ -34,10 +33,9 @@ Image format, uses images as a reference from the soure/image file ...@@ -34,10 +33,9 @@ Image format, uses images as a reference from the soure/image file
.. image:: images/image009.png .. image:: images/image009.png
:width: 800 :width: 800
****************
For references to edX1010 pages: Code Formatting
****************
`Writing Exercises <https://edge.edx.org/courses/edX/edX101/How_to_Create_an_edX_Course/courseware/a45de3baa8a9468cbfb1a301fdcd7e86/d15cfeaff0af4dd7be4765cd0988d172/1>`_ has more in-depth discussion about problem types, and some general pedagogical considerations for adapting to the online format and a `Gallery of Response Types <https://edge.edx.org/accounts/login?next=/courses/edX/edX101/How_to_Create_an_edX_Course/courseware/a45de3baa8a9468cbfb1a301fdcd7e86/3ba055e760d04f389150a75edfecb844/1>`_
To set text in a "Code format" To set text in a "Code format"
:: ::
...@@ -47,6 +45,52 @@ To set text in a "Code format" ...@@ -47,6 +45,52 @@ To set text in a "Code format"
(text in code-block:: xml is in different colors) (text in code-block:: xml is in different colors)
****************
Table Formatting
****************
With a header row
.. list-table::
:widths: 10 80
:header-rows: 1
* - First Name
- Last Name
- Residence
* - Elizabeth
- Bennett
- Longbourne
* - Fitzwilliam
- Darcy
- Pemberley
-- or --
With a bolded first column
.. list-table::
:widths: 10 80
:stub-columns: 1
* - First Name
- Elizabeth
- Fitzwilliam
* - Last Name
- Bennett
- Darcy
* - Residence
- Longboure
- Pemberley
*******************
Cross-References
*******************
For references to edX101 pages:
`Writing Exercises <https://edge.edx.org/courses/edX/edX101/How_to_Create_an_edX_Course/courseware/a45de3baa8a9468cbfb1a301fdcd7e86/d15cfeaff0af4dd7be4765cd0988d172/1>`_ has more in-depth discussion about problem types, and some general pedagogical considerations for adapting to the online format and a `Gallery of Response Types <https://edge.edx.org/accounts/login?next=/courses/edX/edX101/How_to_Create_an_edX_Course/courseware/a45de3baa8a9468cbfb1a301fdcd7e86/3ba055e760d04f389150a75edfecb844/1>`_
To cross reference between sections of a document To cross reference between sections of a document
At the paragraph you are cross referencing: At the paragraph you are cross referencing:
......
...@@ -12,6 +12,8 @@ April, 2014 ...@@ -12,6 +12,8 @@ April, 2014
* - Date * - Date
- Change - Change
* - 4/23/14
- Reorganized info about problems into :ref:`Exercises and Tools Index` section
* - 04/22/14 * - 04/22/14
- Updated the :ref:`Bulk Email` section with information about the dashboard option to opt out of course email. - Updated the :ref:`Bulk Email` section with information about the dashboard option to opt out of course email.
* - * -
...@@ -37,7 +39,6 @@ April, 2014 ...@@ -37,7 +39,6 @@ April, 2014
new HTML editor. new HTML editor.
* - 04/07/14 * - 04/07/14
- Expanded the :ref:`Course Data`, :ref:`Enrollment`, and - Expanded the :ref:`Course Data`, :ref:`Enrollment`, and
:ref:`Course_Staffing` sections.
* - 04/03/14 * - 04/03/14
- Updated the :ref:`Adding Pages to a Course` chapter to reflect ability to :ref:`Show or Hide the Course Wiki Page`. - Updated the :ref:`Adding Pages to a Course` chapter to reflect ability to :ref:`Show or Hide the Course Wiki Page`.
* - 04/02/14 * - 04/02/14
...@@ -82,7 +83,7 @@ March, 2014 ...@@ -82,7 +83,7 @@ March, 2014
* :ref:`Creating Course Content Index` * :ref:`Creating Course Content Index`
* :ref:`Working with Problems Index` * :ref:`Exercises and Tools Index`
* :ref:`Releasing Your Course Index` * :ref:`Releasing Your Course Index`
...@@ -140,19 +141,18 @@ February, 2014 ...@@ -140,19 +141,18 @@ February, 2014
- Added the :ref:`Course Data`, :ref:`Course_Staffing`, and - Added the :ref:`Course Data`, :ref:`Course_Staffing`, and
:ref:`Enrollment` chapters. :ref:`Enrollment` chapters.
* - 02/11/14 * - 02/11/14
- Added :ref:`Gene Explorer` and updated :ref:`Interactive Periodic Table` - Added :ref:`Gene Explorer` and updated :ref:`Periodic Table`
and :ref:`Molecule Editor` in :ref:`Additional Tools`. and :ref:`Molecule Editor`.
* - 02/07/14 * - 02/07/14
- Added section on :ref:`Full Screen Image`. - Added section on :ref:`Full Screen Image`.
* - 02/06/14 * - 02/06/14
- Added :ref:`Interactive Periodic Table` and :ref:`Molecule Editor` to - Added :ref:`Periodic Table` and :ref:`Molecule Editor`
:ref:`Additional Tools`
* - 02/05/14 * - 02/05/14
- Added section :ref:`Set the Advertised Start Date`. - Added section :ref:`Set the Advertised Start Date`.
* - 02/04/14 * - 02/04/14
- Added the :ref:`Student Data` and :ref:`Grades` chapters. - Added the :ref:`Student Data` and :ref:`Grades` chapters.
* - * -
- Added :ref:`Additional Tools` topic with :ref:`Multiple Choice and - Added :ref:`Multiple Choice and
Numerical Input` and :ref:`Protein Builder`. Numerical Input` and :ref:`Protein Builder`.
...@@ -167,7 +167,7 @@ January, 2014 ...@@ -167,7 +167,7 @@ January, 2014
* - Date * - Date
- Change - Change
* - 01/29/2014 * - 01/29/2014
- Added the chapter :ref:`Using an Instant Hangout in Your Course`. - Added the chapter :ref:`Google Instant Hangout`.
* - 01/24/2014 * - 01/24/2014
- Added the :ref:`Discussions` and :ref:`Guidance for Discussion - Added the :ref:`Discussions` and :ref:`Guidance for Discussion
Moderators` chapters. Moderators` chapters.
...@@ -178,7 +178,7 @@ January, 2014 ...@@ -178,7 +178,7 @@ January, 2014
Textbooks`. Textbooks`.
* - 01/14/2014 * - 01/14/2014
- Added info about scoring (:ref:`ORA Access Scores`) and due dates in - Added info about scoring (:ref:`ORA Access Scores`) and due dates in
:ref:`Open Response Assessment Problems`. :ref:`Open Response Assessment`.
* - 01/13/2014 * - 01/13/2014
- Extensive updates to :ref:`Organizing Your Course Content` and - Extensive updates to :ref:`Organizing Your Course Content` and
:ref:`Working with HTML Components`. :ref:`Working with HTML Components`.
...@@ -193,7 +193,7 @@ January, 2014 ...@@ -193,7 +193,7 @@ January, 2014
* - * -
- Added info about template to :ref:`Checkbox`. - Added info about template to :ref:`Checkbox`.
* - 01/06/2014 * - 01/06/2014
- Created :ref:`Custom JavaScript Display and Grading` - Created :ref:`Custom JavaScript`
* - 01/06/2014 * - 01/06/2014
- Created :ref:`Zooming image` - Created :ref:`Zooming image`
* - 01/01/2014 * - 01/01/2014
...@@ -215,7 +215,7 @@ December, 2013 ...@@ -215,7 +215,7 @@ December, 2013
- Made :ref:`ORA for Students` into template that instructors can - Made :ref:`ORA for Students` into template that instructors can
customize. customize.
* - 12/19/2013 * - 12/19/2013
- Created :ref:`Tools`. - Created "Tools" topic. (Note 4/10/14: Topic merged into :ref:`Create Exercises`.)
* - 12/18/2013 * - 12/18/2013
- Updated documentation about video player options in :ref:`Working with - Updated documentation about video player options in :ref:`Working with
Video Components`. Video Components`.
...@@ -229,7 +229,7 @@ December, 2013 ...@@ -229,7 +229,7 @@ December, 2013
- Added the chapter :ref:`Guidelines for Creating Accessible Content`. - Added the chapter :ref:`Guidelines for Creating Accessible Content`.
* - 12/10/2013 * - 12/10/2013
- Added note about number of responses in "Available to Grade" column in - Added note about number of responses in "Available to Grade" column in
:ref:`Open Response Assessment Problems`. :ref:`Open Response Assessment`.
* - * -
- Added :ref:`MathJax in Studio`. - Added :ref:`MathJax in Studio`.
* - 12/09/2013 * - 12/09/2013
......
...@@ -21,7 +21,7 @@ For more information, see the following topics: ...@@ -21,7 +21,7 @@ For more information, see the following topics:
.. note:: Review :ref:`Organizing Your Course Content` and :ref:`Best Practices for HTML Markup` before you start working with HTML components. .. note:: Review :ref:`Organizing Your Course Content` and :ref:`Best Practices for HTML Markup` before you start working with HTML components.
To add an instant hangout to an HTML component, see :ref:`Using an Instant Hangout in Your Course`. To add an instant hangout to an HTML component, see :ref:`Google Instant Hangout`.
.. _The HTML Editor: .. _The HTML Editor:
......
...@@ -17,32 +17,29 @@ toward a student's grade. If you want the problems to count toward the ...@@ -17,32 +17,29 @@ toward a student's grade. If you want the problems to count toward the
student's grade, change the assignment type of the subsection that contains the student's grade, change the assignment type of the subsection that contains the
problems. problems.
This section covers the basics of Problem components--what they look like to you and your students, and the options that every problem component has. For more information about individual problem types, see :ref:`Create Exercises`.
For more information, see the following topics. For more information, see the following topics.
* :ref:`Components and the User Interface` * :ref:`Problem Student View`
* :ref:`Problem Studio View`
* :ref:`Problem Settings` * :ref:`Problem Settings`
* :ref:`Multiple Problems in One Component`
* :ref:`Problem Randomization`
* :ref:`Modifying a Released Problem` * :ref:`Modifying a Released Problem`
* :ref:`Additional Work with Problems`
* :ref:`Multiple Problems in One Component`
* :ref:`Problem Randomization`
.. _Components and the User Interface:
************************************
Components and the User Interface
************************************
This section contains a description of the various components of a .. _Problem Student View:
problem as students see it in the LMS, as well as an introduction to the
Studio user interface for course creators.
============================== ************************************
The Student View of a Problem The Student View of a Problem
============================== ************************************
All problems on the edX platform have several component parts. All problems on the edX platform have several component parts.
.. image:: ../Images//AnatomyOfExercise1.png .. image:: ../Images/AnatomyOfExercise1.png
:alt: Image of a problem from a student's point of view, with callouts for elements of the problem :alt: Image of a problem from a student's point of view, with callouts for elements of the problem
#. **Problem text.** The problem text can contain any standard HTML formatting. #. **Problem text.** The problem text can contain any standard HTML formatting.
...@@ -120,32 +117,29 @@ visible. You can set these attributes in Studio. ...@@ -120,32 +117,29 @@ visible. You can set these attributes in Studio.
given different weights. given different weights.
- **Label.** To improve accessibility for students who have disabilities, each problem needs a descriptive label. The label typically contains part or all of the text of the question in the problem. Most templates include a space for a label. You can find example labels in the documentation for each problem or tool type. - **Label.** To improve accessibility for students who have disabilities, each problem needs a descriptive label. The label typically contains part or all of the text of the question in the problem. Most templates include a space for a label. You can find example labels in the documentation for each problem or tool type.
.. _Studio UI: .. _Problem Studio View:
============================== ************************************
The Studio User Interface The Studio View of a Problem
============================== ************************************
Studio offers two interfaces for editing problem components: the Simple All problems are written in XML. However, Studio offers two interfaces for editing problem components: the Simple Editor and the Advanced Editor.
Editor and the Advanced Editor.
- The **Simple Editor** allows you to edit problems visually, without - The **Simple Editor** allows you to edit problems visually, without
having to work with XML. having to work with XML.
- The **Advanced Editor** converts the problem to edX’s XML standard - The **Advanced Editor** converts the problem to edX’s XML standard
and allows you to edit that XML directly. and allows you to edit that XML directly.
.. note:: You can switch at any time from the Simple Editor to the You can switch at any time from the Simple Editor to the Advanced Editor by clicking **Advanced Editor** in the top right corner of the Simple Editor interface. However, it is not possible to switch from the Advanced Editor to the Simple Editor.
Advanced Editor by clicking **Advanced Editor** in the top right corner
of the Simple Editor interface. However, it is not possible to switch from
the Advanced Editor to the Simple Editor.
.. _Simple Editor: .. _Simple Editor:
The Simple Editor The Simple Editor
~~~~~~~~~~~~~~~~~ =================
The Common Problem templates, including multiple choice, open in the Simple Editor. The Several problem templates, including multiple choice and text input problem templates, open in the Simple Editor. The following image shows a multiple choice problem in the Simple Editor.
following image shows a multiple choice problem in the Simple Editor.
.. image:: ../Images//MultipleChoice_SimpleEditor.png
:alt: Image of a problem in the simple editor
The Simple Editor includes a toolbar that helps you format the text of your problem. The Simple Editor includes a toolbar that helps you format the text of your problem.
When you select text and then click the formatting buttons, the Simple Editor formats When you select text and then click the formatting buttons, the Simple Editor formats
...@@ -161,19 +155,29 @@ the text for you automatically. The toolbar buttons are the following: ...@@ -161,19 +155,29 @@ the text for you automatically. The toolbar buttons are the following:
8. Open the problem in the Advanced Editor. 8. Open the problem in the Advanced Editor.
9. Open a list of formatting hints. 9. Open a list of formatting hints.
The following image shows a multiple choice problem in the Simple Editor. The following problem templates open in the Simple Editor.
- :ref:`Checkbox` In checkbox problems, students select one or more options
from a list of possible answers.
- :ref:`Dropdown` In dropdown problems, students select one answer from a
dropdown list.
- :ref:`Multiple Choice` Multiple choice problems require students to
select one answer from a list of choices that appear directly below
the question.
- :ref:`Numerical Input` Numerical input problems require answers that
include only integers, fractions, and a few common constants and
operators.
- :ref:`Text Input` In text input problems, students enter a short text
answer to a question.
.. image:: ../Images//MultipleChoice_SimpleEditor.png
:alt: Image of a problem in the simple editor
.. _Advanced Editor: .. _Advanced Editor:
===================
The Advanced Editor The Advanced Editor
~~~~~~~~~~~~~~~~~~~ ===================
The **Advanced Editor** opens a problem in XML. The Advanced Problem templates, The **Advanced Editor** opens a problem in XML. Templates for problems such as
such as the circuit schematic builder, open directly in the Advanced Editor. such as drag and drop and math expression input open directly in the Advanced Editor.
For more information about the XML for different problem types, see :ref:`Appendix E`.
The following image shows the multiple choice problem above in the Advanced Editor The following image shows the multiple choice problem above in the Advanced Editor
instead of the Simple Editor. instead of the Simple Editor.
...@@ -181,14 +185,34 @@ instead of the Simple Editor. ...@@ -181,14 +185,34 @@ instead of the Simple Editor.
.. image:: ../Images//MultipleChoice_AdvancedEditor.png .. image:: ../Images//MultipleChoice_AdvancedEditor.png
:alt: Image of a problem in the advanced editor :alt: Image of a problem in the advanced editor
The following problem templates open in the Advanced Editor.
- :ref:`Circuit Schematic Builder` In circuit schematic problems, students
create and modify circuits on an interactive grid and submit
computer-generated analyses of the circuits for grading.
- :ref:`Custom JavaScript` With custom JavaScript display
and grading problems, you can incorporate problem types that you've created
in HTML into Studio via an IFrame.
- :ref:`Drag and Drop` Drag and drop problems require students to drag text
or objects to a specific location on an image.
- :ref:`Image Mapped Input` Image mapped input problems require students to
click a specific location on an image.
- :ref:`Math Expression Input` Math expression input problems require
students to enter a mathematical expression as text, such as
e=m\*c^2.
- :ref:`Problem with Adaptive Hint` These problems can give students
feedback or hints based on their responses. Problems with adaptive
hints can be text input or multiple choice problems.
- :ref:`Problem Written in LaTeX` This problem type allows you to convert problems that you’ve already written in LaTeX into the edX format. Note that this problem type is still a prototype, however, and may not be supported in the future.
- :ref:`Write Your Own Grader` Custom Python-evaluated input (also called "write-your-own-grader" problems evaluate students' responses using an embedded Python script that you create. These problems can be any type.
.. _Problem Settings: .. _Problem Settings:
****************** ******************
Problem Settings Problem Settings
****************** ******************
Most problems have the following settings. These settings appear on the **Settings** tab in In addition to the text of the problem, problems that you create using a Problem component have the following settings. These settings appear on the **Settings** tab in the component editor.
the component editor.
- **Display Name** - **Display Name**
- **Maximum Attempts** - **Maximum Attempts**
...@@ -196,7 +220,7 @@ the component editor. ...@@ -196,7 +220,7 @@ the component editor.
- **Randomization** - **Randomization**
- **Show Answer** - **Show Answer**
.. image:: ../Images//ProbComponent_Attributes.png .. image:: ../Images/ProbComponent_Attributes.png
:alt: Image of the Settings tab in a Problem component :alt: Image of the Settings tab in a Problem component
=============== ===============
...@@ -207,7 +231,7 @@ This setting indicates the name of your problem. The display name ...@@ -207,7 +231,7 @@ This setting indicates the name of your problem. The display name
appears as a heading over the problem in the LMS and in the course appears as a heading over the problem in the LMS and in the course
ribbon at the top of the page. ribbon at the top of the page.
.. image:: ../Images//ProbComponent_LMS_DisplayName.png .. image:: ../Images/ProbComponent_LMS_DisplayName.png
:alt: Image of the problem in a unit page from a student's point of view :alt: Image of the problem in a unit page from a student's point of view
============================== ==============================
...@@ -230,7 +254,7 @@ Problem Weight ...@@ -230,7 +254,7 @@ Problem Weight
This setting specifies the maximum number of points possible for the This setting specifies the maximum number of points possible for the
problem. The problem weight appears next to the problem title. problem. The problem weight appears next to the problem title.
.. image:: ../Images//ProblemWeight_DD.png .. image:: ../Images/ProblemWeight_DD.png
:alt: Image of a problem from a student's point of view, with the possible points circled :alt: Image of a problem from a student's point of view, with the possible points circled
By default, each response field, or “answer space,” in a Problem By default, each response field, or “answer space,” in a Problem
...@@ -242,11 +266,11 @@ to answer, and thus has three response fields. ...@@ -242,11 +266,11 @@ to answer, and thus has three response fields.
The following Problem component contains one text input problem, The following Problem component contains one text input problem,
and has just one response field. and has just one response field.
.. image:: ../Images//ProblemWeight_TI.png .. image:: ../Images/ProblemWeight_TI.png
:alt: Image of a text input problem from a student's point of view :alt: Image of a text input problem from a student's point of view
Computing Scores Computing Scores
~~~~~~~~~~~~~~~~ ****************
The score that a student earns for a problem is the result of the The score that a student earns for a problem is the result of the
following formula: following formula:
...@@ -297,13 +321,15 @@ This setting specifies whether certain values in your problem change each time a ...@@ -297,13 +321,15 @@ This setting specifies whether certain values in your problem change each time a
.. image:: ../Images//Rerandomize.png .. image:: ../Images/Rerandomize.png
If you want to change, or "randomize," specific values in your problem, you have to do both the following: If you want to change, or "randomize," specific values in your problem, you have to do both the following:
- Make sure that your problem contains a Python script that randomizes the values that you want. - Make sure that your problem contains a Python script that randomizes the values that you want.
- Enable randomization in the Problem component. - Enable randomization in the Problem component.
.. note:: Note that specifying this **Randomization** setting is different from *problem randomization*. The **Randomization** setting randomizes variables within a single problem. Problem randomization offers different problems or problem versions to different students. For more information, see :ref:`Problem Randomization`.
To enable randomization, select an option for the **Randomization** setting. This setting has four options. To enable randomization, select an option for the **Randomization** setting. This setting has four options.
...@@ -365,37 +391,64 @@ This setting has seven options. ...@@ -365,37 +391,64 @@ This setting has seven options.
| | or in the LMS. | | | or in the LMS. |
+-------------------+--------------------------------------+ +-------------------+--------------------------------------+
.. _Modifying a Released Problem:
*********************************
Modifying a Released Problem
*********************************
.. warning:: Be careful when you modify problems after they have been released!
After a student submits a response to a problem, Studio stores the
student’s response, the score that the student received, and the maximum
score for the problem. Studio updates these values when a student
submits a new response to a problem. However, if an instructor changes a
problem or its attributes, Studio does not automatically update existing
student information for that problem.
For example, you may release a problem and specify that its answer is 3.
After some students have submitted responses, you notice that the answer
should be 2 instead of 3. When you update the problem with the correct
answer, Studio doesn’t update scores for students who answered 2 for the
original problem and thus received the wrong score.
For another example, you may change the number of response fields to
three. Students who submitted answers before the change have a score of
0, 1, or 2 out of 2.0 for that problem. Students who submitted answers
after the change have scores of 0, 1, 2, or 3 out of 3.0 for the same
problem.
If you change the weight of the problem, however, the existing scores
update when you refresh the **Progress** page.
=============== ===============
Problem Types Workarounds
=============== ===============
Studio includes templates for many different types of problems, from If you have to modify a released problem in a way that affects grading,
simple multiple choice problems to advanced problems that require the you have two options. Note that both options require you to ask your
student to “build” a virtual circuit. Details about each problem type, students to go back and resubmit a problem.
including information about how to create the problem, appears in the
page for the problem type.
- :ref:`Common Problems` appear on the **Common Problem Types** tab when you
create a new Problem component in Studio. You create these problems
using the Simple Editor.
- :ref:`Advanced Problems` appear on the **Advanced** tab when you create a
new Problem component. You create these problems using the Advanced
Editor.
- :ref:`Specialized Problems` are advanced problems that aren’t available by
default. To add these problems, you first have to modify the advanced
settings in your course. The Advanced component then appears under
**Add New Component** in each unit, and these problems are available
in the Advanced component.
- :ref:`Open Response Assessment Problems` are a new kind of problem that allow you, the
students in your course, or a computer algorithm to grade responses in the form
of essays, files such as computer code, and ../Images/.
.. _Multiple Problems in One Component: - In the Problem component, increase the number of attempts for the
problem. Then ask all your students to redo the problem.
- Delete the entire Problem component in Studio and create a new
Problem component with the content and settings that you want. Then
ask all your students to complete the new problem.
.. _Additional Work with Problems:
************************************ ************************************
Multiple Problems in One Component Additional Work with Problems
************************************ ************************************
You have some further options when you work with problems. You can include more than one problem in a single problem component, or you can set up a problem that presents different versions to different students.
.. _Multiple Problems in One Component:
====================================
Multiple Problems in One Component
====================================
You may want to create a problem that has more than one response type. You may want to create a problem that has more than one response type.
For example, you may want to create a numerical input problem, and then For example, you may want to create a numerical input problem, and then
include a multiple choice question about the numerical input problem. include a multiple choice question about the numerical input problem.
...@@ -404,7 +457,7 @@ many problems at one time. To do this, you can include multiple problems ...@@ -404,7 +457,7 @@ many problems at one time. To do this, you can include multiple problems
inside a single Problem component. The problems can be different types. inside a single Problem component. The problems can be different types.
To create multiple problems in one component, create a new Blank To create multiple problems in one component, create a new Blank
Advanced Problem component, and then paste the XML for each problem in Advanced Problem component, and then add the XML for each problem in
the component editor. You only need to include the XML for the problem the component editor. You only need to include the XML for the problem
and its answers. You don’t have to include the code for other elements, and its answers. You don’t have to include the code for other elements,
such as the **Check** button. such as the **Check** button.
...@@ -421,9 +474,9 @@ the component appear. ...@@ -421,9 +474,9 @@ the component appear.
.. _Problem Randomization: .. _Problem Randomization:
********************* ===========================
Problem Randomization Problem Randomization
********************* ===========================
You may want to present different students with different problems, or different versions of the same problem. To do this, you'll create a Problem component for each problem or version in Studio, and then edit your course outside of Studio to randomize the problem that students see. You may want to present different students with different problems, or different versions of the same problem. To do this, you'll create a Problem component for each problem or version in Studio, and then edit your course outside of Studio to randomize the problem that students see.
...@@ -431,9 +484,8 @@ Note that *problem randomization* is different from the **Randomization** settin ...@@ -431,9 +484,8 @@ Note that *problem randomization* is different from the **Randomization** settin
.. note:: Creating problems with versions that can be randomized requires you to export your course, edit some of your course's XML files in a text editor, and then re-import your course. We recommend that you create a backup copy of your course before you do this. We also recommend that you only edit the files that will contain polls in the text editor if you're very familiar with editing XML. .. note:: Creating problems with versions that can be randomized requires you to export your course, edit some of your course's XML files in a text editor, and then re-import your course. We recommend that you create a backup copy of your course before you do this. We also recommend that you only edit the files that will contain polls in the text editor if you're very familiar with editing XML.
===========
Terminology Terminology
=========== ************
Sections, subsections, units, and components have different names in the **Course Outline** view and in the list of files that you'll see after you export your course and open the .xml files for editing. The following table lists the names of these elements in the **Course Outline** view and in a list of files. Sections, subsections, units, and components have different names in the **Course Outline** view and in the list of files that you'll see after you export your course and open the .xml files for editing. The following table lists the names of these elements in the **Course Outline** view and in a list of files.
...@@ -456,9 +508,8 @@ For example, when you want to find a specific section in your course, you'll loo ...@@ -456,9 +508,8 @@ For example, when you want to find a specific section in your course, you'll loo
.. _Create Randomized Problems: .. _Create Randomized Problems:
==========================
Create Randomized Problems Create Randomized Problems
========================== ****************************
#. In the unit where you want to create a randomized problem, create a separate Problem component for each version or problem that you want to randomize. For example, if you want to offer four versions or problems, you'll create four separate Problem components. Make a note of the 32-digit unit ID that appears in the **Unit Identifier** field under **Unit Location**. #. In the unit where you want to create a randomized problem, create a separate Problem component for each version or problem that you want to randomize. For example, if you want to offer four versions or problems, you'll create four separate Problem components. Make a note of the 32-digit unit ID that appears in the **Unit Identifier** field under **Unit Location**.
...@@ -515,79 +566,3 @@ Create Randomized Problems ...@@ -515,79 +566,3 @@ Create Randomized Problems
* Once you've implemented randomization, you can only see one of the versions or problems in Studio. You can edit that single problem directly in Studio, but to edit any of the other problems, you'll have to export your course, edit the problems in a text editor, and then re-import the course. This is true for instructors as well as course teams. * Once you've implemented randomization, you can only see one of the versions or problems in Studio. You can edit that single problem directly in Studio, but to edit any of the other problems, you'll have to export your course, edit the problems in a text editor, and then re-import the course. This is true for instructors as well as course teams.
* A .csv file for student responses contains the responses to each of the problems in the problem bank. * A .csv file for student responses contains the responses to each of the problems in the problem bank.
.. _Modifying a Released Problem:
************************************
Modifying a Released Problem
************************************
.. warning:: Be careful when you modify problems after they have been released!
After a student submits a response to a problem, Studio stores the
student’s response, the score that the student received, and the maximum
score for the problem. Studio updates these values when a student
submits a new response to a problem. However, if an instructor changes a
problem or its attributes, Studio does not automatically update existing
student information for that problem.
For example, you may release a problem and specify that its answer is 3.
After some students have submitted responses, you notice that the answer
should be 2 instead of 3. When you update the problem with the correct
answer, Studio doesn’t update scores for students who answered 2 for the
original problem and thus received the wrong score.
For another example, you may change the number of response fields to
three. Students who submitted answers before the change have a score of
0, 1, or 2 out of 2.0 for that problem. Students who submitted answers
after the change have scores of 0, 1, 2, or 3 out of 3.0 for the same
problem.
If you change the weight of the problem, however, the existing scores
update when you refresh the **Progress** page.
===============
Workarounds
===============
If you have to modify a released problem in a way that affects grading,
you have two options. Note that both options require you to ask your
students to go back and resubmit a problem.
- In the Problem component, increase the number of attempts for the
problem. Then ask all your students to redo the problem.
- Delete the entire Problem component in Studio and create a new
Problem component with the content and settings that you want. Then
ask all your students to complete the new problem.
.. _Problem XML:
***********
Problem XML
***********
XML tags are generally specific to a problem type. For example, only multiple choice problems contain the ``<multiplechoiceresponse>`` tag, and only drag and drop problems use the ``<draggable>`` tag. However, the following tags are common to most problems.
.. list-table::
:widths: 20 80
* - ``<problem> </problem>``
- These must be the first and last tags for any content created in the Advanced
Editor in a Problem component.
* - ``<startouttext/>``
- The ``<startouttext />`` tag indicates the beginning of a line or block of text.
* - ``<endouttext/>``
- The ``<endouttext />`` tag indicates the end of a line or block of text.
* - ``<solution> <div class="detailed-solution"> </div> </solution>`` (optional)
- If you want to include more information in the problem, such as a detailed explanation of the problem's answer, you'll enter the text between the two ``<div>`` tags, which are inside the ``<solution>`` tags. (These tags do not have to be on the same line.)
Additionally, several different problem types use the following tags.
.. list-table::
:widths: 20 80
* - ``<textline>``
- Creates an answer space where students enter a response. Must contain a **size** attribute; may contain **label**, **math**, **correct_answer**. Used in text input and some custom Python-evaluated input problems.
* - ``<customresponse> </customresponse>``
-
...@@ -17,4 +17,5 @@ Creating Course Content ...@@ -17,4 +17,5 @@ Creating Course Content
create_html_component create_html_component
create_video create_video
create_discussion create_discussion
create_problem
...@@ -33,7 +33,7 @@ You can create other pages for the grading policy, course slides, or any other p ...@@ -33,7 +33,7 @@ You can create other pages for the grading policy, course slides, or any other p
* A dynamic HTML calendar, using the template in :ref:`Code for Dynamic HTML Schedule`. * A dynamic HTML calendar, using the template in :ref:`Code for Dynamic HTML Schedule`.
* An instant hangout. See :ref:`Using an Instant Hangout in Your Course` for more information. * An instant hangout. See :ref:`Google Instant Hangout` for more information.
See: See:
......
.. _Annotation:
###################
Annotation Problem
###################
In an annotation problem, the instructor highlights specific text inside a larger text block and then asks questions about that text. The questions appear when students hover the mouse over the highlighted text. The questions also appear in a section below the text block, along with space for students' responses.
Annotation problems ask students to respond to questions about a specific block of text. The question appears above the text when the student hovers the mouse over the highlighted text so that students can think about the question as they read.
.. image:: /Images/AnnotationExample.png
:alt: Annotation problem
****************************
Create an Annotation Problem
****************************
To create an annotation problem, you'll add the Annotation advanced component to your course, add the **Instructions** and **Guided Discussion** segments of the problem, and then the **Annotation problem** segment of the problem.
#. Add the Annotation advanced component.
#. On the **Settings** menu, click **Advanced Settings**.
#. On the **Advanced Settings** page, locate the **Manual Policy Definition** section, and then locate the **advanced_modules** policy key (this key is at the top of the list).
.. image:: /Images/AdvancedModulesEmpty.png
:alt: Image of the Manual Policy Definition section of the Advanced Settings page
3. Under **Policy Value**, place your cursor between the brackets, and
then enter the following. Make sure to include the quotation marks.
``"annotatable"``
#. At the bottom of the page, click **Save Changes**.
The page refreshes automatically. At the top of the page, you see a
notification that your changes have been saved.
#. Return to the unit where you want to add the specialized problem. The
list of possible components now contains an Advanced component.
.. image:: /Images/AdvancedComponent.png
:alt: Image of the Add a New Component panel with the Advanced component option
2. Add the **Instructions** and **Guided Discussion** segments of the
problem.
#. In the unit where you want to create the problem, click **Advanced**
under **Add New Component**.
#. In the list of problem types, click **Annotation**.
#. In the component that appears, click **Edit**.
#. In the component editor, replace the example code with your own code.
#. Click **Save**.
3. Add the **Annotation problem** segment of the problem.
#. Under the Annotation component, create a new blank Advanced Problem
component.
#. Paste the following code in the Advanced Problem component, replacing
placeholders with your own information.
.. code-block:: xml
<problem>
<annotationresponse>
<annotationinput>
<text>PLACEHOLDER: Text of annotation</text>
<comment>PLACEHOLDER: Text of question</comment>
<comment_prompt>PLACEHOLDER: Type your response below:</comment_prompt>
<tag_prompt>PLACEHOLDER: In your response to this question, which tag below
do you choose?</tag_prompt>
<options>
<option choice="incorrect">PLACEHOLDER: Incorrect answer (to make this
option a correct or partially correct answer, change choice="incorrect"
to choice="correct" or choice="partially-correct")</option>
<option choice="correct">PLACEHOLDER: Correct answer (to make this option
an incorrect or partially correct answer, change choice="correct" to
choice="incorrect" or choice="partially-correct")</option>
<option choice="partially-correct">PLACEHOLDER: Partially correct answer
(to make this option a correct or partially correct answer,
change choice="partially-correct" to choice="correct" or choice="incorrect")
</option>
</options>
</annotationinput>
</annotationresponse>
<solution>
<p>PLACEHOLDER: Detailed explanation of solution</p>
</solution>
</problem>
#. Click **Save**.
.. _Checkbox:
##################
Checkbox Problem
##################
In checkbox problems, the student selects one or more options from a list of possible answers. The student must select all the options that apply to answer the problem correctly. Each checkbox problem must have at least one correct answer.
.. image:: /Images/CheckboxExample.png
:alt: Image of a checkbox problem
****************************
Create a Checkbox Problem
****************************
You can create checkbox problems in the Simple Editor or in the Advanced Editor.
.. note:: All problems must include labels for accessibility. The label generally includes the text of the main question in your problem. To add a label for a common problem, surround the text of the label with angle brackets pointed toward the text (>>label text<<).
==================
Simple Editor
==================
#. Under **Add New Component**, click **Problem**.
#. In the **Select Problem Component Type** screen, click **Checkboxes** on the **Common Problem Types** tab.
#. In the Problem component that appears, click **Edit**.
#. In the component editor, replace the default text with the text of your
problem. Enter each answer option on its own line.
#. Determine the text of the problem to use as a label, and then surround that text with two sets of angle brackets (>><<).
#. Select all the answer options, and then click the checkbox button.
.. image:: /Images/ProbComponent_CheckboxIcon.png
:alt: Image of the checkbox button
When you do this, brackets appear next to each answer choice.
#. Add an **x** between the brackets for the correct answer or answers.
#. In the component editor, select the text of the explanation, and then click the
explanation button to add explanation tags around the text.
.. image:: /Images/ProbCompButton_Explanation.png
:alt: Image of the explanation button
#. On the **Settings** tab, specify the settings that you want.
#. Click **Save**.
For the example problem above, the text in the Problem component is the
following.
.. code-block:: xml
Learning about the benefits of preventative healthcare can be particularly
difficult. >>Check all of the reasons below why this may be the case.<<
[x] A large amount of time passes between undertaking a preventative measure and seeing the result.
[ ] Non-immunized people will always fall sick.
[x] If others are immunized, fewer people will fall sick regardless of a particular individual's choice to get immunized or not.
[x] Trust in healthcare professionals and government officials is fragile.
[explanation]
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.
[explanation]
==================
Advanced Editor
==================
To create this problem in the Advanced Editor, click the **Advanced** tab in the Problem component editor, and then replace the existing code with the following code.
.. 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>
<choiceresponse>
<checkboxgroup direction="vertical" label="Check all of the reasons below why this may be the case">
<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>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>
</div>
</solution>
</choiceresponse>
</problem>
.. _Checkbox Problem XML:
****************************
Checkbox Problem XML
****************************
============
Template
============
.. code-block:: xml
<problem>
<startouttext/>
<p>Question text</p>
<choiceresponse>
<checkboxgroup direction="vertical" label="label text">
<choice correct="false"><text>Answer option 1 (incorrect)</text></choice>
<choice correct="true"><text>Answer option 2 (correct)</text></choice>
</checkboxgroup>
<solution>
<div class="detailed-solution">
<p>Solution or Explanation Heading</p>
<p>Solution or explanation text</p>
</div>
</solution>
</choiceresponse>
</problem>
======
Tags
======
* ``<choiceresponse>`` (required): Specifies that the problem contains options for students to choose from.
* ``<checkboxgroup>`` (required): Specifies that the problem is a checkbox problem.
* ``<choice>`` (required): Designates an answer option.
**Tag:** ``<choiceresponse>``
Specifies that the problem contains options for students to choose from.
Attributes
(none)
Children
* ``<checkboxgroup>``
**Tag:** ``<checkboxgroup>``
Specifies that the problem is a checkbox problem.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - direction (optional)
- Specifies the orientation of the list of answers. The default is vertical.
* - label (required)
- Specifies the name of the response field.
Children
* ``<choice>``
**Tag:** ``<choice>``
Designates an answer option.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - true (at least one required)
- Indicates a correct answer. For checkbox problems, one or more ``<choice>`` tags can contain a correct answer.
* - false (at least one required)
- Indicates an incorrect answer.
Children
(none)
\ No newline at end of file
.. _Chemical Equation:
################################
Chemical Equation Problem
################################
The chemical equation problem type allows the student to enter text that represents a chemical equation into a text box. The system converts that text into a chemical equation below the text box. The grader evaluates the student's response by using a Python script that you create and embed in the problem.
.. image:: /Images/ChemicalEquationExample.png
:alt: Image of a chemical equation response problem
************************************
Create the Chemical Equation Problem
************************************
Chemical equation problems use MathJax to create formulas. For more information about using MathJax in Studio, see :ref:`MathJax in Studio`.
To create the above chemical equation problem:
#. In the unit where you want to create the problem, click **Problem** under **Add New Component**, and then click the **Advanced** tab.
#. Click **Blank Advanced Problem**.
#. In the component that appears, click **Edit**.
#. In the component editor, paste the code from below.
#. Click **Save**.
==========================================
Sample Chemical Equation Problem Code
==========================================
.. 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>
\( \text{H}_2\text{SO}_4 \longrightarrow \text { H}^+ + \text{ HSO}_4^-\)
<customresponse>
<chemicalequationinput size="50" label="Enter the chemical equation"/>
<answer type="loncapa/python">
if chemcalc.chemical_equations_equal(submission[0], 'H2SO4 -> H^+ + HSO4^-'):
correct = ['correct']
else:
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>
.. _Chemical Equation Problem XML:
************************************
Chemical Equation Problem XML
************************************
============
Template
============
.. code-block:: xml
<problem>
<startouttext/>
<p>Problem text</p>
<customresponse>
<chemicalequationinput size="NUMBER" label="LABEL TEXT"/>
<answer type="loncapa/python">
if chemcalc.chemical_equations_equal(submission[0], 'TEXT REPRESENTING CHEMICAL EQUATION'):
correct = ['correct']
else:
correct = ['incorrect']
</answer>
</customresponse>
<endouttext/>
<solution>
<div class="detailed-solution">
<p>Solution or Explanation Header</p>
<p>Solution or explanation text</p>
</div>
</solution>
</problem>
======
Tags
======
* ``<customresponse>``: Indicates that this problem has a custom response.
* ``<chemicalequationinput>``: Specifies that the answer to this problem is a chemical equation.
* ``<answer type=loncapa/python>``: Contains the Python script that grades the problem.
**Tag:** ``<customresponse>``
Indicates that this problem has a custom response. The ``<customresponse>`` tags must surround the ``<chemicalequation>`` tags.
Attributes
(none)
Children
* ``<chemicalequationinput>``
* ``<answer>``
**Tag:** ``<chemicalequationinput>``
Indicates that the answer to this problem is a chemical equation and creates a response field where the student enters an answer.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - size
- Specifies the size of the response field, in characters.
* - label (required)
- Contains the text of the principal question in the problem.
Children
(none)
**Tag:** ``<answer>``
Contains the Python script that grades the problem.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - type (required)
- Must be "loncapa/python".
Children
(none)
.. _Circuit Schematic Builder:
##################################
Circuit Schematic Builder Problem
##################################
In circuit schematic builder problems, students can arrange circuit elements such as voltage sources, capacitors, resistors, and MOSFETs on an interactive grid. They then submit a DC, AC, or transient analysis of their circuit to the system for grading.
.. image:: /Images/CircuitSchematicExample.png
:alt: Image of a circuit schematic builder
*********************************************
Create a Circuit Schematic Builder Problem
*********************************************
#. In the unit where you want to create the problem, click **Problem**
under **Add New Component**, and then click the **Advanced** tab.
#. Click **Circuit Schematic Builder**.
#. In the component that appears, click **Edit**.
#. In the component editor, replace the example code with your own code.
#. Click **Save**.
**Problem Code**
To create the problem in the image above, paste the following code into the Advanced Editor.
.. code-block:: xml
<problem>
<p>Make a voltage divider that splits the provided voltage evenly.</p>
<schematicresponse>
<center>
<schematic height="500" width="600" parts="g,r" analyses="dc"
initial_value="[["v",[168,144,0],{"value":"dc(1)","_json_":0},["1","0"]],["r",[296,120,0],{"r":"1","_json_":1},["1","output"]],["L",[296,168,3],{"label":"output","_json_":2},["output"]],["w",[296,216,168,216]],["w",[168,216,168,192]],["w",[168,144,168,120]],["w",[168,120,296,120]],["g",[168,216,0],{"_json_":7},["0"]],["view",-67.49999999999994,-78.49999999999994,1.6000000000000003,"50","10","1G",null,"100","1","1000"]]"
/>
</center>
<answer type="loncapa/python">
dc_value = "dc analysis not found"
for response in submission[0]:
if response[0] == 'dc':
for node in response[1:]:
dc_value = node['output']
if dc_value == .5:
correct = ['correct']
else:
correct = ['incorrect']
</answer>
</schematicresponse>
<schematicresponse>
<p>Make a high pass filter.</p>
<center>
<schematic height="500" width="600" parts="g,r,s,c" analyses="ac"
submit_analyses="{"ac":[["NodeA",1,9]]}"
initial_value="[["v",[160,152,0],{"name":"v1","value":"sin(0,1,1,0,0)","_json_":0},["1","0"]],["w",[160,200,240,200]],["g",[160,200,0],{"_json_":2},["0"]],["L",[240,152,3],{"label":"NodeA","_json_":3},["NodeA"]],["s",[240,152,0],{"color":"cyan","offset":"0","_json_":4},["NodeA"]],["view",64.55878906250004,54.114697265625054,2.5000000000000004,"50","10","1G",null,"100","1","1000"]]"/>
</center>
<answer type="loncapa/python">
ac_values = None
for response in submission[0]:
if response[0] == 'ac':
for node in response[1:]:
ac_values = node['NodeA']
print "the ac analysis value:", ac_values
if ac_values == None:
correct = ['incorrect']
elif ac_values[0][1] < ac_values[1][1]:
correct = ['correct']
else:
correct = ['incorrect']
</answer>
</schematicresponse>
<solution>
<div class="detailed-solution">
<p>Explanation</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><img src="/c4x/edX/edX101/asset/images_voltage_divider.png"/></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>
<p><img src="/c4x/edX/edX101/asset/images_high_pass_filter.png"/></p>
</div>
</solution>
</problem>
\ No newline at end of file
.. _Conditional Module:
####################
Conditional Module
####################
********************
Format description
********************
The main tag of conditional module input is:
.. code-block:: xml
<conditional> ... </conditional>
``conditional`` can include any number of any xmodule tags (``html``, ``video``, ``poll``, etc.) or ``show`` tags.
================
conditional tag
================
The main container for a single instance of a conditional module. The following attributes can
be specified for this tag:
.. code-block:: xml
sources - location id of required modules, separated by ';'
[message | ""] - message for case, where one or more are not passed. Here you can use variable {link}, which generate link to required module.
[submitted] - map to `is_submitted` module method.
(pressing RESET button makes this function to return False.)
[correct] - map to `is_correct` module method
[attempted] - map to `is_attempted` module method
[poll_answer] - map to `poll_answer` module attribute
[voted] - map to `voted` module attribute
========
show tag
========
Symlink to some set of xmodules. The following attributes can
be specified for this tag:
.. code-block:: xml
sources - location id of modules, separated by ';'
*********
Example
*********
========================================
Examples of conditional depends on poll
========================================
.. code-block:: xml
<conditional sources="i4x://MITx/0.000x/poll_question/first_real_poll_seq_with_reset" poll_answer="man"
message="{link} must be answered for this to become visible.">
<html>
<h2>You see this because your vote value for "First question" was "man"</h2>
</html>
</conditional>
========================================================
Examples of conditional depends on poll (use <show> tag)
========================================================
.. code-block:: xml
<conditional sources="i4x://MITx/0.000x/poll_question/first_real_poll_seq_with_reset" poll_answer="man"
message="{link} must be answered for this to become visible.">
<html>
<show sources="i4x://MITx/0.000x/problem/test_1; i4x://MITx/0.000x/Video/Avi_resources; i4x://MITx/0.000x/problem/test_1"/>
</html>
</conditional>
================================================
Examples of conditional depends on problem
================================================
.. code-block:: xml
<conditional sources="i4x://MITx/0.000x/problem/Conditional:lec27_Q1" attempted="True">
<html display_name="HTML for attempted problem">You see this, cause "lec27_Q1" is attempted.</html>
</conditional>
<conditional sources="i4x://MITx/0.000x/problem/Conditional:lec27_Q1" attempted="False">
<html display_name="HTML for not attempted problem">You see this because "lec27_Q1" is not attempted.</html>
</conditional>
.. _Create Exercises:
############################
Creating Exercises and Tools
############################
************************************
Introduction to Exercises and Tools
************************************
Studio allows you to create a wide variety of exercises and tools for your course. Many of these exercises and tools have templates in Studio so that you can create them easily. In addition, individual course teams frequently create exercises that don't have templates in Studio. We're striving to make these tools available to all our course teams as well, and we have instructions for creating some of them in this section.
Depending on the exercise or tool, you'll use an HTML, Problem, or Advanced component. The page for each individual exercise or tool contains an example of each exercise or tool, together with all the files, code, and step-by-step instructions that you need to create the exercise or tool.
.. note:: Problems must include labels for accessibility. The label generally includes the text of the main question in your problem. Instructions for adding labels appear in the page for each individual problem.
****************************
General Exercises and Tools
****************************
.. list-table::
:widths: 30 25 80
* - .. image:: /Images/AnnotationExample.png
:width: 100
:alt: Example annotation problem
- :ref:`Annotation`
- Annotation problems ask students to respond to questions about a specific block of text. The question appears above the text when the student hovers the mouse over the highlighted text so that students can think about the question as they read.
* - .. image:: /Images/PollExample.png
:width: 100
:alt: Example poll
- :ref:`Conditional Module`
- You can create a conditional module to control versions of content that groups of students see. For example, students who answer "Yes" to a poll question then see a different block of text from the students who answer "No" to that question.
* - .. image:: /Images/JavaScriptInputExample.png
:width: 100
:alt: Example JavaScript problem
- :ref:`Custom JavaScript`
- Custom JavaScript display and grading problems (also called *custom JavaScript problems* or *JS Input problems*) allow you to create a custom problem or tool that uses JavaScript and then add the problem or tool directly into Studio.
* - .. image:: /Images/external-grader-correct.png
:width: 100
:alt: Example external grader
- :ref:`External Grader`
- An external grader is a service that receives student responses to a problem, processes those responses, and returns feedback and a problem grade to the edX platform. You build and deploy an external grader separately from the edX platform. An external grader is particularly useful for software programming courses where students are asked to submit complex code.
* - .. image:: /Images/GoogleHangout_WithPeople.png
:width: 100
:alt: Google Hangout
- :ref:`Google Instant Hangout`
- You can add the ability for students to participate in instant hangouts directly from your course. With instant hangouts, students can interact through live video and voice, share screens and watch videos together, and collaborate on documents.
* - .. image:: /Images/LTIExample.png
:width: 100
:alt: Example LTI component
- :ref:`LTI Component`
- LTI components allow you to add an external learning application or non-PDF textbook to Studio.
* - .. image:: /Images/CITL_AssmtTypes.png
:width: 100
:alt: Example open response assessment
- :ref:`Open Response Assessment`
- In open response assessments, students receive feedback on written responses of varying lengths as well as files, such as computer code or images, that the students upload. Open response assessments include self assessment and peer assessment.
* - .. image:: /Images/PollExample.png
:width: 100
:alt: Example poll
- :ref:`Poll`
- You can run polls in your course so that your students can share opinions on different questions.
* - .. image:: /Images/ProblemWithAdaptiveHintExample.png
:width: 100
:alt: Example problem with adaptive hint
- :ref:`Problem with Adaptive Hint`
- A problem with an adaptive hint evaluates a student's response, then gives the student feedback or a hint based on that response so that the student is more likely to answer correctly on the next attempt. These problems can be text input or multiple choice problems.
* - .. image:: /Images/ProblemWrittenInLaTeX.png
:width: 100
:alt: Example problem written in LaTeX
- :ref:`Problem Written in LaTeX`
- If you have an problem that is already written in LaTeX, you can use this problem type to easily convert your code into XML.
* - .. image:: /Images/TextInputExample.png
:width: 100
:alt: Example text input problem
- :ref:`Text Input`
- In text input problems, students enter text into a response field. The response can include numbers, letters, and special characters such as punctuation marks.
* - .. image:: /Images/WordCloudExample.png
:width: 100
:alt: Example word cloud
- :ref:`Word Cloud`
- Word clouds arrange text that students enter - for example, in response to a question - into a colorful graphic that students can see.
* - .. image:: /Images/CustomPythonExample.png
:width: 100
:alt: Example write-your-own-grader problem
- :ref:`Write Your Own Grader`
- In custom Python-evaluated input (also called "write-your-own-grader") problems, the grader uses a Python script that you create and embed in the problem to evaluates a student's response or provide hints. These problems can be any type.
********************************
Image-Based Exercises and Tools
********************************
.. list-table::
:widths: 30 25 80
* - .. image:: /Images/DragAndDropProblem.png
:width: 100
:alt: Example drag and drop problem
- :ref:`Drag and Drop`
- In drag and drop problems, students respond to a question by dragging text or objects to a specific location on an image.
* - .. image:: /Images/image-modal.png
:width: 100
:alt: Example full screen image tool
- :ref:`Full Screen Image`
- The Full Screen Image tool allows a student to enlarge an image in the whole browser window. This is useful when the image contains a large amount of detail and text that is easier to view in context when enlarged.
* - .. image:: /Images/ImageMappedInputExample.png
:width: 100
:alt: Example image mapped input problem
- :ref:`Image Mapped Input`
- In an image mapped input problem, students click inside a defined area in an image. You define this area by including coordinates in the body of the problem.
* - .. image:: /Images/Zooming_Image.png
:width: 100
:alt: Example zooming image tool
- :ref:`Zooming Image`
- Zooming images allow you to enlarge sections of an image so that students can see the section in detail.
************************************
Multiple Choice Exercises and Tools
************************************
.. list-table::
:widths: 30 25 80
* - .. image:: /Images/CheckboxExample.png
:width: 100
:alt: Example checkbox problem
- :ref:`Checkbox`
- In checkbox problems, the student selects one or more options from a list of possible answers. The student must select all the options that apply to answer the problem correctly.
* - .. image:: /Images/DropdownExample.png
:width: 100
:alt: Example dropdown problem
- :ref:`Dropdown`
- Dropdown problems allow the student to choose from a collection of answer options, presented as a dropdown list. Unlike multiple choice problems, whose answers are always visible directly below the question, dropdown problems don't show answer choices until the student clicks the dropdown arrow.
* - .. image:: /Images/MultipleChoiceExample.png
:width: 100
:alt: Example multiple choice problem
- :ref:`Multiple Choice`
- In multiple choice problems, students select one option from a list of answer options. Unlike with dropdown problems, whose answer choices don't appear until the student clicks the drop-down arrow, answer choices for multiple choice problems are always visible directly below the question.
* - .. image:: /Images/MultipleChoice_NumericalInput.png
:width: 100
:alt: Example multiple choice and numerical input problem
- :ref:`Multiple Choice and Numerical Input`
- You can create a problem that combines a multiple choice and numerical input problems. Students not only select a response from options that you provide, but also provide more specific information, if necessary.
********************************
STEM Exercises and Tools
********************************
.. list-table::
:widths: 30 25 80
* - .. image:: /Images/ChemicalEquationExample.png
:width: 100
:alt: Example chemical equation problem
- :ref:`Chemical Equation`
- Chemical equation problems allow the student to enter text that represents a chemical equation into a text box. The grader evaluates the student's response by using a Python script that you create and embed in the problem.
* - .. image:: /Images/CircuitSchematicExample_short.png
:width: 100
:alt: Example circuit schematic builder problem
- :ref:`Circuit Schematic Builder`
- In circuit schematic builder problems, students can arrange circuit elements such as voltage sources, capacitors, resistors, and MOSFETs on an interactive grid. They then submit a DC, AC, or transient analysis of their circuit to the system for grading.
* - .. image:: /Images/GeneExplorer.png
:width: 100
:alt: Example gene explorer problem
- :ref:`Gene Explorer`
- The Gene Explorer (GeneX) simulates the transcription, splicing, processing, and translation of a small hypothetical eukaryotic gene. GeneX allows students to make specific mutations in a gene sequence, and it then calculates and displays the effects of the mutations on the mRNA and protein.
* - .. image:: /Images/MathExpressionInputExample.png
:width: 100
:alt: Example math expression input problem
- :ref:`Math Expression Input`
- The more complex of Studio's two types of math problems. In math expression input problems, students enter mathematical expressions to answer a question. These problems can include unknown variables and more complex symbolic expressions. You can specify a correct answer either explicitly or by using a Python script.
* - .. image:: /Images/Molecule_Editor.png
:width: 100
:alt: Example molecule editor problem
- :ref:`Molecule Editor`
- The molecule editor allows students to draw molecules that follow the rules for covalent bond formation and formal charge, even if the molecules are chemically impossible, are unstable, or do not exist in living systems.
* - .. image:: /Images/image292.png
:width: 100
:alt: Example numerical input problem
- :ref:`Numerical Input`
- The simpler of Studio's two types of math problems. In numerical input problems, students enter numbers or specific and relatively simple mathematical expressions to answer a question. These problems only allow integers and a few select constants. You can specify a margin of error, and you can specify a correct answer either explicitly or by using a Python script.
* - .. image:: /Images/Periodic_Table.png
:width: 100
:alt: Example periodic table problem
- :ref:`Periodic Table`
- An interactive periodic table of the elements shows detailed information about each element as the student moves the mouse over the element.
* - .. image:: /Images/ProteinBuilder.png
:width: 100
:alt: Example protein builder problem
- :ref:`Protein Builder`
- The Protex protein builder asks students to create specified protein shapes by stringing together amino acids.
\ No newline at end of file
.. _Custom JavaScript:
###########################
Custom JavaScript Problem
###########################
Custom JavaScript display and grading problems (also called *custom JavaScript problems*
or *JS Input problems*) allow you to create a custom problem or tool that uses JavaScript
and then add the problem or tool directly into Studio. When you create a JS Input problem,
Studio embeds the problem in an inline frame (IFrame) so that your students can interact with
it in the LMS. You can grade your students’ work using JavaScript and some basic Python, and
the grading is integrated into the edX grading system.
The JS Input problem that you create must use HTML, JavaScript, and cascading style sheets
(CSS). You can use any application creation tool, such as the Google Web Toolkit (GWT), to
create your JS Input problem.
.. image:: /Images/JavaScriptInputExample.png
:alt: Image of a JavaScript Input problem
************************************************************
Create a Custom JavaScript Display and Grading Problem
************************************************************
#. Create your JavaScript application, and then upload all files associated with
that application to the **Files & Uploads** page.
#. In the unit where you want to create the problem, click **Problem**
under **Add New Component**, and then click the **Advanced** tab.
#. Click **Custom JavaScript Display and Grading**.
#. In the component that appears, click **Edit**.
#. In the component editor, modify the example code according to your problem.
- All problems have more than one element. Most problems conform to the same-origin
policy (SOP), meaning that all elements have the same protocol, host, and port.
For example, **http**://**store.company.com**:**81**/subdirectory_1/JSInputElement.html and
**http**://**store.company.com**:**81**/subdirectory_2/JSInputElement.js have the same protocol
(http), host (store.company.com), and port (81).
If any elements of your problem use a different protocol, host, or port, you need to
bypass the SOP. For example, **https**://**info.company.com**/JSInputElement2.html
uses a different protocol, host, and port. To bypass the SOP, change
**sop="false"** in line 8 of the example code to **sop="true"**. For more information, see the same-origin policy
page on the `Mozilla Developer Network <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Same_origin_policy_for_JavaScript>`_
or on `Wikipedia <http://en.wikipedia.org/wiki/Same_origin_policy>`_.
#. If you want your problem to have a **Save** button, click the **Settings** tab, and then set
**Maximum Attempts** to a number larger than zero.
#. Click **Save**.
================================
Re-create the Example Problem
================================
To re-create the example problem above, you'll need the following files.
- webGLDemo.html
- webGLDemo.js
- webGLDemo.css
- three.min.js
To download these files in a .zip archive, go to http://files.edx.org/JSInput.zip.
..note:: If you need to bypass the SOP, you'll also need the **jschannel.js** file, and your webGLDemo.html file will be slightly different. To download all these files in a .zip archive, go to http://files.edx.org/JSInput_BypassSOP.zip.
#. Download and unpackage the files in either the JSInput.zip file or the JSInput_BypassSOP.zip file.
#. On the **Files & Uploads** page, upload all the files from the .zip file.
#. Create a new custom JavaScript display and grading problem component.
#. On the **Settings** tab, set **Maximum Attempts** to a number larger than
zero.
#. In the problem component editor, replace the example code with the code below.
#. Click **Save.**
================================
JavaScript Input Problem Code
================================
.. code-block:: xml
<problem display_name="webGLDemo">
In the image below, click the cone.
<script type="loncapa/python">
import json
def vglcfn(e, ans):
'''
par is a dictionary containing two keys, "answer" and "state"
The value of answer is the JSON string returned by getGrade
The value of state is the JSON string returned by getState
'''
par = json.loads(ans)
# We can use either the value of the answer key to grade
answer = json.loads(par["answer"])
return answer["cylinder"] and not answer["cube"]
# Or we can use the value of the state key
'''
state = json.loads(par["state"])
selectedObjects = state["selectedObjects"]
return selectedObjects["cylinder"] and not selectedObjects["cube"]
'''
</script>
<customresponse cfn="vglcfn">
<jsinput
gradefn="WebGLDemo.getGrade"
get_statefn="WebGLDemo.getState"
set_statefn="WebGLDemo.setState"
width="400"
height="400"
html_file="/static/webGLDemo.html"
/>
</customresponse>
</problem>
.. note:: When you create this problem, keep the following in mind.
- The webGLDemo.js file defines the three JavaScript functions (**WebGLDemo.getGrade**, **WebGLDemo.getState**, and **WebGLDemo.setState**).
- The JavaScript input problem code uses **WebGLDemo.getGrade**, **WebGLDemo.getState**, and **WebGLDemo.setState** to grade, save, or restore a problem. These functions must be global in scope.
- **WebGLDemo.getState** and **WebGLDemo.setState** are optional. You only have to define these functions if you want to conserve the state of the problem.
- **Width** and **height** represent the dimensions of the IFrame that holds the application.
- When the problem opens, the cone and the cube are both blue, or "unselected." When you click either shape once, the shape becomes yellow, or "selected." To unselect the shape, click it again. Continue clicking the shape to select and unselect it.
- The response is graded as correct if the cone is selected (yellow) when the user clicks **Check**.
- Clicking **Check** or **Save** registers the problem's current state.
.. _JS Input Problem XML:
******************************
JavaScript Input Problem XML
******************************
JSInput allows problem authors to turn stand-alone HTML files into problems that can be integrated into the edX platform. Since its aim is flexibility, it can be seen as the input and client-side equivalent of **CustomResponse**.
A JSInput exercise creates an IFrame in a static HTML page, and passes the return value of author-specified functions to the enclosing response type (generally **CustomResponse**). JSInput can also store and retrieve state.
========
Template
========
The following is the basic format of a JSInput problem:
.. code-block:: xml
<problem>
<script type="loncapa/python">
def all_true(exp, ans): return ans == "hi"
</script>
<customresponse cfn="all_true">
<jsinput gradefn="gradefn"
height="500"
get_statefn="getstate"
set_statefn="setstate"
html_file="/static/jsinput.html"/>
</customresponse>
</problem>
The accepted attributes are:
============== ============== ========= ==========
Attribute Name Value Type Required Default
============== ============== ========= ==========
html_file URL string Yes None
gradefn Function name Yes `gradefn`
set_statefn Function name No None
get_statefn Function name No None
height Integer No `500`
width Integer No `400`
============== ============== ========= ==========
========================
Required Attributes
========================
* **html_file**
The **html_file** attribute specifies the HTML file that the IFrame will point to. The HTML file
must be located in the content directory.
The IFrame is created using the sandbox attribute. Although pop-ups, scripts, and pointer locks are allowed, the IFrame cannot access its parent's attributes.
The HTML file must contain a **gradefn** function that the JSInput file can access. To determine whether the **gradefn** function is accessible, in the console, make sure that **gradefn** returns the right thing. When JSInput uses the **gradefn** function, `gradefn` is called with `gradefn`.call(`obj`), where **obj** is the object-part of **gradefn**. For example, if **gradefn** is **myprog.myfn**, JSInput calls **myprog.myfun.call(myprog)**. (This is to ensure "`this`" continues to refer to what `gradefn` expects.)
Aside from that, more or less anything goes. Note that currently there is no support for inheriting CSS or JavaScript from the parent (aside from the Chrome-only **seamless** attribute, which is set to True by default).
* **gradefn**
The **gradefn** attribute specifies the name of the function that will be called when a user clicks **Check**, and that returns the student's answer. Unless both the **get_statefn** and **set_statefn** attributes are also used, this answer is passed as a string to the enclosing response type. In the **customresponse** example above, this means **cfn** will be passed this answer as ``ans``.
If the **gradefn** function throws an exception when a student attempts to submit a problem, the submission is aborted, and the student receives a generic alert. The alert can be customised by making the exception name ``Waitfor Exception``; in that case, the alert message will be the exception message.
.. important:: To make sure the student's latest answer is passed correctly, make sure that the **gradefn** function is not asynchronous. Additionally, make sure that the function returns promptly. Currently the student has no indication that her answer is being calculated or produced.
========================
Optional Attributes
========================
* **set_statefn**
Sometimes a problem author will want information about a student's previous answers ("state") to be saved and reloaded. If the attribute **set_statefn** is used, the function given as its value will be passed the state as a string argument whenever there is a state, and the student returns to a problem. The function has the responsibility to then use this state approriately.
The state that is passed is:
* The previous output of **gradefn** (i.e., the previous answer) if **get_statefn** is not defined.
* The previous output of **get_statefn** (see below) otherwise.
It is the responsibility of the iframe to do proper verification of the argument that it receives via **set_statefn**.
* **get_statefn**
Sometimes the state and the answer are quite different. For instance, a problem that involves using a javascript program that allows the student to alter a molecule may grade based on the molecule's hydrophobicity, but from the hydrophobicity it might be incapable of restoring the state. In that case, a
*separate* state may be stored and loaded by **set_statefn**. Note that if **get_statefn** is defined, the answer (i.e., what is passed to the enclosing response type) will be a json string with the following format:
.. code-block:: xml
{
answer: `[answer string]`
state: `[state string]`
}
The enclosing response type must then parse this as json.
* **height** and **width**
The **height** and **width** attributes are straightforward: they specify the height and width of the IFrame. Both are limited by the enclosing DOM elements, so for instance there is an implicit max-width of around 900.
In the future, JSInput may attempt to make these dimensions match the HTML file's dimensions (up to the aforementioned limits), but currently it defaults to `500` and `400` for **height** and **width**, respectively.
.. _Write Your Own Grader:
##############################
Write-Your-Own-Grader Problem
##############################
In custom Python-evaluated input (also called "write-your-own-grader problems" problems), the grader uses a Python script that you create and embed in the problem to evaluates a student's response or provide hints. These problems can be any type. Numerical input and text input problems are the most popular write-your-own-grader problems.
.. image:: /Images/CustomPythonExample.png
:alt: Image of a write your own grader problem
Custom Python-evaluated input problems can include the following:
* :ref:`Chemical Equation`
* :ref:`Custom JavaScript`
* :ref:`Gene Explorer`
* :ref:`Molecule Editor`
* :ref:`Protein Builder`
.. list-table::
:widths: 20 80
* - ``<script type="loncapa/python">``
- Indicates that the problem contains a Python script.
* - ``<customresponse cfn="test_add_to_ten">``
-
* - ``<customresponse cfn="test_add" expect="20">``
-
* - <textline size="10" correct_answer="3"/>
- This tag includes the ``size``, ``correct_answer``, and ``label`` attributes. The ``correct_answer`` attribute is optional.
You can create one of these problems in :ref:`Answer Tag Format` or :ref:`Script Tag Format`.
.. _Answer Tag Format:
**************************
Answer Tag Format
**************************
The answer tag format encloses the Python script in an ``<answer>`` tag:
.. code-block:: xml
<answer>
if answers[0] == expect:
correct[0] = 'correct'
overall_message = 'Good job!'
else:
correct[0] = 'incorrect'
messages[0] = 'This answer is incorrect'
overall_message = 'Please try again'
</answer>
.. important:: Python honors indentation. Within the ``<answer>`` tag, you must begin your script with no indentation.
The Python script interacts with these variables in the global context:
* ``answers``: An ordered list of answers the student provided. For example, if the student answered ``6``, ``answers[0]`` would equal ``6``.
* ``expect``: The value of the ``expect`` attribute of ``<customresponse>`` (if provided).
* ``correct``: An ordered list of strings indicating whether the student answered the question correctly. Valid values are ``"correct"``, ``"incorrect"``, and ``"unknown"``. You can set these values in the script.
* ``messages``: An ordered list of messages that appear under each response field in the problem. You can use this to provide hints to users. For example, if you include ``messages[0] = "The capital of California is Sacramento"``, that message appears under the first response field in the problem.
* ``overall_message``: A message that appears beneath the entire problem. You can use this to provide a hint that applies to the entire problem rather than a particular response field.
========================================================================
Create a Custom Python-Evaluated Input Problem in Answer Tag Format
========================================================================
To create a custom Python-evaluated input problem using an ``<answer>`` tag:
#. In the unit where you want to create the problem, click **Problem**
under **Add New Component**, and then click the **Advanced** tab.
#. Click **Custom Python-Evaluated Input**.
#. In the component that appears, click **Edit**.
#. In the component editor, replace the example code with the following code.
#. Click **Save**.
.. code-block:: xml
<problem>
<p>What is the sum of 2 and 3?</p>
<customresponse expect="5">
<textline math="1" />
</customresponse>
<answer>
if answers[0] == expect:
correct[0] = 'correct'
overall_message = 'Good job!'
else:
correct[0] = 'incorrect'
messages[0] = 'This answer is incorrect'
overall_message = 'Please try again'
</answer>
</problem>
.. important:: Python honors indentation. Within the ``<answer>`` tag, you must begin your script with no indentation.
.. _Script Tag Format:
**************************
Script Tag Format
**************************
The script tag format encloses a Python script that contains a "check function" in a ``<script>`` tag, and adds the ``cfn`` attribute of the ``<customresponse>`` tag to reference that function:
.. code-block:: xml
<problem>
<script type="loncapa/python">
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)
</script>
<p>Enter two integers that sum to 10. </p>
<customresponse cfn="test_add_to_ten">
<textline size="10"/><br/>
<textline size="10/>
</customresponse>
</problem>
**Important**: Python honors indentation. Within the ``<script>`` tag, the ``def check_func(expect, ans):`` line must have no indentation.
The **check** function accepts two arguments:
* ``expect`` is the value of the ``expect`` attribute of ``<customresponse>`` (if provided)
* ``answer`` is either:
* The value of the answer the student provided, if the problem only has one response field.
* An ordered list of answers the student provided, if the problem has multiple response fields.
The **check** function can return any of the following to indicate whether the student's answer is correct:
* ``True``: Indicates that the student answered correctly for all response fields.
* ``False``: Indicates that the student answered incorrectly. All response fields are marked as incorrect.
* A dictionary of the form: ``{ 'ok': True, 'msg': 'Message' }``
If the dictionary's value for ``ok`` is set to ``True``, all response fields are marked correct; if it is set to ``False``, all response fields are marked incorrect. The ``msg`` is displayed beneath all response fields, and it may contain XHTML markup.
* A dictionary of the form
.. code-block:: xml
{ 'overall_message': 'Overall message',
'input_list': [
{ 'ok': True, 'msg': 'Feedback for input 1'},
{ 'ok': False, 'msg': 'Feedback for input 2'},
... ] }
The last form is useful for responses that contain multiple response fields. It allows you to provide feedback for each response field individually, as well as a message that applies to the entire response.
Example of a checking function:
.. code-block:: python
def check_func(expect, answer_given):
check1 = (int(answer_given[0]) == 1)
check2 = (int(answer_given[1]) == 2)
check3 = (int(answer_given[2]) == 3)
return {'overall_message': 'Overall message',
'input_list': [
{ 'ok': check1, 'msg': 'Feedback 1'},
{ 'ok': check2, 'msg': 'Feedback 2'},
{ 'ok': check3, 'msg': 'Feedback 3'} ] }
The function checks that the user entered ``1`` for the first input, ``2`` for the second input, and ``3`` for the third input. It provides feedback messages for each individual input, as well as a message displayed beneath the entire problem.
========================================================================
Create a Custom Python-Evaluated Input Problem in Script Tag Format
========================================================================
To create a custom Python-evaluated input problem using a ``<script>`` tag:
#. In the unit where you want to create the problem, click **Problem**
under **Add New Component**, and then click the **Advanced** tab.
#. Click **Custom Python-Evaluated Input**.
#. In the component that appears, click **Edit**.
#. In the component editor, replace the example code with the following code.
#. Click **Save**.
**Problem Code**:
.. code-block:: xml
<problem>
<p>This question has two parts.</p>
<script type="loncapa/python">
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)
</script>
<p>Part 1: Enter two integers that sum to 10. </p>
<customresponse cfn="test_add_to_ten">
<textline size="10" correct_answer="3" label="Integer #1"/><br/>
<textline size="10" correct_answer="7" label="Integer #2"/>
</customresponse>
<p>Part 2: Enter two integers that sum to 20. </p>
<customresponse cfn="test_add" expect="20">
<textline size="10" label="Integer #1"/><br/>
<textline size="10" label="Integer #2"/>
</customresponse>
<solution>
<div class="detailed-solution">
<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>
**Templates**
The following template includes answers that appear when the student clicks **Show Answer**.
.. 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>Problem text</p>
<customresponse cfn="test_add" expect="20">
<textline size="10" correct_answer="11" label="Integer #1"/><br/>
<textline size="10" correct_answer="9" label="Integer #2"/>
</customresponse>
<solution>
<div class="detailed-solution">
<p>Solution or Explanation Heading</p>
<p>Solution or explanation text</p>
</div>
</solution>
</problem>
The following template does not return answers when the student clicks **Show Answer**. If your problem doesn't include answers for the student to see, make sure to set **Show Answer** to **Never** in the problem component.
.. 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 that sum to 20: </p>
<customresponse cfn="test_add" expect="20">
<textline size="10" label="Integer #1"/><br/>
<textline size="10" label="Integer #2"/>
</customresponse>
<solution>
<div class="detailed-solution">
<p>Solution or Explanation Heading</p>
<p>Solution or explanation text</p>
</div>
</solution>
</problem>
.. _Drag and Drop:
##########################
Drag and Drop Problem
##########################
In drag and drop problems, students respond to a question by dragging text or objects to a specific location on an image.
.. image:: /Images/DragAndDropProblem.png
:alt: Image of a drag and drop problem
*********************************
Create a Drag and Drop Problem
*********************************
To create a drag and drop problem, you'll need the following files:
* Allopurinol.gif
* AllopurinolAnswer.gif
To download both these files in a .zip archive, go to http://files.edx.org/DragAndDropProblemFiles.zip.
To create the molecule editor that appears in the image above, you'll upload the files for this problem, and then paste the code below into a Problem component.
#. Upload the Allopurinol.gif and AllopurinolAnswer.gif files to the **Files & Uploads** page.
#. In the unit where you want to create the problem, click **Problem** under **Add New Component**, and then click the **Advanced** tab.
#. Click **Drag and Drop**.
#. In the component that appears, click **Edit**.
#. In the component editor, replace the example code with the following code.
#. Click **Save**.
**Problem Code**:
.. code-block:: xml
<problem>
<p> Allopurinol is a drug used to treat and prevent gout, a very painful form of arthritis. Once only a “rich man’s disease”, gout has become more and more common in recent decades – affecting about 3 million people in the United States alone. Deposits of needle-like crystals of uric acid in connective tissue or joint spaces cause the symptoms of swelling, stiffness and intense pain. Individuals with gout overproduce uric acid because they cannot eliminate it efficiently. Allopurinol treats and prevents gout by stopping the overproduction of uric acid through inhibition of an enzyme required for the synthesis of uric acid. </p>
<p> You are shown one of many possible molecules. On the structure of allopurinol below, identify the functional groups that are present by dragging the functional group name listed onto the appropriate target boxes on the structure. If you want to change an answer, you have to drag off the name as well. You may need to scroll through the names of functional groups to see all options. </p>
<customresponse>
<drag_and_drop_input no_labels="true" one_per_target="true" target_outline="true" img="/static/Allopurinol.gif">
<draggable can_reuse="true" label="methyl" id="1"/>
<draggable can_reuse="true" label="hydroxyl" id="2"/>
<draggable can_reuse="true" label="amino" id="3"/>
<draggable can_reuse="true" label="carboxyl" id="4"/>
<draggable can_reuse="true" label="aldehyde" id="5"/>
<draggable can_reuse="true" label="phosphate" id="6"/>
<draggable can_reuse="true" label="sulfhydryl" id="7"/>
<draggable can_reuse="true" label="phenyl" id="8"/>
<draggable can_reuse="true" label="none" id="none"/>
<target id="0" h="53" w="66" y="55.100006103515625" x="131.5"/>
<target id="1" h="113" w="55" y="140.10000610351562" x="181.5"/>
</drag_and_drop_input>
<answer type="loncapa/python"> correct_answer = [ {'draggables': ['2'], 'targets': ['0' ], 'rule':'unordered_equal' }, {'draggables': ['none'], 'targets': ['1' ], 'rule':'unordered_equal' }] if draganddrop.grade(submission[0], correct_answer): correct = ['correct'] else: correct = ['incorrect'] </answer>
</customresponse>
<solution>
<img src="/static/AllopurinolAnswer.gif"/>
</solution>
</problem>
.. _Drag and Drop Problem XML:
*********************************
Drag and Drop Problem XML
*********************************
========
Template
========
.. code-block:: xml
<problem>
<p>Problem text</p>
<customresponse>
<drag_and_drop_input no_labels="false" one_per_target="true" target_outline="true" img="/static/TARGET_IMAGE.gif">
<draggable can_reuse="true" label="NAME 1" id="1"/>
<draggable can_reuse="true" label="NAME 2" id="2"/>
<target id="0" h="HEIGHT (in pixels)" w="WIDTH (in pixels)" y="Y-COORDINATE" x="X-COORDINATE"/>
<target id="1" h="HEIGHT (in pixels)" w="WIDTH (in pixels)" y="Y-COORDINATE" x="X-COORDINATE"/>
</drag_and_drop_input>
<answer type="loncapa/python"> correct_answer = [ {'draggables': ['2'], 'targets': ['0' ], 'rule':'unordered_equal' }, {'draggables': ['none'], 'targets': ['1' ], 'rule':'unordered_equal' }] if draganddrop.grade(submission[0], correct_answer): correct = ['correct'] else: correct = ['incorrect'] </answer>
</customresponse>
<solution>
<img src="/static/ANSWER_IMAGE.gif"/>
</solution>
</problem>
========
Tags
========
* ``<drag_and_drop_input/>``: Indicates the problem is a drag and drop problem.
* ``<draggable/>``: Specifies a single object that a student will drag onto the base image.
* ``<target>``: Specifies the location on the base image where a draggable must be dropped.
**Tag:** ``<drag_and_drop_input/>``
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - img (required)
- Relative path to an image that will be the base image. All draggables can be dragged onto it.
* - target_outline
- Specifies whether an outline (gray dashed line) should be drawn around targets (if they are specified). It can be either 'true' or 'false'. If not specified, the targets do not have outlines.
* - one_per_target
- Specify whether to allow more than one draggable to be placed onto a single target. It can be either 'true' or 'false'. If not specified, the default value is 'true'.
* - no_labels (required)
- default is false, in default behaviour if label is not set, label is obtained from id. If no_labels is true, labels are not automatically populated from id, and one can not set labels and obtain only icons.
Children
* ``<draggable>``
* ``<target>``
**Tag:** ``<draggable/>``
Specifies a single draggable object in a drag and drop problem.
A draggable is what the user must drag out of the slider and drop onto the base image. After a drag operation, if the center of the draggable is located outside the rectangular dimensions of the image, it will be returned to the slider.
For the grader to work, each draggable must have a unique ID.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - id (required)
- Unique identifier of the draggable object.
* - label (optional)
- Text label that the user sees.
* - icon (optional)
- For draggables that are images, the relative path to the image file.
* - can_reuse
- true or false, default is false. If true, same draggable can be used multiple times.
Children
(none)
**Tag:** ``<target>``
Specifies the location on the base image where a student must drop a draggable item. By design, if the center of a draggable lies within the target (i.e. in the rectangle defined by [[x, y], [x + w, y + h]], it is within the target. Otherwise, it is outside.
If you specify at least one target, and a student drops a draggable item on a location that is outside a target, the draggable item returns to the slider.
If you don't specify a target, a student can drop a draggable item anywhere on the base image.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - id (required)
- Unique identifier of the target object.
* - x
- X-coordinate on the base image where the top left corner of the target will be positioned.
* - y
- Y-coordinate on the base image where the top left corner of the target will be positioned.
* - w
- Width of the target, in pixels.
* - h
- Height of the target, in pixels.
Children
(none)
For more information about how to create drag and drop problems, see `XML Format of Drag and Drop Input
<https://edx.readthedocs.org/en/latest/course_data_formats/drag_and_drop/drag_and_drop_input.html>`_.
.. _Dropdown:
#####################
Dropdown Problem
#####################
Dropdown problems allow the student to choose from a collection of answer options, presented as a dropdown list. Unlike multiple choice problems, whose answers are always visible directly below the question, dropdown problems don't show answer choices until the student clicks the dropdown arrow.
.. image:: /Images/DropdownExample.png
:alt: Image of a dropdown problem
********************************
Create a Dropdown Problem
********************************
You can create dropdown problems in the Simple Editor or in the Advanced Editor.
.. note:: All problems must include labels for accessibility. The label generally includes the text of the main question in your problem. To add a label for a common problem, surround the text of the label with angle brackets pointed toward the text (>>label text<<).
================
Simple Editor
================
To create a dropdown problem, follow these steps.
#. Under **Add New Component**, click **Problem**.
#. In the **Select Problem Component Type** screen, click
**Dropdown** on the **Common Problem Types** tab.
#. In the new Problem component that appears, click **Edit**.
#. Replace the default text with the text for your problem. Enter each of the possible
answers on the same line, separated by commas.
#. Determine the text of the problem to use as a label, and then surround that text with two sets of angle brackets (>><<).
#. Select all the answer options, and then click the dropdown button.
.. image:: /Images/ProbCompButton_Dropdown.png
:alt: Image of the dropdown button
When you do this, a double set of brackets ([[ ]]) appears and surrounds the
answer options.
#. Inside the brackets, surround the correct answer with parentheses.
#. In the component editor, select the text of the explanation, and then click the
explanation button to add explanation tags around the text.
.. image:: /Images/ProbCompButton_Explanation.png
:alt: Image of the explanation button
#. On the **Settings** tab, specify the settings that you want.
#. Click **Save**.
For the example problem above, the text in the Problem component is the
following.
::
>>What type of data are the following?<<
Age:
[[Nominal, Discrete, (Continuous)]]
Age, rounded to the nearest year:
[[Nominal, (Discrete), Continuous]]
Life stage - infant, child, and adult:
[[(Nominal), Discrete, Continuous]]
================
Advanced Editor
================
To create this problem in the Advanced Editor, click the **Advanced** tab in the Problem component editor, and then replace the existing code with the following code.
**Problem Code:**
.. code-block:: xml
<problem>
<p>
<em>This exercise first appeared in HarvardX's PH207x Health in Numbers: Quantitative Methods in Clinical &amp; Public Health Research course, fall 2012.</em>
</p>
<p>What type of data are the following?</p>
<p>Age:</p>
<optionresponse>
<optioninput options="('Nominal','Discrete','Continuous')" correct="Continuous" label="Age"/>
</optionresponse>
<p>Age, rounded to the nearest year:</p>
<optionresponse>
<optioninput options="('Nominal','Discrete','Continuous')" correct="Discrete" label="Age, rounded to the nearest year"/>
</optionresponse>
<p>Life stage - infant, child, and adult:</p>
<optionresponse>
<optioninput options="('Nominal','Discrete','Continuous')" correct="Nominal" label="Life stage"/>
</optionresponse>
</problem>
.. _Dropdown Problem XML:
************************
Dropdown Problem XML
************************
========
Template
========
.. code-block:: xml
<problem>
<p>
Problem text</p>
<optionresponse>
<optioninput options="('Option 1','Option 2','Option 3')" correct="Option 2" label="label text"/>
</optionresponse>
<solution>
<div class="detailed-solution">
<p>Explanation or Solution Header</p>
<p>Explanation or solution text</p>
</div>
</solution>
</problem>
.. code-block:: xml
<problem>
<p>Problem text</p>
<optionresponse>
options="('A','B')"
correct="A"/>
label="label text"
</optionresponse>
<solution>
<div class="detailed-solution">
<p>Explanation or Solution Header</p>
<p>Explanation or solution text</p>
</div>
</solution>
</problem>
========
Tags
========
* ``<optionresponse>`` (required): Indicates that the problem is a dropdown problem.
* ``<optioninput>`` (required): Lists the answer options.
**Tag:** ``<optionresponse>``
Indicates that the problem is a dropdown problem.
Attributes
(none)
Children
* ``<optioninput>``
**Tag:** ``<optioninput>``
Lists the answer options.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - options (required)
- Lists the answer options. The list of all answer options is surrounded by parentheses. Individual answer options are surrounded by single quotation marks (') and separated by commas (,).
* - correct (required)
- Indicates whether an answer is correct. Possible values are "true" and "false". Only one **correct** attribute can be set to "true".
* - label (required)
- Specifies the name of the response field.
Children
(none)
\ No newline at end of file
.. _Using External Graders: .. _External Grader:
########################### ###########################
Using External Graders External Grader
########################### ###########################
...@@ -31,13 +31,13 @@ An external grader is particularly useful for software programming courses where ...@@ -31,13 +31,13 @@ An external grader is particularly useful for software programming courses where
For example, you define a problem that requires students to submit Python code, and create a set of tests that an external grader can run to verify the submissions. When a student enters Python code for the problem and clicks **Check**, the code is sent to the grader for testing. If the code passes all tests, the grader returns the score and a string indicating that the solution is correct. For example, you define a problem that requires students to submit Python code, and create a set of tests that an external grader can run to verify the submissions. When a student enters Python code for the problem and clicks **Check**, the code is sent to the grader for testing. If the code passes all tests, the grader returns the score and a string indicating that the solution is correct.
.. image:: ../Images/external-grader-correct.png .. image:: /Images/external-grader-correct.png
:alt: Image of a students view of a programming problem that uses an external grader, with a correct result :alt: Image of a students view of a programming problem that uses an external grader, with a correct result
The external grader can return a string with results, which the student can see by clicking **See full output**. This can be particularly useful when the solution is not correct and you want to return information about the failed tests. For example: The external grader can return a string with results, which the student can see by clicking **See full output**. This can be particularly useful when the solution is not correct and you want to return information about the failed tests. For example:
.. image:: ../Images/external-grader-incorrect.png .. image:: /Images/external-grader-incorrect.png
:alt: Image of a students view of a programming problem that uses an external grader, with a correct result :alt: Image of a students view of a programming problem that uses an external grader, with a correct result
.. _External Graders and XQueue: .. _External Graders and XQueue:
......
.. _Full Screen Image:
######################
Full Screen Image Tool
######################
Some large images are difficult for students to view in the courseware. The full screen image tool allows students to enlarge the image, so they can see all the detail in context.
****************************************
The Student View of a Full Screen Image
****************************************
The student sees the full screen image in a unit page. When the student hovers the mouse pointer over the image, the **Fullscreen** button appears:
.. image:: /Images/image-modal.png
:alt: Image of the full screen image tool with the Full Screen button.
When the student clicks **Fullscreen**, the image opens and expands in the full browser window. The buttons **Close**, **Zoom In**, and **Zoom Out** appear:
.. image:: /Images/image-modal-window.png
:alt: Image of the Image Modal tool with the Full Screen button.
The student can then zoom in on the image, and drag the image to view the desired part of it:
.. image:: /Images/image-modeal-zoomed.png
:alt: Image of the Image Modal tool with the Full Screen button.
******************************
Create a Full Screen Image
******************************
#. Upload your image file to the **Files & Uploads** page. For more information about how to do this, see :ref:`Add Files to a Course`.
#. Under **Add New Component**, click **html**, and then click **Full Screen Image**.
#. In the new component that appears, click **Edit**.
#. In the component editor, replace the default title, remove the instructional paragraph, and add text as needed.
#. Switch to the **HTML** tab.
#. Replace the following placeholders with your own content.
* Replace the value of the <a> element's href attribute with the path to your image. Do not change the value of the class attribute. For example:
**<a href="/static/Image1.jpg" class="modal-content">**
* Replace the value of the <img> element's src attribute with the path to your image. For example:
**<img alt="Full screen image" src="/static/Image1.jpg"/>**
* Ensure that the value of the href and src attributes are the same, and that you do not change the class attribute. Your sample code should look like the following:
.. code-block:: xml
<h2>Sample Image Modal</h2>
<a href="/static/Image1.jpg" class="modal-content">
<img alt="Full screen image" src="/static/Image1.jpg"/>
</a>
.. note:: You can use this same HTML code in any HTML component, not just those components you created as full screen images.
#. Click **Save** to save the HTML component.
\ No newline at end of file
.. _Gene Explorer:
##################
Gene Explorer Tool
##################
The Gene Explorer (GeneX), from the biology department at `UMB <http://www.umb.edu/>`_, simulates the transcription, splicing, processing, and translation of a small hypothetical eukaryotic gene. GeneX allows students to make specific mutations in a gene sequence, and it then calculates and displays the effects of the mutations on the mRNA and protein.
Specifically, the Gene Explorer does the following:
#. Finds the promoter and terminator
#. Reads the DNA sequence to produce the pre-mRNA
#. Finds the splice sites
#. Splices and tails the mRNA
#. Finds the start codon
#. Translates the mRNA
.. image:: /Images/GeneExplorer.png
:alt: Image of the Gene Explorer
For more information about the Gene Explorer, see `The Gene Explorer <http://intro.bio.umb.edu/GX/>`_.
********************
Gene Explorer Code
********************
.. code-block:: xml
<problem>
<p>Make a single base pair substitution mutation in the gene below that results in a protein that is longer than the protein produced by the original gene. When you are satisfied with your change and its effect, click the <b>SUBMIT</b> button.</p>
<p>Note that a "single base pair substitution mutation" is when a single base is changed to another base; for example, changing the A at position 80 to a T. Deletions and insertions are not allowed.</p>
<script type="loncapa/python">
def genex_grader(expect,ans):
if ans=="CORRECT": return True
import json
ans=json.loads(ans)
return ans["genex_answer"]=="CORRECT"
</script>
<customresponse cfn="genex_grader">
<editageneinput width="818" height="1000" dna_sequence="TAAGGCTATAACCGAGATTGATGCCTTGTGCGATAAGGTGTGTCCCCCCCCAAAGTGTCGGATGTCGAGTGCGCGTGCAAAAAAAAACAAAGGCGAGGACCTTAAGAAGGTGTGAGGGGGCGCTCGAT" genex_dna_sequence="TAAGGCTATAACCGAGATTGATGCCTTGTGCGATAAGGTGTGTCCCCCCCCAAAGTGTCGGATGTCGAGTGCGCGTGCAAAAAAAAACAAAGGCGAGGACCTTAAGAAGGTGTGAGGGGGCGCTCGAT" genex_problem_number="2"/>
</customresponse>
</problem>
In this code:
* **width** and **height** specify the dimensions of the application, in pixels.
* **genex_dna_sequence** is the default DNA sequence that appears when the problem opens.
* **dna_sequence** contains the application's state and the student's answer. This value must be the same as **genex_dna_sequence**.
* **genex_problem_number** specifies the number of the problem. This number is based on the five gene editor problems in the MITx 7.00x course--for example, if you want this problem to look like the second gene editor problem in the 7.00x course, you would set the **genex_problem_number** value to 2. The number must be 1, 2, 3, 4, or 5.
\ No newline at end of file
.. _Using an Instant Hangout in Your Course: .. _Google Instant Hangout:
########################################### ###########################################
Using an Instant Hangout in Your Course Google Instant Hangout Tool
########################################### ###########################################
This chapter describes how you can use instant hangouts in your course. See: This chapter describes how you can use instant hangouts in your course. See:
...@@ -52,28 +52,28 @@ The Student Experience ...@@ -52,28 +52,28 @@ The Student Experience
When you add the instant hangout to your course, a control for the hangout appears on that page. The following example shows the control in a course unit. The control shows that the student can start the hangout and be the first participant. When you add the instant hangout to your course, a control for the hangout appears on that page. The following example shows the control in a course unit. The control shows that the student can start the hangout and be the first participant.
.. image:: ../Images/hangout_unit.png .. image:: /Images/hangout_unit.png
:alt: Image of the instant hangout control on a unit :alt: Image of the instant hangout control on a unit
To start the hangout, the student clicks **Start the Hangout**. (After the first student clicks **Start the Hangout**, other students see a **Join the Hangout** button.) To start the hangout, the student clicks **Start the Hangout**. (After the first student clicks **Start the Hangout**, other students see a **Join the Hangout** button.)
The following example shows the control in a page when a hangout has already started. The control has a **Join the Hangout** button, and shows that one other student is already in the hangout. The following example shows the control in a page when a hangout has already started. The control has a **Join the Hangout** button, and shows that one other student is already in the hangout.
.. image:: ../Images/hangout_static_page.png .. image:: /Images/hangout_static_page.png
:alt: Image of the instant hangout control on a page :alt: Image of the instant hangout control on a page
To join the hangout, the student clicks **Join the Hangout**. To join the hangout, the student clicks **Join the Hangout**.
If not already logged in, the student is prompted to log in to Google: If not already logged in, the student is prompted to log in to Google:
.. image:: ../Images/google_login.png .. image:: /Images/google_login.png
:alt: Image of the Google login page :alt: Image of the Google login page
Students who do not have a Google account can create one from the login page. Students who do not have a Google account can create one from the login page.
After the student has logged in to Google, the hangout opens in a separate browser window: After the student has logged in to Google, the hangout opens in a separate browser window:
.. image:: ../Images/hangout.png .. image:: /Images/GoogleHangout_WithPeople.png
:alt: Image of the instant hangout :alt: Image of the instant hangout
.. _Limitations: .. _Limitations:
......
.. _Image Mapped Input:
###########################
Image Mapped Input Problem
###########################
In an image mapped input problem, students click inside a defined area in an image. You define this area by including coordinates in the body of the problem.
.. image:: /Images/ImageMappedInputExample.png
:alt: Image of an image mapped input problem
****************************************
Create an Image Mapped Input Problem
****************************************
To create a image mapped input problem:
#. In the unit where you want to create the problem, click **Problem**
under **Add New Component**, and then click the **Advanced** tab.
#. Click **Image Mapped Input**.
#. In the component that appears, click **Edit**.
#. In the component editor, replace the example code with your own code.
#. Click **Save**.
**Problem Code**:
.. code-block:: xml
<problem>
<p><b>Example Problem</b></p>
<startouttext/>
<p>In the image below, click the triangle.</p>
<endouttext/>
<imageresponse>
<imageinput src="/static/threeshapes.png" width="220" height="150" rectangle="(80,40)-(130,90)" />
</imageresponse>
</problem>
.. _Image Mapped Input Problem XML:
******************************
Image Mapped Input Problem XML
******************************
==========
Template
==========
.. code-block:: xml
<problem>
<startouttext/>
<p>In the image below, click the triangle.</p>
<endouttext/>
<imageresponse>
<imageinput src="IMAGE FILE PATH" width="NUMBER" height="NUMBER" rectangle="(X-AXIS,Y-AXIS)-(X-AXIS,Y-AXIS)" />
</imageresponse>
</problem>
=====
Tags
=====
* ``<imageresponse>``: Indicates that the problem is an image mapped input problem.
* ``<imageinput>``: Specifies the image file and the region in the file that the student must click.
**Tag:** ``<imageresponse>``
Indicates that the problem is an image mapped input problem.
Attributes
(none)
Children
* ``<imageinput>``
**Tag:** ``<imageinput>``
Specifies the image file and the region in the file that the student must click.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - src (required)
- The URL of the image
* - height (required)
- The height of the image, in pixels
* - width (required)
- The width of the image, in pixels
* - rectangle (required)
- An attribute with four embedded values in the format (<start_width>,<start_height>)-(<end_width>,<end-height>). All coordinates start with (0,0) in the top left corner and increase in value toward the bottom right corner, very similar to the progression of reading English. The two coordinates defined form the two opposite corners of a box which a student can click inside of.
Children
(none)
.. _Exercises and Tools Index:
############################
Creating Exercises and Tools
############################
.. toctree::
:maxdepth: 2
create_exercises_and_tools
annotation
checkbox
chemical_equation
circuit_schematic_builder
conditional_module
custom_javascript
custom_python
drag_and_drop
dropdown
external_graders
full_screen_image
gene_explorer
google_hangouts
image_mapped_input
lti_component
math_expression_input
molecule_editor
multiple_choice
mult_choice_num_input
numerical_input
open_response_assessment
periodic_table
poll
problem_with_hint
problem_in_latex
protein_builder
text_input
word_cloud
zooming_image
mathjax
\ No newline at end of file
.. _LTI Component:
###############
LTI Component
###############
You may have discovered or developed an external learning application
that you want to add to your online course. Or, you may have a digital
copy of your textbook that uses a format other than PDF. You can add
external learning applications or textbooks to Studio by using a
Learning Tools Interoperability (LTI) component. The LTI component is
based on the `IMS Global Learning Tools
Interoperability <http://www.imsglobal.org/LTI/v1p1p1/ltiIMGv1p1p1.html>`_
version 1.1.1 specifications.
You can use an LTI component in two ways.
- You can add external LTI content that is displayed only, such as
textbook content that doesn’t require a student response.
- You can add external LTI content that requires a student response. An
external provider will grade student responses.
For example, the following LTI component incorporates a Cerego tool that students interact with.
.. image:: /Images/LTIExample.png
:alt: Cerebro LTI component example
Before you create an LTI component from an external LTI provider in a
unit, you need the following information.
- The **LTI ID**. This is a value that you create to refer to the external LTI
provider. You should create an LTI ID that you can remember easily.
The LTI ID can contain uppercase and lowercase alphanumeric
characters, as well as underscore characters (_). It can contain any
number of characters. For example, you may create an LTI ID that is
as simple as **test_lti_id**, or your LTI ID may be a string of
numbers and letters such as **id_21441** or
**book_lti_provider_from_new_york**.
- The **client key**. This value is a sequence of characters that you
obtain from the LTI provider. The client key is used for
authentication and can contain any number of characters. For example,
your client key may be **b289378-f88d-2929-ctools.umich.edu**.
- The **client secret**. This value is a sequence of characters that
you obtain from the LTI provider. The client secret is used for
authentication and can contain any number of characters. For example,
your client secret may be something as simple as **secret**, or it
may be a string of numbers and letters such as **23746387264** or
**yt4984yr8**.
- The **launch URL** (if the LTI component requires a student response
that will be graded). You obtain the launch URL from the LTI
provider. The launch URL is the URL that Studio sends to the external
LTI provider so that the provider can send back students’ grades.
************************
Create an LTI Component
************************
Creating an LTI component in your course has three steps.
#. Add LTI to the **advanced_modules** policy key.
#. Register the LTI provider.
#. Create the LTI component in an individual unit.
======================================================
Step 1. Add LTI to the Advanced Modules Policy Key
======================================================
#. On the **Settings** menu, click **Advanced Settings**.
#. On the **Advanced Settings** page, locate the **Manual Policy
Definition** section, and then locate the **advanced_modules**
policy key (this key is at the top of the list).
.. image:: /Images/AdvancedModulesEmpty.png
:alt: Image of the advanced_modules key in the Advanced Settings page
#. Under **Policy Value**, place your cursor between the brackets, and
then enter **“lti”**. Make sure to include the quotation marks, but
not the period.
.. image:: /Images/LTIPolicyKey.png
:alt: Image of the advanced_modules key in the Advanced Settings page, with the LTI value added
**Note** If the **Policy Value** field already contains text, place your
cursor directly after the closing quotation mark for the final item, and
then enter a comma followed by **“lti”** (make sure that you include the
quotation marks).
#. At the bottom of the page, click **Save Changes**.
The page refreshes automatically. At the top of the page,
you see a notification that your changes have been saved.
==========================================
Step 2. Register the External LTI Provider
==========================================
To regiser the external LTI provider, you’ll add the LIT ID, the client
key, and the client secret in the **lti_passports** policy key.
#. On the **Advanced Settings** page, locate the **lti_passports**
policy key.
#. Under **Policy Value**, place your cursor between the brackets, and
then enter the LTI ID, client key, and client secret in the following
format (make sure to include the quotation marks and the colons).
::
“lti_id:client_key:client_secret”
For example, the value in the **lti_passports** field may be the following.
::
“test_lti_id:b289378-f88d-2929-ctools.umich.edu:secret”
If you have multiple LTI providers, separate the values with a comma.
Make sure to surround each entry with quotation marks.
::
"test_lti_id:b289378-f88d-2929-ctools.umich.edu:secret",
"id_21441:b289378-f88d-2929-ctools.school.edu:23746387264",
"book_lti_provider_from_new_york:b289378-f88d-2929-ctools.company.com:yt4984yr8"
#. At the bottom of the page, click **Save Changes**.
The page refreshes automatically. At the top of the page,
you see a notification that your changes have been saved, and you can
see your entries in the **lti_passports** policy key.
==========================================
Step 3. Add the LTI Component to a Unit
==========================================
#. In the unit where you want to create the problem, click **Advanced**
under **Add New Component**, and then click **LTI**.
#. In the component that appears, click **Edit**.
#. In the component editor, set the options that you want. See the table
below for a description of each option.
#. Click **Save**.
.. list-table::
:widths: 10 80
:header-rows: 1
* - `Setting`
- Description
* - `Display Name`
- Specifies the name of the problem. This name appears above the problem and in
the course ribbon at the top of the page in the courseware.
* - `custom_parameters`
- Enables you to add one or more custom parameters. For example, if you've added an
e-book, a custom parameter may include the page that your e-book should open to.
You could also use a custom parameter to set the background color of the LTI component.
Every custom parameter has a key and a value. You must add the key and value in the following format.
::
key=value
For example, a custom parameter may resemble the following.
::
bgcolor=red
page=144
To add a custom parameter, click **Add**.
* - `graded`
- Indicates whether the grade for the problem counts towards student's total grade. By
default, this value is set to **False**.
* - `has_score`
- Specifies whether the problem has a numerical score. By default, this value
is set to **False**.
* - `launch_url`
- Lists the URL that Studio sends to the external LTI provider so that the provider
can send back students' grades. This setting is only used if **graded** is set to
**True**.
* - `lti_id`
- Specifies the LTI ID for the external LTI provider. This value must be the same
LTI ID that you entered on the **Advanced Settings** page.
* - `open_in_a_new_page`
- Indicates whether the problem opens in a new page. If you set this value to **True**,
the student clicks a link that opens the LTI content in a new window. If you set
this value to **False**, the LTI content opens in an IFrame in the current page.
* - `weight`
- Specifies the number of points possible for the problem. By default, if an
external LTI provider grades the problem, the problem is worth 1 point, and
a student’s score can be any value between 0 and 1.
For more information about problem weights and computing point scores, see :ref:`Problem Weight`.
\ No newline at end of file
.. _Math Expression Input:
####################################
Math Expression Input Problems
####################################
In math expression input problems, students enter text that represents a mathematical expression into a field, and text is converted to a symbolic expression that appears below that field. 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.
.. image:: /Images/MathExpressionInputExample.png
:alt: Image of math expression input problem
For more information about characters that students can enter, see :ref:`Math Response Formatting for Students`.
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.
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`.
************************************************
Create a Math Expression Input Problem
************************************************
To create a math expression input problem:
#. In the unit where you want to create the problem, click **Problem**
under **Add New Component**, and then click the **Advanced** tab.
#. Click **Math Expression Input**.
#. In the component that appears, click **Edit**.
#. In the component editor, replace the example code with your own code. To practice, you may want to use the sample problem code below.
#. Click **Save**.
**Sample Problem Code**
.. code-block:: xml
<problem>
<p>Some problems may ask for a mathematical expression. Practice creating mathematical expressions by answering the questions below.</p>
<p>Write an expression for the product of R_1, R_2, and the inverse of R_3.</p>
<formularesponse type="ci" samples="R_1,R_2,R_3@1,2,3:3,4,5#10" answer="$VoVi">
<responseparam type="tolerance" default="0.00001"/>
<formulaequationinput size="40" label="Enter the equation"/>
</formularesponse>
<script type="loncapa/python">
VoVi = "(R_1*R_2)/R_3"
</script>
<p>Let <i>x</i> be a variable, and let <i>n</i> be an arbitrary constant. What is the derivative of <i>x<sup>n</sup></i>?</p>
<script type="loncapa/python">
derivative = "n*x^(n-1)"
</script>
<formularesponse type="ci" samples="x,n@1,2:3,4#10" answer="$derivative">
<responseparam type="tolerance" default="0.00001"/>
<formulaequationinput size="40" label="Enter the equation"/>
</formularesponse>
<solution>
<div class="detailed-solution">
<p>Explanation or Solution Header</p>
<p>Explanation or solution text</p>
</div>
</solution>
</problem>
.. _Math Expression Input Problem XML:
**********************************
Math Expression Input Problem XML
**********************************
============
Templates
============
.. code-block:: xml
<problem>
<p>Write an expression for the product of R_1, R_2, and the inverse of R_3.</p>
<formularesponse type="ci" samples="R_1,R_2,R_3@1,2,3:3,4,5#10" answer="R_1*R_2/R_3">
<responseparam type="tolerance" default="0.00001"/>
<formulaequationinput size="40" />
</formularesponse>
</problem>
.. code-block:: xml
<problem>
<p>Problem text</p>
<formularesponse type="ci" samples="VARIABLES@LOWER_BOUNDS:UPPER_BOUNDS#NUMBER_OF_SAMPLES" answer="$VoVi">
<responseparam type="tolerance" default="0.00001"/>
<formulaequationinput size="20" label="Enter the equation"/>
</formularesponse>
<script type="loncapa/python">
PYTHON SCRIPT
</script>
<solution>
<div class="detailed-solution">
<p>Explanation or Solution Header</p>
<p>Explanation or solution text</p>
</div>
</solution>
</problem>
====
Tags
====
* ``<formularesponse>``
* ``<formulaequationinput />``
* ``<responseparam>``
* ``<script>``
**Tag:** ``<formularesponse>``
Specifies that the problem is a math expression input problem. The ``<formularesponse>`` tag is similar to ``<numericalresponse>``, but ``<formularesponse>`` allows unknown variables.
Attributes
**type**: Can be "cs" (case sensitive, the default) or "ci" (case insensitive, so that capitalization doesn't matter in variable names).
**answer**: The correct answer to the problem, given as a mathematical expression. If you precede a variable name in the problem with a dollar sign ($), you can include a script in the problem that computes the expression in terms of that variable.
**samples**: Specifies important information about the problem in four lists:
* **variables**: A set of variables that students can enter.
* **lower_bounds**: For every defined variable, a lower bound on the numerical tests to use for that variable.
* **upper_bounds**: For every defined variable, an upper bound on the numerical tests to use for that variable.
* **num_samples**: The number of times to test the expression.
Commas separate items inside each of the four individual lists, and the at sign (@), colon (:), and pound sign (#) characters separate the four lists. The format is the following:
``"variables@lower_bounds:upper_bounds#num_samples``
For example, a ``<formularesponse>`` tag that includes the **samples** attribute may look like either of the following.
``<formularesponse samples="x,n@1,2:3,4#10">``
``<formularesponse samples="R_1,R_2,R_3@1,2,3:3,4,5#10">``
Children
* ``<formulaequationinput />``
**Tag:** ``<formulaequationinput />``
Creates a response field where a student types an answer to the problem in plain text, as well as a second field below the response field where the student sees a typeset version of the plain text. The parser that renders the student's plain text into typeset math is the same parser that evaluates the student's response for grading.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - size (optional)
- Specifies the width, in characters, of the response field where students enter answers.
Children
(none)
**Tag:** ``<responseparam>``
Used to define an upper bound on the variance of the numerical methods used to approximate a test for equality.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - default (required)
- A number or a percentage specifying how close the student and grader expressions must be. Failure to include a tolerance leaves expressions vulnerable to unavoidable rounding errors during sapling, causing some student input to be graded as incorrect, even if it is algebraically equivalent to the grader's expression.
* - type
- "tolerance"--defines a tolerance for a number
Children
(none)
.. _MathJax in Studio: .. _MathJax in Studio:
############################################
A Brief Introduction to MathJax in Studio A Brief Introduction to MathJax in Studio
========================================= ############################################
To write clear and professional-looking symbols and equations, we use a LaTeX-like To write clear and professional-looking symbols and equations, we use a LaTeX-like
language called language called
...@@ -36,17 +37,18 @@ You can use MathJax in HTML (text) components and in Problem components. ...@@ -36,17 +37,18 @@ You can use MathJax in HTML (text) components and in Problem components.
.. note:: Complete MathJax documentation (together with a testing tool) can be .. note:: Complete MathJax documentation (together with a testing tool) can be
found at `http://www.onemathematicalcat.org/MathJaxDocumentation/TeXSyntax.htm <http://www.google.com/url?q=http%3A%2F%2Fwww.onemathematicalcat.org%2FMathJaxDocumentation%2FTeXSyntax.htm&sa=D&sntz=1&usg=AFQjCNEV8PtCX6Csp0lW7lDKOLIKCOCkHg>`_. found at `http://www.onemathematicalcat.org/MathJaxDocumentation/TeXSyntax.htm <http://www.google.com/url?q=http%3A%2F%2Fwww.onemathematicalcat.org%2FMathJaxDocumentation%2FTeXSyntax.htm&sa=D&sntz=1&usg=AFQjCNEV8PtCX6Csp0lW7lDKOLIKCOCkHg>`_.
****************************
HTML (Text) Components HTML (Text) Components
---------------------- ****************************
In the HTML component editor, you can use MathJax both in Visual view and in HTML view. In the HTML component editor, you can use MathJax both in Visual view and in HTML view.
.. image:: ../Images/MathJax_HTML.png .. image:: /Images/MathJax_HTML.png
:alt: Image of an HTML component with MathJax in both the Visual and HTML views :alt: Image of an HTML component with MathJax in both the Visual and HTML views
*********************
Problem Components Problem Components
------------------ *********************
In the Problem component editor, you can use MathJax both in the Simple Editor In the Problem component editor, you can use MathJax both in the Simple Editor
and in the Advanced Editor. and in the Advanced Editor.
...@@ -56,5 +58,5 @@ explanation is enclosed in backslashes and parentheses, so it appears inline wit ...@@ -56,5 +58,5 @@ explanation is enclosed in backslashes and parentheses, so it appears inline wit
Navier-Stokes equation is enclosed in backslashes and brackets, so it appears on its Navier-Stokes equation is enclosed in backslashes and brackets, so it appears on its
own line. own line.
.. image:: ../Images/MathJax_Problem.png .. image:: /Images/MathJax_Problem.png
:alt: Image of a problem component with MathJax in both the Visual and HTML views :alt: Image of a problem component with MathJax in both the Visual and HTML views
\ No newline at end of file
.. _Molecule Editor:
#######################
Molecule Editor Tool
#######################
Students can use the molecule editor to learn how to create molecules. The molecule editor allows students to draw molecules that follow the rules for covalent bond formation and formal charge, even if the molecules are chemically impossible, are unstable, or do not exist in living systems. The molecule editor warns students if they try to submit a structure that is chemically impossible.
The molecule editor incorporates two tools: the JSME molecule editor created by Peter Erl and Bruno Bienfait, and JSmol, a JavaScript-based molecular viewer from Jmol. (You don't need to download either of these tools--Studio uses them automatically.) For more information about the JSME molecule editor, see `JSME Molecule Editor <http://peter-ertl.com/jsme/index.html>`_. For more information about JSmol, see `JSmol <http://sourceforge.net/projects/jsmol/>`_.
.. image:: /Images/Molecule_Editor.png
:alt: Image of the molecule editor
.. _Create the Molecule Editor:
******************************
Create the Molecule Editor
******************************
To create a molecule editor, you need the following files:
* MoleculeAnswer.png
* MoleculeEditor_HTML.png
* dopamine.mol
To download all of these files in a .zip archive, go to http://files.edx.org/MoleculeEditorFiles.zip.
.. note:: The molecule that appears when the tool starts is a dopamine molecule. To use a different molecule, download the .mol file for that molecule from the `list of molecules <http://www.biotopics.co.uk/jsmol/molecules/>`_ on the `BioTopics <http://www.biotopics.co.uk/>`_ website. Then, upload the .mol file to the **Files & Uploads** page for your course in Studio, and change "dopamine.mol" in the example code to the name of your .mol file.
To create the molecule editor that appears in the image above, you need an HTML component followed by a Problem component.
#. Upload all of the files listed above to the **Files & Uploads** page in your course.
#. Create the HTML component.
#. In the unit where you want to create the problem, click **HTML** under **Add New Component**, and then click **HTML**.
#. In the component that appears, click **Edit**.
#. In the component editor, paste the HTML component code from below.
#. Make any changes that you want, and then click **Save**.
3. Create the Problem component.
#. Under the HTML component, click **Problem** under **Add New Component**, and then click **Blank Advanced Problem**.
#. In the component that appears, click **Edit**.
#. In the component editor, paste the Problem component code from below.
#. Click **Save**.
.. _EMC Problem Code:
========================
Molecule Editor Code
========================
To create the molecule editor, you need an HTML component and a Problem component.
HTML Component Code
***************************
.. code-block:: xml
<h2>Molecule Editor</h2>
<p>The molecule editor makes creating and visualizing molecules easy. A chemistry professor may have you build and submit a molecule as part of an exercise.</p>
<div>
<script type="text/javascript">// <![CDATA[
function toggle2(showHideDiv, switchTextDiv) {
var ele = document.getElementById(showHideDiv);
var text = document.getElementById(switchTextDiv);
if(ele.style.display == "block") {
ele.style.display = "none";
text.innerHTML = "+ open";
}
else {
ele.style.display = "block";
text.innerHTML = "- close";
}
}
// ]]></script>
</div>
<div>
<style type="text/css"></style>
</div>
<div id="headerDiv">
<div id="titleText">Using the Molecule Editor<a id="myHeader" href="javascript:toggle2('myContent','myHeader');">+ open </a></div>
</div>
<div id="contentDiv">
<div id="myContent" style="display: none;">
<p>In this problem you will edit a molecule using the molecular drawing program shown below:</p>
<img alt="" src="/static/MoleculeEditor_HTML.png" /></div>
</div>
<p>&nbsp;</p>
<div id="headerDiv">
<div id="titleText">Are the molecules I've drawn chemically possible?<a id="IntroductionHeader" href="javascript:toggle2('IntroductionContent','IntroductionHeader');">+ open </a></div>
</div>
<div id="contentDiv">
<div id="IntroductionContent" style="display: none;">
<p>The chemical editor you are using ensures that the structures you draw are correct in one very narrow sense, that they follow the rules for covalent bond formation and formal charge. However, there are many structures that follow these rules that are chemically impossible, unstable, do not exist in living systems, or are beyond the scope of this course. The editor will let you draw them because, in contrast to the rules of formal charge, these properties cannot be easily and reliably predicted from structures.</p>
<p>If you submit a structure that includes atoms that are not possible or are beyond the scope of this course, the software will warn you specifically about these parts of your structure and you will be allowed to edit your structure and re-submit. Submitting an improper structure will not count as one of your tries. In general, you should try to use only the atoms most commonly cited in this course: C, H, N, O, P, and S. If you want to learn about formal charge, you can play around with other atoms and unusual configurations and look at the structures that result.</p>
</div>
</div>
<div id="ap_listener_added">&nbsp;</div>
Problem Component Code
***************************
.. code-block:: xml
<problem>
<p>The dopamine molecule, as shown, cannot make ionic bonds. Edit the dopamine molecule so it can make ionic bonds.</p>
<p>When you are ready, click Check. If you need to start over, click Reset.</p>
<script type="loncapa/python">
def check1(expect, ans):
import json
mol_info = json.loads(ans)["info"]
return any(res == "Can Make Ionic Bonds" for res in mol_info)
</script>
<customresponse cfn="check1">
<editamoleculeinput file="/static/dopamine.mol">
</editamoleculeinput>
</customresponse>
<solution>
<img src="/static/MoleculeAnswer.png"/>
</solution>
</problem>
**Problem 2**
::
<problem>
<p>The dopamine molecule, as shown, cannot make strong hydrogen bonds. Edit the dopamine molecule so that it can make strong hydrogen bonds.</p>
<script type="loncapa/python">
def grader_1(expect, ans):
import json
mol_info = json.loads(ans)["info"]
return any(res == "Cannot Make Strong Hydrogen Bonds" for res in mol_info)
</script>
<customresponse cfn="grader_1">
<editamoleculeinput file="/static/dopamine.mol">
</editamoleculeinput>
</customresponse>
</problem>
**Problem 3**
::
<problem>
<p>The dopamine molecule has an intermediate hydrophobicity. Edit the dopamine molecule so that it is more hydrophobic.</p>
<script type="loncapa/python">
def grader_2(expect, ans):
import json
mol_info = json.loads(ans)["info"]
hydrophobicity_index_str=mol_info[0]
hydrophobicity_index=float(hydrophobicity_index_str[23:])
return hydrophobicity_index &gt; .490
</script>
<customresponse cfn="grader_2">
<editamoleculeinput file="/static/dopamine.mol">
</editamoleculeinput>
</customresponse>
</problem>
\ No newline at end of file
.. _Multiple Choice and Numerical Input:
############################################
Multiple Choice and Numerical Input Problem
############################################
You can create a problem that combines a multiple choice and numerical input problems. Students not only select a response from options that you provide, but also provide more specific information, if necessary.
.. image:: /Images/MultipleChoice_NumericalInput.png
:alt: Image of a multiple choice and numerical input problem
.. note:: Currently, students can only enter numerals in the text field. Students cannot enter words or mathematical expressions.
.. _Create an MCNI Problem:
********************************************************
Create a Multiple Choice and Numerical Input Problem
********************************************************
To create a multiple choice and numerical input problem:
#. In the unit where you want to create the problem, click **Problem** under **Add New Component**, and then click the **Advanced** tab.
#. Click **Blank Advanced Problem**.
#. In the component that appears, click **Edit**.
#. In the component editor, paste the code from below.
#. Replace the example problem and response options with your own text.
#. Click **Save**.
.. _MCNI Problem Code:
************************************************
Multiple Choice and Numerical Input Problem Code
************************************************
.. code-block:: xml
<problem>
The numerical value of pi, rounded to two decimal points, is 3.24.
<choicetextresponse>
<radiotextgroup>
<choice correct="false">True.</choice>
<choice correct="true">False. The correct value is <numtolerance_input answer="3.14"/>.</choice>
</radiotextgroup>
</choicetextresponse>
</problem>
\ No newline at end of file
.. _Multiple Choice:
########################
Multiple Choice Problem
########################
In multiple choice problems, students select one option from a list of answer options. Unlike with dropdown problems, whose answer choices don't appear until the student clicks the drop-down arrow, answer choices for multiple choice problems are always visible directly below the question.
.. image:: /Images/MultipleChoiceExample.png
:alt: Image of a multiple choice problem
****************************************
Create a Multiple Choice Problem
****************************************
You can create multiple choice problems in the Simple Editor or in the Advanced Editor.
.. note:: All problems must include labels for accessibility. The label generally includes the text of the main question in your problem. To add a label for a common problem, surround the text of the label with angle brackets pointed toward the text (>>label text<<).
================
Simple Editor
================
#. Under **Add New Component**, click **Problem**.
#. In the **Select Problem Component Type** screen, click **Multiple
Choice** on the **Common Problem Types** tab.
#. When the new Problem component appears, click **Edit**.
#. In the component editor, replace the sample problem text with the text of your
problem. Enter each answer option on its own line.
#. Determine the text of the problem to use as a label, and then surround that text with two sets of angle brackets (>><<).
#. Select all the answer options, and then click the multiple choice button.
.. image:: /Images/ProbCompButton_MultChoice.png
:alt: Image of the multiple choice button
When you do this, the component editor adds a pair of parentheses next to each
possible answer.
#. Add an "x" between the parentheses next to the correct answer.
#. In the component editor, select the text of the explanation, and then click the
explanation button to add explanation tags around the text.
.. image:: /Images/ProbCompButton_Explanation.png
:alt: Image of the explanation button
#. On the **Settings** tab, specify the settings that you want.
#. Click **Save**.
For the example problem above, the text in the Problem component is the
following.
::
>>Lateral inhibition, as was first discovered in the horsehoe crab:<<
( ) is a property of touch sensation, referring to the ability of crabs to
detect nearby predators.
( ) is a property of hearing, referring to the ability of crabs to detect
low frequency noises.
(x) is a property of vision, referring to the ability of crabs eyes to
enhance contrasts.
( ) has to do with the ability of crabs to use sonar to detect fellow horseshoe
crabs nearby.
( ) has to do with a weighting system in the crabs skeleton that allows it to
balance in turbulent water.
[Explanation]
Horseshoe crabs were essential to the discovery of lateral inhibition, a property of
vision present in horseshoe crabs as well as humans, that enables enhancement of
contrast at edges of objects as was demonstrated in class. In 1967, Haldan Hartline
received the Nobel prize for his research on vision and in particular his research
investigating lateral inhibition using horseshoe crabs.
[Explanation]
================
Advanced Editor
================
To create this problem in the Advanced Editor, click the **Advanced** tab in the Problem component editor, and then replace the existing code with the following code.
.. code-block:: xml
<problem>
<p>Lateral inhibition, as was first discovered in the horsehoe crab...</p>
<multiplechoiceresponse>
<choicegroup type="MultipleChoice" label="Lateral inhibition, as was first discovered in the horsehoe crab">
<choice correct="false">is a property of touch sensation, referring to the ability of crabs to detect nearby predators.</choice>
<choice correct="false">is a property of hearing, referring to the ability of crabs to detect low frequency noises.</choice>
<choice correct="false">is a property of vision, referring to the ability of crabs eyes to enhance contrasts.</choice>
<choice correct="true">has to do with the ability of crabs to use sonar to detect fellow horseshoe crabs nearby.</choice>
<choice correct="false">has to do with a weighting system in the crabs skeleton that allows it to balance in turbulent water.</choice>
</choicegroup>
</multiplechoiceresponse>
<solution>
<div class="detailed-solution">
<p>Explanation</p>
<p>Horseshoe crabs were essential to the discovery of lateral inhibition, a property of vision present in horseshoe crabs as well as humans, that enables enhancement of contrast at edges of objects as was demonstrated in class. In 1967, Haldan Hartline received the Nobel prize for his research on vision and in particular his research investigating lateral inhibition using horseshoe crabs.</p>
</div>
</solution>
</problem>
.. _Multiple Choice Problem XML:
******************************
Multiple Choice Problem XML
******************************
================
Template
================
.. code-block:: xml
<problem>
<p>Question text</p>
<multiplechoiceresponse>
<choicegroup type="MultipleChoice" label="label text">
<choice correct="false" name="a">Incorrect choice</choice>
<choice correct="true" name="b">Correct choice</choice>
</choicegroup>
</multiplechoiceresponse>
<solution>
<div class="detailed-solution">
<p>Explanation or solution header</p>
<p>Explanation or solution text</p>
</div>
</solution>
</problem>
================
Tags
================
* ``<multiplechoiceresponse>`` (required): Indicates that the problem is a multiple choice problem.
* ``<choicegroup>`` (required): Indicates the beginning of the list of options.
* ``<choice>`` (required): Lists an answer option.
**Tag:** ``<multiplechoiceresponse>``
Indicates that the problem is a multiple choice problem.
Attributes
(none)
Children
* ``<choicegroup>``
* All standard HTML tags (can be used to format text)
**Tag:** ``<choicegroup>``
Indicates the beginning of the list of options.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - label (required)
- Specifies the name of the response field.
* - type (required)
- Must be set to "MultipleChoice".
Children
* ``<choice>``
**Tag:** ``<choice>``
Lists an answer option.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - correct (at least one required)
- Indicates a correct or incorrect answer. When the attribute is set to "true", the choice is a correct answer. When the attribute is set to "false", the choice is an incorrect answer. Only one choice can be a correct answer.
* - name
- A unique name that the back end uses to refer to the choice.
Children
(none)
\ No newline at end of file
.. _Numerical Input:
########################
Numerical Input
########################
Numerical input problems are the simpler of the two mathematics tools that Studio offers. In these problems, students enter numbers or specific and relatively simple mathematical expressions to answer a question. The text that the students enter is converted to a symbolic expression that appears below the response field.
.. image:: /Images/image292.png
:alt: Image of a numerical input problem
Note that students' responses don't have to be exact for these problems. You can specify a margin of error, or tolerance. You can also specify a correct answer explicitly, or use a Python script. For more information, see the instructions below.
Responses for numerical input problems can include integers, fractions,
and constants such as *pi* and *g*. Responses can also include text
representing common functions, such as square root (sqrt) and log base 2
(log2), as well as trigonometric functions and their inverses, such as
sine (sin) and arcsine (arcsin). For these functions, the
text that the student enters is converted into mathematical symbols. The following
example shows the way the system renders students' text responses in
numerical input problems.
.. image:: /Images/Math5.png
:alt: Image of a numerical input probem rendered by Studio
For more information about characters that students can enter, see :ref:`Math Response Formatting for Students`.
***********************************
Create a Numerical Input Problem
***********************************
You can create numerical problems in the Simple Editor or in the Advanced Editor regardless of the answer to the problem. If the text of your problem doesn't include any italics, bold formatting, or special characters, you can create the problem in the Simple Editor. If the text of your problem contains special formatting or characters, or if your problem contains a Python script, you'll use the Advanced Editor.
For example, the following example problems require the Advanced Editor.
.. image:: /Images/NumericalInput_Complex.png
:alt: Image of a more complex numerical input problem
For more information about including a Python script in your problem, see :ref:`Write Your Own Grader`.
.. note:: All problems must include labels for accessibility. The label generally includes the text of the main question in your problem. To add a label for a common problem, surround the text of the label with angle brackets pointed toward the text (>>label text<<).
==================
Simple Editor
==================
#. Under **Add New Component**, click **Problem**.
#. In the **Select Problem Component Type** screen, click **Numerical
Input** on the **Common Problem Types** tab.
3. When the new Problem component appears, click **Edit**.
#. In the component editor, replace the sample problem text with your own text.
#. Determine the text of the problem to use as a label, and then surround that text with two sets of angle brackets (>><<).
#. Select the text of the answer, and then click the numerical input button.
.. image:: /Images/ProbCompButton_NumInput.png
:alt: Image of the numerical input button
When you do this, an equal sign appears next to the answer.
7. (Optional) Specify a margin of error, or tolerance. You can specify a percentage, number, or range.
* To specify a percentage on either side of the correct answer, add **+-NUMBER%** after the answer. For example, if you want to include a 2% tolerance, add **+-2%**.
* To specify a number on either side of the correct answer, add **+-NUMBER** after the answer. For example, if you want to include a tolerance of 5, add **+-5**.
* To specify a range, use brackets [] or parentheses (). A bracket indicates that range includes the number next to it. A parenthesis indicates that the range does not include the number next to it. For example, if you specify **[5, 8)**, correct answers can be 5, 6, and 7, but not 8. Likewise, if you specify **(5, 8]**, correct answers can be 6, 7, and 8, but not 5.
8. In the component editor, select the text of the explanation, and then click the
explanation button to add explanation tags around the text.
.. image:: /Images/ProbCompButton_Explanation.png
:alt: Image of the explanation button
9. On the **Settings** tab, specify the settings that you want.
#. Click **Save**.
For the first example problem above, the text in the Problem component is the
following.
::
>>What base is the decimal numeral system in?<<
= 10
[explanation]
The decimal numerial system is base ten.
[explanation]
==================
Advanced Editor
==================
To create this problem in the Advanced Editor, click the **Advanced** tab in the Problem component editor, and then replace the existing code with the following code.
**Problem Code**:
.. code-block:: xml
<problem>
<p><b>Example Problem</b></p>
<p>What base is the decimal numeral system in?
<numericalresponse answer="10">
<formulaequationinput label="What base is the decimal numeral system in?"/>
</numericalresponse>
</p>
<p>What is the value of the standard gravity constant <i>g</i>, measured in m/s<sup>2</sup>? Give your answer to at least two decimal places.
<numericalresponse answer="9.80665">
<responseparam type="tolerance" default="0.01" />
<formulaequationinput label="Give your answer to at least two decimal places"/>
</numericalresponse>
</p>
<!-- The following uses Python script spacing. Make sure it isn't indented when you add it to the Problem component. -->
<script type="loncapa/python">
computed_response = math.sqrt(math.fsum([math.pow(math.pi,2), math.pow(math.e,2)]))
</script>
<p>What is the distance in the plane between the points (pi, 0) and (0, e)? You can type math.
<numericalresponse answer="$computed_response">
<responseparam type="tolerance" default="0.0001" />
<formulaequationinput label="What is the distance in the plane between the points (pi, 0) and (0, e)?"/>
</numericalresponse>
</p>
<solution>
<div class="detailed-solution">
<p>Explanation</p>
<p>The decimal numerical system is base ten.</p>
<p>The standard gravity constant is defined to be precisely 9.80665 m/s<sup>2</sup>.
This is 9.80 to two decimal places. Entering 9.8 also works.</p>
<p>By the distance formula, the distance between two points in the plane is
the square root of the sum of the squares of the differences of each coordinate.
Even though an exact numerical value is checked in this case, the
easiest way to enter this answer is to type
<code>sqrt(pi^2+e^2)</code> into the editor.
Other answers like <code>sqrt((pi-0)^2+(0-e)^2)</code> also work.
</p>
</div>
</solution>
</problem>
.. _Numerical Input Problem XML:
****************************
Numerical Input Problem XML
****************************
=========
Templates
=========
The following templates represent problems with and without a decimal or percentage tolerance.
Problem with no tolerance
***************************
.. code-block:: xml
<p>TEXT OF PROBLEM
<numericalresponse answer="ANSWER (NUMBER)">
<formulaequationinput label="TEXT OF PROBLEM"/>
</numericalresponse>
</p>
<solution>
<div class="detailed-solution">
<p>TEXT OF SOLUTION</p>
</div>
</solution>
</problem>
Problem with a decimal tolerance
************************************
.. code-block:: xml
<problem>
<p>TEXT OF PROBLEM
<numericalresponse answer="ANSWER (NUMBER)">
<responseparam type="tolerance" default="NUMBER (DECIMAL, e.g., .02)" />
<formulaequationinput label="TEXT OF PROBLEM"/>
</numericalresponse>
</p>
<solution>
<div class="detailed-solution">
<p>TEXT OF SOLUTION</p>
</div>
</solution>
</problem>
Problem with a percentage tolerance
************************************
.. code-block:: xml
<problem>
<p>TEXT OF PROBLEM
<numericalresponse answer="ANSWER (NUMBER)">
<responseparam type="tolerance" default="NUMBER (PERCENTAGE, e.g., 3%)" />
<formulaequationinput label="TEXT OF PROBLEM"/>
</numericalresponse>
</p>
<solution>
<div class="detailed-solution">
<p>TEXT OF SOLUTION</p>
</div>
</solution>
</problem>
Answer created with a script
************************************
.. code-block:: xml
<problem>
<!-- The following uses Python script spacing. Make sure it isn't indented when you add it to the Problem component. -->
<script type="loncapa/python">
computed_response = math.sqrt(math.fsum([math.pow(math.pi,2), math.pow(math.e,2)]))
</script>
<p>TEXT OF PROBLEM
<numericalresponse answer="$computed_response">
<responseparam type="tolerance" default="0.0001" />
<formulaequationinput label="TEXT OF PROBLEM"/>
</numericalresponse>
</p>
<solution>
<div class="detailed-solution">
<p>TEXT OF SOLUTION</p>
</div>
</solution>
</problem>
====
Tags
====
* ``<numericalresponse>`` (required): Specifies that the problem is a numerical input problem.
* ``<formulaequationinput />`` (required): Provides a response field where the student enters a response.
* ``<responseparam>`` (optional): Specifies a tolerance, or margin of error, for an answer.
* ``<script>`` (optional):
.. note:: Some older problems use the ``<textline math="1" />`` tag instead of the ``<formulaequationinput />`` tag. However, the ``<textline math="1" />`` tag has been deprecated. All new problems should use the ``<formulaequationinput />`` tag.
**Tag:** ``<numericalresponse>``
Specifies that the problem is a numerical input problem. The ``<numericalresponse>`` tag is similar to the ``<formularesponse>`` tag, but the ``<numericalresponse>`` tag does not allow unspecified variables.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - answer (required)
- The correct answer to the problem, given as a mathematical expression.
.. note:: If you include a variable name preceded with a dollar sign ($) in the problem, you can include a script in the problem that computes the expression in terms of that variable.
The grader evaluates the answer that you provide and the student's response in the same way. The grader also automatically simplifies any numeric expressions that you or a student provides. Answers can include simple expressions such as "0.3" and "42", or more complex expressions such as "1/3" and "sin(pi/5)".
Children
* ``<responseparam>``
* ``<formulaequationinput>``
**Tag:** * ``<formulaequationinput>``
Creates a response field in the LMS where students enter a response.
Attributes
.. list-table::
:widths: 20 80
* - size (optional)
- Defines the width, in characters, of the response field in the LMS.
Children
(none)
**Tag:** ``<responseparam>``
Specifies a tolerance, or margin of error, for an answer.
Attributes
.. list-table::
:widths: 20 80
* - type (optional)
- "tolerance": Defines a tolerance for a number
* - default (optional)
- A number or a percentage specifying a numerical or percent tolerance.
Children
(none)
**Tag:** ``<script>``
Specifies a script that the grader uses to evaluate a student's response. A problem behaves as if all of the code in all of the script tags were in a single script tag. Specifically, any variables that are used in multiple ``<script>`` tags share a namespace and can be overriden.
As with all Python, indentation matters, even though the code is embedded in XML.
Attributes
.. list-table::
:widths: 20 80
* - type (required)
- Must be set to "loncapa/python".
Children
(none)
.. _Open Response Assessment Problems: .. _Open Response Assessment:
#################################
Open Response Assessment Problems Open Response Assessment Problems
--------------------------------- #################################
Introduction to Open Response Assessments Introduction to Open Response Assessments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -12,16 +13,7 @@ Introduction to Open Response Assessments ...@@ -12,16 +13,7 @@ Introduction to Open Response Assessments
.. warning:: Problems can occur when you move your course from edge.edx.org to edx.org, or vice versa, if your course has the same URL in both places. To work around this problem, make sure that the URLs are different by specifying a different university or course number when you create each course. For example, if your university is edX and your course number is edX101, you can specify the course number as **edx_101** (note the underscore) on Edge and **edX101** on edX. .. warning:: Problems can occur when you move your course from edge.edx.org to edx.org, or vice versa, if your course has the same URL in both places. To work around this problem, make sure that the URLs are different by specifying a different university or course number when you create each course. For example, if your university is edX and your course number is edX101, you can specify the course number as **edx_101** (note the underscore) on Edge and **edX101** on edX.
Open response assessments allow instructors to assess student learning Open response assessments allow instructors to assess student learning through questions that may not have definite answers. Tens of thousands of students can receive feedback on written responses of varying lengths as well as files, such as computer code or images, that the students upload. Open response assessment technologies include self assessment and peer assessment. With self assessments, students learn by comparing their answers to a rubric that you create. With peer assessments, students compare their peers' answers to the rubric.
through questions that may not have definite answers. Tens of thousands
of students can receive feedback on written responses of varying lengths
as well as files, such as computer code or images, that the students
upload. Open response assessment technologies include self assessment,
peer assessment, and artificial intelligence (AI) assessment (sometimes
called "machine assessment" or "machine grading"). With self
assessments, students learn by comparing their answers to a rubric that
you create. With peer assessments, students compare their peers' answers
to the rubric.
For more information, see the following: For more information, see the following:
...@@ -72,14 +64,14 @@ An open response assessment has three elements: ...@@ -72,14 +64,14 @@ An open response assessment has three elements:
following example, the student performs a self assessment, then peers following example, the student performs a self assessment, then peers
perform peer assessments, and then an AI assessment runs. perform peer assessments, and then an AI assessment runs.
.. image:: ../Images/CITL_AssmtTypes.png .. image:: /Images/CITL_AssmtTypes.png
:alt: Image of ORA with assessment types circled :alt: Image of ORA with assessment types circled
- The question that you want your students to answer. This appears near - The question that you want your students to answer. This appears near
the top of the component, followed by a field where the student the top of the component, followed by a field where the student
enters a response. enters a response.
.. image:: ../Images/CITLsample.png .. image:: /Images/CITLsample.png
:alt: Image of ORA question :alt: Image of ORA question
- A rubric that you design. After the student enters a response and - A rubric that you design. After the student enters a response and
...@@ -89,7 +81,7 @@ An open response assessment has three elements: ...@@ -89,7 +81,7 @@ An open response assessment has three elements:
student sees a "Your response has been submitted" message but doesn't student sees a "Your response has been submitted" message but doesn't
see the rubric.) see the rubric.)
.. image:: ../Images/CITL_SA_Rubric.png .. image:: /Images/CITL_SA_Rubric.png
:alt: Image of ORA with rubric showing below the student's response :alt: Image of ORA with rubric showing below the student's response
.. _ORA Types: .. _ORA Types:
...@@ -188,7 +180,7 @@ Step 1. Create the ORA Component ...@@ -188,7 +180,7 @@ Step 1. Create the ORA Component
scoring. You'll replace this sample content with the content for your scoring. You'll replace this sample content with the content for your
problem. problem.
.. image:: ../Images/ORAComponentEditor.png .. image:: /Images/ORAComponentEditor.png
:alt: Image of component editor with prompt, rubric, and assessment type highlighted :alt: Image of component editor with prompt, rubric, and assessment type highlighted
.. _ORA Step 2: .. _ORA Step 2:
...@@ -198,7 +190,7 @@ Step 2. Add the Question ...@@ -198,7 +190,7 @@ Step 2. Add the Question
#. In the component editor, locate the [prompt] tags. #. In the component editor, locate the [prompt] tags.
.. image:: ../Images/ORA_Prompt.png .. image:: /Images/ORA_Prompt.png
:alt: Image of component editor with prompt text highlighted :alt: Image of component editor with prompt text highlighted
2. Replace the sample text between the **[prompt]** tags with the text of 2. Replace the sample text between the **[prompt]** tags with the text of
...@@ -220,7 +212,7 @@ Step 3. Add the Rubric ...@@ -220,7 +212,7 @@ Step 3. Add the Rubric
#. In the component editor, locate the [rubric] tags. (The sample rubric #. In the component editor, locate the [rubric] tags. (The sample rubric
is long, so you'll have to scroll down to locate the second tag.) is long, so you'll have to scroll down to locate the second tag.)
.. image:: ../Images/ORA_Rubric.png .. image:: /Images/ORA_Rubric.png
:alt: Image of component editor with rubric text highlighted :alt: Image of component editor with rubric text highlighted
2. Replace the sample rubric with the text of your rubric. Make sure to 2. Replace the sample rubric with the text of your rubric. Make sure to
...@@ -303,7 +295,7 @@ Set the Assessment Type and Scoring ...@@ -303,7 +295,7 @@ Set the Assessment Type and Scoring
#. In the component editor, locate the [tasks] tags. #. In the component editor, locate the [tasks] tags.
.. image:: ../Images/ORA_Tasks.png .. image:: /Images/ORA_Tasks.png
:alt: Image of component editor with tasks tags and text highlighted :alt: Image of component editor with tasks tags and text highlighted
#. Replace the sample code with the code for your problem. #. Replace the sample code with the code for your problem.
...@@ -326,7 +318,7 @@ The name of the problem appears as a heading above the problem in the ...@@ -326,7 +318,7 @@ The name of the problem appears as a heading above the problem in the
courseware. It also appears in the list of problems on the **Staff courseware. It also appears in the list of problems on the **Staff
Grading** page. Grading** page.
.. image:: ../Images/ORA_ProblemName1.png .. image:: /Images/ORA_ProblemName1.png
:alt: Image of Staff Grading page with a problem name circled :alt: Image of Staff Grading page with a problem name circled
To change the name: To change the name:
...@@ -347,7 +339,7 @@ responses a student has to peer grade and whether students can upload ...@@ -347,7 +339,7 @@ responses a student has to peer grade and whether students can upload
files as part of their response, click the **Settings** tab, and then files as part of their response, click the **Settings** tab, and then
specify the options that you want. specify the options that you want.
.. image:: ../Images/ORA_Settings.png .. image:: /Images/ORA_Settings.png
:alt: Image of component editor with Settings tab selected :alt: Image of component editor with Settings tab selected
Open response assessments include the following settings. Open response assessments include the following settings.
...@@ -454,7 +446,7 @@ Step 7. Save the Problem ...@@ -454,7 +446,7 @@ Step 7. Save the Problem
The component appears in Studio. In the upper right corner, you can The component appears in Studio. In the upper right corner, you can
see the type of assessments that you have set for this problem. see the type of assessments that you have set for this problem.
.. image:: ../Images/ORA_Component.png .. image:: /Images/ORA_Component.png
:alt: Image of ORA component with assessment types circled :alt: Image of ORA component with assessment types circled
.. _ORA Step 8: .. _ORA Step 8:
...@@ -490,7 +482,7 @@ the ORA problems for the course through this peer grading interface. ...@@ -490,7 +482,7 @@ the ORA problems for the course through this peer grading interface.
The **Peer Grading** page opens. The **Peer Grading** page opens.
.. image:: ../Images/PGI_Single.png .. image:: /Images/PGI_Single.png
:alt: Image of LMS open to the Peer Grading page for the course :alt: Image of LMS open to the Peer Grading page for the course
When students submit responses for peer assessments in your course, When students submit responses for peer assessments in your course,
...@@ -524,7 +516,7 @@ week). ...@@ -524,7 +516,7 @@ week).
to the right of the word **location**. Press CTRL+C to copy this to the right of the word **location**. Press CTRL+C to copy this
string, starting with **i4x**. string, starting with **i4x**.
.. image:: ../Images/PA_StaffDebug_Location.png .. image:: /Images/PA_StaffDebug_Location.png
:alt: Image of Staff Debug screen with ORA problem location circled :alt: Image of Staff Debug screen with ORA problem location circled
5. Switch back to the unit in Studio. If the visibility of the unit is 5. Switch back to the unit in Studio. If the visibility of the unit is
...@@ -537,7 +529,7 @@ week). ...@@ -537,7 +529,7 @@ week).
alphanumeric characters that you copied in step 4. Then, change the alphanumeric characters that you copied in step 4. Then, change the
**Show Single Problem** setting to **True**. **Show Single Problem** setting to **True**.
.. image:: ../Images/PGI_CompEditor_Settings.png .. image:: /Images/PGI_CompEditor_Settings.png
#. Click **Save** to close the component editor. #. Click **Save** to close the component editor.
...@@ -557,13 +549,13 @@ Test your problem by adding and grading a response. ...@@ -557,13 +549,13 @@ Test your problem by adding and grading a response.
3. In the LMS, locate your ORA question, and then type your response in 3. In the LMS, locate your ORA question, and then type your response in
the Response field under the question. the Response field under the question.
.. image:: ../Images/ThreeAssmts_NoResponse.png .. image:: /Images/ThreeAssmts_NoResponse.png
Note that when you view your ORA problem in the LMS as an instructor, Note that when you view your ORA problem in the LMS as an instructor,
you see the following message below the problem. This message never you see the following message below the problem. This message never
appears to students. appears to students.
.. image:: ../Images/ORA_DuplicateWarning.png .. image:: /Images/ORA_DuplicateWarning.png
4. Test the problem to make sure that it works as expected. 4. Test the problem to make sure that it works as expected.
...@@ -606,19 +598,19 @@ The Staff Grading Page ...@@ -606,19 +598,19 @@ The Staff Grading Page
When a response is available for you to grade, a yellow exclamation mark When a response is available for you to grade, a yellow exclamation mark
appears next to **Open Ended Panel** at the top of the screen. appears next to **Open Ended Panel** at the top of the screen.
.. image:: ../Images/OpenEndedPanel.png .. image:: /Images/OpenEndedPanel.png
To access the **Staff Grading** page, click **Open Ended Panel**. To access the **Staff Grading** page, click **Open Ended Panel**.
When the **Open Ended Console** page opens, click **Staff Grading**. When the **Open Ended Console** page opens, click **Staff Grading**.
Notice the **New submissions to grade** notification. Notice the **New submissions to grade** notification.
.. image:: ../Images/OpenEndedConsole_NewSubmissions.png .. image:: /Images/OpenEndedConsole_NewSubmissions.png
When the **Staff Grading** page opens, information about your open When the **Staff Grading** page opens, information about your open
response assessment appears in several columns. response assessment appears in several columns.
.. image:: ../Images/ProblemList-DemoCourse.png .. image:: /Images/ProblemList-DemoCourse.png
+----------------------------------------------------+--------------------------------------------------------------------+ +----------------------------------------------------+--------------------------------------------------------------------+
| **Problem Name** | The name of the problem. Click the name of the problem to open it. | | **Problem Name** | The name of the problem. Click the name of the problem to open it. |
...@@ -658,7 +650,7 @@ Grade Responses ...@@ -658,7 +650,7 @@ Grade Responses
is a calculation of the difference between the scores that AI is a calculation of the difference between the scores that AI
algorithm provides and the scores that the instructor provides. algorithm provides and the scores that the instructor provides.
.. image:: ../Images/ResponseToGrade.png .. image:: /Images/ResponseToGrade.png
3. In the rubric below the response, select the option that best 3. In the rubric below the response, select the option that best
describes the response. describes the response.
...@@ -673,7 +665,7 @@ Grade Responses ...@@ -673,7 +665,7 @@ Grade Responses
Flagged content is accessed on the **Staff Grading** page. If Flagged content is accessed on the **Staff Grading** page. If
necessary, course staff can ban a student from peer grading. necessary, course staff can ban a student from peer grading.
.. image:: ../Images/AdditionalFeedback.png .. image:: /Images/AdditionalFeedback.png
5. When you are done grading the response, click **Submit**. 5. When you are done grading the response, click **Submit**.
...@@ -681,12 +673,12 @@ When your course is running, another response opens automatically after ...@@ -681,12 +673,12 @@ When your course is running, another response opens automatically after
you grade the first response, and a message appears at the top of the you grade the first response, and a message appears at the top of the
page. page.
.. image:: ../Images/FetchingNextSubmission.png .. image:: /Images/FetchingNextSubmission.png
After you've graded all responses for this problem, **No more After you've graded all responses for this problem, **No more
submissions to grade** appears on the page. submissions to grade** appears on the page.
.. image:: ../Images/NoMoreSubmissions.png .. image:: /Images/NoMoreSubmissions.png
Click **Back to problem list** to return to the list of problems. You Click **Back to problem list** to return to the list of problems. You
can also wait for a few minutes and click **Re-check for submissions** can also wait for a few minutes and click **Re-check for submissions**
...@@ -754,12 +746,12 @@ You access your scores for your responses to AI and peer assessment problems thr ...@@ -754,12 +746,12 @@ You access your scores for your responses to AI and peer assessment problems thr
#. From any page in the LMS, click the **Open Ended Panel** tab at the #. From any page in the LMS, click the **Open Ended Panel** tab at the
top of the page. top of the page.
.. image:: ../Images/OpenEndedPanel.png .. image:: /Images/OpenEndedPanel.png
2. On the **Open Ended Console** page, click **Problems You Have 2. On the **Open Ended Console** page, click **Problems You Have
Submitted**. Submitted**.
.. image:: ../Images/ProblemsYouHaveSubmitted.png .. image:: /Images/ProblemsYouHaveSubmitted.png
3. On the **Open Ended Problems** page, check the **Status** column to 3. On the **Open Ended Problems** page, check the **Status** column to
see whether your responses have been graded. see whether your responses have been graded.
...@@ -774,11 +766,11 @@ graders. ...@@ -774,11 +766,11 @@ graders.
**Graded AI Assessment** **Graded AI Assessment**
.. image:: ../Images/AI_ScoredResponse.png .. image:: /Images/AI_ScoredResponse.png
**Graded Peer Assessment** **Graded Peer Assessment**
.. image:: ../Images/Peer_ScoredResponse.png .. image:: /Images/Peer_ScoredResponse.png
If you want to see the full rubric for either an AI or peer assessment, If you want to see the full rubric for either an AI or peer assessment,
click **Toggle Full Rubric**. click **Toggle Full Rubric**.
...@@ -787,4 +779,4 @@ click **Toggle Full Rubric**. ...@@ -787,4 +779,4 @@ click **Toggle Full Rubric**.
problems to see your score, you receive a message that lets you know how problems to see your score, you receive a message that lets you know how
many problems you still need to grade. many problems you still need to grade.
.. image:: ../Images/FeedbackNotAvailable.png .. image:: /Images/FeedbackNotAvailable.png
.. _Periodic Table:
#####################
Periodic Table Tool
#####################
You can create an interactive periodic table of the elements to help your students learn about various elements' properties. In the table below, detailed information about each element appears as the student moves the mouse over the element.
.. image:: /Images/Periodic_Table.png
:alt: Image of the interactive periodic table
.. _Create the Periodic Table:
******************************
Create the Periodic Table Tool
******************************
To create a periodic table, you need the following files:
* Periodic-Table.js
* Periodic-Table.css
* Periodic-Table-Colors.css
* PeriodicTableHTML.txt
To download all of these files in a .zip archive, click http://files.edx.org/PeriodicTableFiles.zip.
To create the periodic table, you need an HTML component.
#. Upload all of the files listed above *except PeriodicTable.txt* to the **Files & Uploads** page in your course.
#. In the unit where you want to create the problem, click **HTML** under **Add New Component**, and then click **HTML**.
#. In the component that appears, click **Edit**.
#. In the component editor, switch to the **HTML** tab.
#. Open the PeriodicTable.txt file in any text editor.
#. Copy all of the text in the PeriodicTable.txt file, and paste it into the HTML component editor. (Note that the PeriodicTableHTML.txt file contains over 6000 lines of code. Paste all of this code into the component editor.)
#. Click **Save**.
\ No newline at end of file
.. _Poll:
##########
Poll Tool
##########
You can run polls in your course so that your students can share opinions on different questions.
.. image:: /Images/PollExample.png
.. note:: Creating a poll requires you to export your course, edit some of your course's XML files in a text editor, and then re-import your course. We recommend that you create a backup copy of your course before you create the poll. We also recommend that you only edit the files that will contain polls in the text editor if you're very familiar with editing XML.
**************
Terminology
**************
Sections, subsections, units, and components have different names in the **Course Outline** view and in the list of files that you'll see after you export your course and open the .xml files for editing. The following table lists the names of these elements in the **Course Outline** view and in a list of files.
.. list-table::
:widths: 15 15
:header-rows: 0
* - Course Outline View
- File List
* - Section
- Chapter
* - Subsection
- Sequential
* - Unit
- Vertical
* - Component
- Discussion, HTML, problem, or video
For example, when you want to find a specific section in your course, you'll look in the **Chapter** folder when you open the list of files that your course contains. To find a unit, you'll look in the **Vertical** folder.
.. _Create a Poll:
**************
Create a Poll
**************
#. In the unit where you want to create the poll, create components that contain all the content that you want *except* for the poll. Make a note of the 32-digit unit ID that appears in the **Unit Identifier** field under **Unit Location**.
#. Export your course. For information about how to do this, see :ref:`Exporting and Importing a Course`. Save the .tar.gz file that contains your course in a memorable location so that you can find it easily.
#. Locate the .tar.gz file that contains your course, and then unpack the .tar.gz file so that you can see its contents in a list of folders and files.
- To do this on a Windows computer, you'll need to download a third-party program. For more information, see `How to Unpack a tar File in Windows <http://www.haskell.org/haskellwiki/How_to_unpack_a_tar_file_in_Windows>`_, `How to Extract a Gz File <http://www.wikihow.com/Extract-a-Gz-File>`_, `The gzip Home Page <http://www.gzip.org/>`_, or the `Windows <http://www.ofzenandcomputing.com/how-to-open-tar-gz-files/#windows>`_ section of the `How to Open .tar.gz Files <http://www.ofzenandcomputing.com/how-to-open-tar-gz-files/>`_ page.
- For information about how to do this on a Mac, see the `Mac OS X <http://www.ofzenandcomputing.com/how-to-open-tar-gz-files/#mac-os-x>`_ section of the `How to Open .tar.gz Files <http://www.ofzenandcomputing.com/how-to-open-tar-gz-files/>`_ page.
#. In the list of folders and files, open the **Vertical** folder.
.. note:: If your unit is not published, open the **Drafts** folder, and then open the **Vertical** folder in the **Drafts** folder.
#. In the **Vertical** folder, locate the .xml file that has the same name as the unit ID that you noted in step 1, and then open the file in a text editor such as Sublime 2. For example, if the unit ID is e461de7fe2b84ebeabe1a97683360d31, you'll open the e461de7fe2b84ebeabe1a97683360d31.xml file.
The file contains a list of all the components in the unit, together with the URL names of the components. For example, the following file contains an HTML component followed by a Discussion component.
.. code-block:: xml
<vertical display_name="Test Unit">
<html url_name="b59c54e2f6fc4cf69ba3a43c49097d0b"/>
<discussion url_name="8320c3d511484f3b96bdedfd4a44ac8b"/>
</vertical>
#. Add the following poll code in the location where you want the poll. Change the text of the prompt to the text that you want.
.. code-block:: xml
<poll_question display_name="Poll Question">
<p>Text of the prompt</p>
<answer id="yes">Yes</answer>
<answer id="no">No</answer>
</poll_question>
In the example above, if you wanted your poll to appear between the HTML component and the Discussion component in the unit, your code would resemble the following.
.. code-block:: xml
<vertical display_name="Test Unit">
<html url_name="b59c54e2f6fc4cf69ba3a43c49097d0b"/>
<poll_question display_name="Poll Question">
<p>Text of the prompt</p>
<answer id="yes">Yes</answer>
<answer id="no">No</answer>
</poll_question>
<discussion url_name="8320c3d511484f3b96bdedfd4a44ac8b"/>
</vertical>
#. After you add the poll code, save and close the .xml file.
#. Re-package your course as a .tar.gz file.
* For information about how to do this on a Mac, see `How to Create a Tar GZip File from the Command Line <http://osxdaily.com/2012/04/05/create-tar-gzip/>`_.
* For information about how to do this on a Windows computer, see `How to Make a .tar.gz on Windows <http://stackoverflow.com/questions/12774707/how-to-make-a-tar-gz-on-windows>`_.
#. In Studio, re-import your course. You can now review the poll question and answers that you added in Studio.
.. note::
* Although polls render correctly in Studio, you cannot edit them in Studio. You will need to follow the export/import process outlined above to make any edits to your polls.
* A .csv file that contains student responses to the problem is not currently available for polls. However, you can obtain the aggregate data directly in the problem.
*********************
Format description
*********************
The main tag of Poll module input is:
.. code-block:: xml
<poll_question> ... </poll_question>
``poll_question`` can include any number of the following tags:
any xml and ``answer`` tag. All inner xml, except for ``answer`` tags, we call "question".
==================
poll_question tag
==================
Xmodule for creating poll functionality - voting system. The following attributes can
be specified for this tag::
name - Name of xmodule.
[display_name| AUTOGENERATE] - Display name of xmodule. When this attribute is not defined - display name autogenerate with some hash.
[reset | False] - Can reset/revote many time (value = True/False)
============
answer tag
============
Define one of the possible answer for poll module. The following attributes can
be specified for this tag::
id - unique identifier (using to identify the different answers)
Inner text - Display text for answer choice.
***********
Example
***********
==================
Example of poll
==================
.. code-block:: xml
<poll_question name="second_question" display_name="Second question">
<h3>Age</h3>
<p>How old are you?</p>
<answer id="less18">&lt; 18</answer>
<answer id="10_25">from 10 to 25</answer>
<answer id="more25">&gt; 25</answer>
</poll_question>
================================================
Example of poll with unable reset functionality
================================================
.. code-block:: xml
<poll_question name="first_question_with_reset" display_name="First question with reset"
reset="True">
<h3>Your gender</h3>
<p>You are man or woman?</p>
<answer id="man">Man</answer>
<answer id="woman">Woman</answer>
</poll_question>
\ No newline at end of file
.. _Problem Written in LaTeX:
############################
Problem Written in LaTeX
############################
.. warning:: This problem type is still a prototype and may not be supported in the future. By default, the ability to create these problems is not enabled in Studio. You must change the advanced settings in your course before you can create problems with LaTeX. Use this problem type with caution.
If you have an problem that is already written in LaTeX, you can use this problem type to easily convert your code into XML. After you paste your code into the LaTeX editor, you'll only need to make a few minor adjustments.
.. note:: If you want to use LaTeX to typeset mathematical expressions
in problems that you haven't yet written, use any of the other problem
templates together with `MathJax <http://www.mathjax.org>`_. For more
information about how to create mathematical expressions in Studio using
MathJax, see *A Brief Introduction to MathJax in Studio*.
.. image:: /Images/ProblemWrittenInLaTeX.png
:alt: Image of a problem written in LaTeX
************************************
Create a Problem Written in LaTeX
************************************
To create a problem written in LaTeX:
#. Enable the policy key in your course.
#. In Studio, click **Settings**, and then click **Advanced Settings**.
#. On the **Advanced Settings** page, scroll down to the **use_latex_compiler** policy key.
#. In the **Policy Value** field next to the **use_latex_compiler** policy key, change **false** to **true**.
#. At the bottom of the page, click **Save Changes**.
#. In the unit where you want to create the problem, click **Problem**
under **Add New Component**, and then click the **Advanced** tab.
#. Click **Problem Written in LaTeX**.
#. In the component editor that appears, click **Edit**.
#. In the lower left corner of the component editor, click **Launch
LaTeX Source Compiler**.
#. Replace the example code with your own code. You can also upload a Latex file into the editor from your computer by clicking **Upload** in the bottom right corner.
#. In the lower left corner of the LaTeX source compiler, click **Save &
Compile to edX XML**.
\ No newline at end of file
.. _Problem with Adaptive Hint:
################################
Problem with Adaptive Hint
################################
A problem with an adaptive hint evaluates a student's response, then gives the student feedback or a hint based on that response so that the student is more likely to answer correctly on the next attempt. These problems can be text input problems.
.. image:: /Images/ProblemWithAdaptiveHintExample.png
:alt: Image of a problem with an adaptive hint
******************************************
Create a Problem with an Adaptive Hint
******************************************
To create a problem with an adaptive hint:
#. In the unit where you want to create the problem, click **Problem**
under **Add New Component**, and then click the **Advanced** tab.
#. Click **Problem with Adaptive Hint**.
#. In the component that appears, click **Edit**.
#. In the component editor, replace the example code with your own code.
#. Click **Save**.
\ No newline at end of file
.. _Protein Builder:
############################
Protex Protein Builder Tool
############################
The Protex protein builder asks students to create specified protein shapes by stringing together amino acids. In the example below, the goal protein shape is a simple line.
.. image:: /Images/ProteinBuilder.png
:alt: Image of the protein builder
.. _Create the Protein Builder:
********************************
Create the Protein Builder Tool
********************************
To create the protein builder:
#. Under **Add New Component**, click **Problem**, and then click **Blank Advanced Problem**.
#. In the component that appears, click **Edit**.
#. In the component editor, paste the Problem component code from below.
#. Make any changes that you want, and then click **Save**.
.. _Protein Builder Code:
*************************
Protein Builder Tool Code
*************************
.. code-block:: xml
<problem>
<p>The protein builder allows you string together the building blocks of proteins, amino acids, and see how that string will form into a structure. You are presented with a goal protein shape, and your task is to try to re-create it. In the example below, the shape that you are asked to form is a simple line.</p>
<p>Be sure to click "Fold" to fold your protein before you click "Check".</p>
<script type="loncapa/python">
def protex_grader(expect,ans):
import json
ans=json.loads(ans)
if "ERROR" in ans["protex_answer"]:
raise ValueError("Protex did not understand your answer. Try folding the protein.")
return ans["protex_answer"]=="CORRECT"
</script>
<text>
<customresponse cfn="protex_grader">
<designprotein2dinput width="855" height="500" target_shape="W;W;W;W;W;W;W"/>
</customresponse>
</text>
<solution>
<p>
Many protein sequences, such as the following example, fold to a straight line.You can play around with the protein builder if you're curious.
</p>
<ul>
<li>
Stick: RRRRRRR
</li>
</ul>
</solution>
</problem>
In this code:
* **width** and **height** specify the dimensions of the application, in pixels.
* **target_shape** lists the amino acids that, combined in the order specified, create the shape you've asked students to create. The list can only include the following letters, which correspond to the one-letter code for each amino acid. (This list appears in the upper-left corner of the protein builder.)
.. list-table::
:widths: 15 15 15 15
:header-rows: 0
* - A
- R
- N
- D
* - C
- Q
- E
- G
* - H
- I
- L
- K
* - M
- F
- P
- S
* - T
- W
- Y
- V
.. _Text Input:
########################
Text Input Problem
########################
In text input problems, students enter text into a response field. The response can include numbers, letters, and special characters such as punctuation marks. Because the text that the student enters must match the instructor's specified answer exactly, including spelling and punctuation, we recommend that you specify more than one attempt for text input problems to allow for typographical errors.
.. image:: /Images/TextInputExample.png
:alt: Image of a text input probem
****************************
Create a Text Input Problem
****************************
You can create multiple choice problems in the Simple Editor or in the Advanced Editor.
.. note:: All problems must include labels for accessibility. The label generally includes the text of the main question in your problem. To add a label for a common problem, surround the text of the label with angle brackets pointed toward the text (>>label text<<).
==============
Simple Editor
==============
To create a text input problem in the Simple Editor, follow these steps.
#. Under **Add New Component**, click **Problem**.
#. In the **Select Problem Component Type** screen, click **Text Input**
on the **Common Problem Types** tab.
#. In the new Problem component that appears, click **Edit**.
#. Replace the default text with the text for your problem.
#. Determine the text of the problem to use as a label, and then surround that text with two sets of angle brackets (>><<).
#. Select the text of the answer, and then click the text input button.
.. image:: /Images/ProbCompButton_TextInput.png
:alt: Image of the text input button
When you do this, an equal sign appears next to the answer.
#. In the component editor, select the text of the explanation, and then click the
explanation button to add explanation tags around the text.
.. image:: /Images/ProbCompButton_Explanation.png
:alt: Image of the explanation button
#. On the **Settings** tab, specify the settings that you want.
#. Click **Save**.
For the example problem above, the text in the Problem component is the
following.
::
>>What is the technical term that refers to the fact that, when enough people
sleep under a bednet, the disease may altogether disappear?<<
= herd immunity
[explanation]
The correct answer is herd immunity. As more and more people use bednets,
the risk of malaria begins to fall for everyone – users and non-users alike.
This can fall to such a low probability that malaria is effectively eradicated
from the group (even when the group does not have 100% bednet coverage).
[explanation]
=====================
Advanced Editor
=====================
To create this problem in the Advanced Editor, click the **Advanced** tab in the Problem component editor, and then replace the existing code with the following code.
.. code-block:: xml
<problem>
<p>
<em>This problem is adapted from an exercise that first appeared in MITx's 14.73x The Challenges of Global Poverty course, spring 2013.</em>
</p>
<p>What is the technical term that refers to the fact that, when enough people sleep under a bednet, the disease may altogether disappear?</p>
<stringresponse answer=".*herd immunity.*" type="ci regexp">
<additional_answer>community immunity</additional_answer>
<additional_answer>population immunity</additional_answer>
<textline size="20" label="What is the technical term that refers to the fact that, when enough people sleep under a bednet, the disease may altogether disappear?"/>
<hintgroup>
<stringhint answer="contact immunity" type="ci" name="contact_immunity_hint" />
<hintpart on="contact_immunity_hint">
<startouttext />
In contact immunity, a vaccinated individual passes along his immunity to another person through contact with feces or bodily fluids. The answer to the question above refers to the form of immunity that occurs when so many members of a population are protected, an infectious disease is unlikely to spread to the unprotected population.
<endouttext />
</hintpart >
<stringhint answer="firewall immunity" type="ci" name="firewall_immunity_hint" />
<hintpart on="firewall_immunity_hint">
<startouttext />
Although a firewall provides protection for a population, the term "firewall" is used more in computing and technology than in epidemiology.
<endouttext />
</hintpart >
</hintgroup>
</stringresponse>
<solution>
<div class="detailed-solution">
<p>Explanation</p>
<p>The correct answer is <b>herd immunity</b>. As more and more people use bednets, the risk of malaria begins to fall for everyone – users and non-users alike. This can fall to such a low probability that malaria is effectively eradicated from the group (even when the group does not have 100% bednet coverage).</p>
</div>
</solution>
</problem>
******************************************
Multiple Responses in Text Input Problems
******************************************
You can specify more than one correct response for text input problems.
For example, instead of requiring students to enter exactly "Dr. Martin Luther
King, Junior," you can allow answers of "Martin Luther King," "Doctor Martin
Luther King," and other variations. To do this, you can use the Simple Editor or the Advanced Editor.
==============
Simple Editor
==============
To specify additional correct responses in the Simple Editor, include "or=" (without the quotation marks) before each additional correct response.
::
>>What African-American led the United States civil rights movement during the 1960s?<<
= Dr. Martin Luther King, Jr.
or= Dr. Martin Luther King, Junior
or= Martin Luther King, Jr.
or= Martin Luther King
=====================
Advanced Editor
=====================
To specify additional correct responses in the Advanced Editor, add an ``<additional_answer>`` for each correct response inside the opening and closing ``<stringresponse>`` tags.
.. code-block:: xml
<problem>
<p>What African-American led the United States civil rights movement during the 1960s?</p>
<stringresponse answer="Dr. Martin Luther King, Jr." type="ci" >
<additional_answer>Dr. Martin Luther King, Junior</additional_answer>
<additional_answer>Martin Luther King, Jr.</additional_answer>
<additional_answer>Martin Luther King</additional_answer>
<textline label="What African-American led the United States civil rights movement during the 1960s?" size="20"/>
</stringresponse>
</problem>
******************************************
Case Sensitivity and Text Input Problems
******************************************
By default, text input problems do not require a case sensitive response. You can change this
and require a case sensitive answer.
To make a text input response case sensitive, you must use :ref:`Advanced Editor`.
In the Advanced Editor, you see that the **type** attribute of the **stringresponse**
element equals **ci**, for *case insensitive*. For example:
::
<stringresponse answer="Michigan" type="ci">
<textline size="20"/>
</stringresponse>
To make the response case sensitive, change the value of the **type** attribute to **cs**.
::
<stringresponse answer="Michigan" type="cs">
<textline size="20"/>
</stringresponse>
*************************************************
Response Field Length of Text Input Problems
*************************************************
By default, the response field for text input problems is 20 characters long.
You should preview the unit to ensure that the length of the response input field
accommodates the correct answer, and provides extra space for possible incorrect answers.
If the default response field length is not sufficient, you can change it using :ref:`Advanced Editor`.
In the advanced editor, in the XML block for the answer, you see that the **size** attribute of the **textline** element equals **20**:
::
<stringresponse answer="Democratic Republic of the Congo" type="ci">
<textline size="20"/>
</stringresponse>
To change the response field length, change the value of the **size** attribute:
::
<stringresponse answer="Democratic Republic of the Congo" type="ci">
<textline size="40"/>
</stringresponse>
********************************************************
Hints and Regular Expressions in Text Input Problems
********************************************************
You can provide hints that appear when students enter common incorrect answers in text input problems. You can also set a text input problem to allow a regular expression as an answer. To do this, you'll have to modify the problem's XML in the Advanced Editor.
The regular expression that the student enters must contain the part of the answer that the instructor specifies. For example, if an instructor has specified ``<answer=".*example answer.*" type="regexp">``, correct answers include ``example answered``, ``two example answers``, or even ``==example answer==``, but not ``examples`` or ``example anser``.
You can add ``regexp`` to the value of the ``type`` attribute, for example: ``type="ci regexp"`` or ``type="regexp"`` or ``type="regexp cs"``. In this case, any answer or hint are treated as regular expressions.
.. _Text Input Problem XML:
***********************
Text Input Problem XML
***********************
==============
Template
==============
.. code-block:: xml
<problem>
<p>Problem text</p>
<stringresponse answer="**.Correct answer 1.**" type="ci regexp">
<additional_answer>Correct answer 2</additional_answer>
<additional_answer>Correct answer 3</additional_answer>
<textline size="20" label="label text"/>
<hintgroup>
<stringhint answer="Incorrect answer A" type="ci" name="hintA" />
<hintpart on="hintA">
<startouttext />Text of hint for incorrect answer A<endouttext />
</hintpart >
<stringhint answer="Incorrect answer B" type="ci" name="hintB" />
<hintpart on="hintB">
<startouttext />Text of hint for incorrect answer B<endouttext />
</hintpart >
<stringhint answer="Incorrect answer C" type="ci" name="hintC" />
<hintpart on="hintC">
<startouttext />Text of hint for incorrect answer C<endouttext />
</hintpart >
</hintgroup>
</stringresponse>
<solution>
<div class="detailed-solution">
<p>Explanation or Solution Header</p>
<p>Explanation or solution text</p>
</div>
</solution>
</problem>
=======
Tags
=======
* ``<stringresponse>``: Indicates that the problem is a text input problem.
* ``<textline>``: Child of ``<stringresponse>``. Creates a response field in the LMS where the student enters a response.
* ``<additional_answer>`` (optional): Specifies an additional correct answer for the problem. A problem can contain an unlimited number of additional answers.
* ``<hintgroup>`` (optional): Indicates that the instructor has provided hints for certain common incorrect answers.
* ``<stringhint />`` (optional): Child of ``<hintgroup>``. Specifies the text of the incorrect answer to provide the hint for. Contains answer, type, name.
* ``<hintpart>``: Contains the name from ``<stringhint>``. Associates the incorrect answer with the hint text for that incorrect answer.
* ``<startouttext />``: Indicates the beginning of the text of the hint.
* ``<endouttext />``: Indicates the end of the text of the hint.
**Tag:** ``<stringresponse>``
Indicates that the problem is a text input problem.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - answer (required)
- Specifies the correct answer. To designate the answer as a regular expression, add "regexp" to the **type** attribute. If you do not add "regexp" to the **type** attribute, the student's answer must match the value in this attribute exactly.
* - type (optional)
- Can specify whether the problem is case sensitive and allows regular expressions. If the ``<stringresponse>`` tag includes ``type="ci"``, the problem is not case sensitive. If the tag includes ``type="cs"``, the problem is case sensitive. If the tag includes ``type="regexp"``, the problem allows regular expressions. A **type** attribute in a ``<stringresponse>`` tag can also combine these values. For example, ``<stringresponse type="regexp cs">`` specifies that the prolem allows regular expressions and is case sensitive.
Children
* ``<textline />`` (required)
* ``<additional_answer>`` (optional)
* ``<hintgroup>`` (optional)
**Tag:** ``<textline />``
Creates a response field in the LMS where the student enters a response.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - label (required)
- Contains the text of the problem.
* - size (optional)
- Specifies the size, in characters, of the response field in the LMS.
* - hidden (optional)
- If set to "true", students cannot see the response field.
* - correct_answer (optional)
- Lists the correct answer to the problem.
Children
(none)
**Tag:** ``<additional_answer>``
Specifies an additional correct answer for the problem. A problem can contain an unlimited number of additional answers.
Attributes
(none)
Children
(none)
**Tag:** ``<hintgroup>``
Indicates that the instructor has provided hints for certain common incorrect answers.
Attributes
(none)
Children
* ``<stringhint>`` (required)
**Tag:** ``<stringhint>``
Specifies a common incorrect answer to the problem.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - answer (required)
- The text of the incorrect answer.
* - name (required)
- The name of the hint that you want to provide.
* - type
- Specifies whether the text of the specified incorrect answer is case sensitive. Can be set to "cs" (case sensitive) or "ci" (case insensitive).
Children
* ``<hintpart>`` (required)
**Tag:** ``<hintpart>``
Associates a common incorrect answer with the hint for that incorrect answer.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - on
- The name of the hint. This must be the same as the **name** attribute of the ``<stringhint>`` tag. (The ``<stringhint>`` tag provides the name of the hint and the incorrect answer to associate with the hint. The ``<hintpart>`` tag contains the name of the hint and the text of the hint.)
Children
* ``<startouttext />`` (required)
* ``<endouttext />`` (required)
**Tags:** ``<startouttext />`` and ``<endouttext>``
Surround the text of the hint.
Attributes
(none)
Children
(none)
.. _Word Cloud:
##################
Word Cloud Tool
##################
In a word cloud tool, students enter words into a field in response
to a question or prompt. The words all the students have entered then
appear instantly as a colorful graphic, with the most popular responses
appearing largest. The graphic becomes larger as more students answer.
Students can both see the way their peers have answered and contribute
their thoughts to the group.
For example, the following word cloud was created from students'
responses to a question in a HarvardX course.
.. image:: /Images/WordCloudExample.png
:alt: Image of a word cloud problem
****************************
Create a Word Cloud Tool
****************************
To create a word cloud tool:
#. Add the Word Cloud advanced component.
#. On the **Settings** menu, click **Advanced Settings**.
#. On the **Advanced Settings** page, locate the **Manual Policy Definition** section, and then locate the **advanced_modules** policy key (this key is at the top of the list).
#. Under **Policy Value**, place your cursor between the brackets, and
then enter the following. Make sure to include the quotation marks.
``"word_cloud"``
#. At the bottom of the page, click **Save Changes**.
The page refreshes automatically. At the top of the page, you see a
notification that your changes have been saved.
#. Return to the unit where you want to add the specialized problem. The
list of possible components now contains an Advanced component.
#. In the unit where you want to create the problem, click **Advanced**
under **Add New Component**.
#. In the list of problem types, click **Word Cloud**.
#. In the component that appears, click **Edit**.
#. In the component editor, specify the settings that you want. You can
leave the default value for everything except **Display Name**.
- **Display Name**: The name that appears in the course ribbon and
as a heading above the problem.
- **Inputs**: The number of text boxes into which students can enter
words, phrases, or sentences.
- **Maximum Words**: The maximum number of words that the word cloud
displays. If students enter 300 different words but the maximum is
set to 250, only the 250 most commonly entered words appear in the
word cloud.
- **Show Percents**: The number of times that students have entered
a given word as a percentage of all words entered appears near
that word.
#. Click **Save**.
.. _Zooming Image:
##################
Zooming Image Tool
##################
You may want to present information to your students as an image. If your image is very large or very detailed, students may not be able to see all the information in the image. You can use the zooming image tool to enlarge areas of your image as the student moves the mouse over the image, as in the example below.
.. image:: /Images/Zooming_Image.png
:alt: Example zooming image tool showing a chemistry exercise
***********************************
Components of a Zooming Image Tool
***********************************
To create a zooming image tool, you need the following files.
* The image that you want students to see when they access the unit.
* The image that appears in the magnified area when a student clicks the regular image. This image may be larger than the regular image.
* The **jquery.loupeAndLightbox.js** JavaScript file. Every zooming image tool uses this JavaScript file, and you won't make any changes to it. `To download this file, right-click here <http://files.edx.org/jquery.loupeAndLightbox.js>`_, and then click **Save Link As** to save the file on your computer.
****************************
Create a Zooming Image Tool
****************************
#. Upload your regular-sized image file, your small image file, and the **jquery.loupeAndLightbox.js** file to the **Files & Uploads** page. For more information about how to do this, see :ref:`Add Files to a Course`.
#. Under **Add New Component**, click **html**, and then click **Zooming Image**.
#. In the new component that appears, click **Edit**.
#. In the component editor, replace the default problem text with your own text.
#. Switch to the **HTML** tab.
#. Replace the following placeholders with your own content.
- Replace the following file name and path with the name and path of the image that you want to appear magnified when the user hovers over the regular image.
**https://studio.edx.org/c4x/edX/DemoX/asset/pathways_detail_01.png**
For example, your file name and path may be **/static/Image1.jpg**.
- Replace the following file name and path with the name and path of the image that you want to appear when the page opens.
**https://studio.edx.org/c4x/edX/DemoX/asset/pathways_overview_01.png**
For example, your file name and path may be **/static/Image2.jpg**.
- Replace the following name and file path with the name and path of the JavaScript file for your course.
**https://studio.edx.org/c4x/edX/DemoX/asset/jquery.loupeAndLightbox.js**
Because you uploaded the **jquery.loupeAndLightbox.js** file to the **Files & Uploads** page, your file name and path is **/static/jquery.loupeAndLightbox.js**.
- (Optional) If you want the magnified area to be larger or smaller, change the **width** and **height** values from 350 to larger or smaller numbers. For example, you can change both numbers to 450. Or, if you want a horizontal oval instead of a circle, you can change the **width** value to a number such as 500 and the **height** value to a number such as 150.
The HTML in your zooming image tool may resemble the following.
.. image:: /Images/ZoomingImage_Modified.png
:alt: Example HTML for a zooming image tool
#. Click **Save** to save the HTML component.
...@@ -135,7 +135,7 @@ C ...@@ -135,7 +135,7 @@ C
**Custom Response Problem** **Custom Response Problem**
A custom response problem evaluates text responses from students using an embedded Python script. These problems are also called "write-your-own-grader" problems. For more information, see :ref:`Custom Python Evaluated Input` Custom Python-evaluated input (also called "write-your-own-grader" problems evaluate students'. A custom response problem evaluates text responses from students using an embedded Python script. These problems are also called "write-your-own-grader" problems. For more information, see :ref:`Write Your Own Grader`.
.. _D: .. _D:
...@@ -324,7 +324,7 @@ M ...@@ -324,7 +324,7 @@ M
A problem that requires students to enter a mathematical expression as text, such as e=m*c^2. A problem that requires students to enter a mathematical expression as text, such as e=m*c^2.
See :ref:`Math Expression Syntax` for more information. See :ref:`Math Response Formatting for Students` for more information.
.. _MathJax: .. _MathJax:
...@@ -462,7 +462,7 @@ S ...@@ -462,7 +462,7 @@ S
**Simple Editor** **Simple Editor**
The graphical user interface in a Problem component that contains formatting buttons and is available for some problem types. For more information, see :ref:`Studio UI`. The graphical user interface in a Problem component that contains formatting buttons and is available for some problem types. For more information, see :ref:`Problem Studio View`.
......
...@@ -16,7 +16,7 @@ Building and Running an edX Course ...@@ -16,7 +16,7 @@ Building and Running an edX Course
getting_started/index getting_started/index
building_course/index building_course/index
creating_content/index creating_content/index
problems_tools/index exercises_tools/index
releasing_course/index releasing_course/index
running_course/index running_course/index
students/index students/index
\ No newline at end of file
.. _Additional Tools:
#############################
Additional Tools
#############################
*************************
Additional Tools Overview
*************************
Individual course teams frequently create tools and problem types that don't have templates in Studio. We want to make these tools available to all our course teams.
Below, we provide you with all the files and code that you need to create the following tools and problem types.
* :ref:`Chemical Equation`
* :ref:`Conditional Module`
* :ref:`Gene Explorer`
* :ref:`Interactive Periodic Table`
* :ref:`Molecule Editor`
* :ref:`Multiple Choice and Numerical Input`
* :ref:`Polls`
* :ref:`Protein Builder`
.. _Chemical Equation:
**************************
Chemical Equation Problem
**************************
The chemical equation problem type allows the student to enter text that represents a chemical equation into a text box. The LMS converts that text into a chemical equation below the text box. The grader evaluates the student's response by using a Python script that you create and embed in the problem.
.. image:: ../Images/ChemicalEquationExample.png
:alt: Image of a chemical equation response problem
====================================
Create the Chemical Equation Problem
====================================
Chemical equation problems use MathJax to create formulas. For more information about using MathJax in Studio, see :ref:`MathJax in Studio`.
To create the above chemical equation problem:
#. In the unit where you want to create the problem, click **Problem** under **Add New Component**, and then click the **Advanced** tab.
#. Click **Blank Advanced Problem**.
#. In the component that appears, click **Edit**.
#. In the component editor, paste the code from below.
#. Click **Save**.
Sample Chemical Equation Problem Code
-------------------------------------
.. 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>
\( \text{H}_2\text{SO}_4 \longrightarrow \text { H}^+ + \text{ HSO}_4^-\)
<customresponse>
<chemicalequationinput size="50" label="Enter the chemical equation"/>
<answer type="loncapa/python">
if chemcalc.chemical_equations_equal(submission[0], 'H2SO4 -> H^+ + HSO4^-'):
correct = ['correct']
else:
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>
.. _Conditional Module:
******************
Conditional Module
******************
==================
Format description
==================
The main tag of Conditional module input is:
.. code-block:: xml
<conditional> ... </conditional>
``conditional`` can include any number of any xmodule tags (``html``, ``video``, ``poll``, etc.) or ``show`` tags.
conditional tag
---------------
The main container for a single instance of Conditional module. The following attributes can
be specified for this tag::
sources - location id of required modules, separated by ';'
[message | ""] - message for case, where one or more are not passed. Here you can use variable {link}, which generate link to required module.
[submitted] - map to `is_submitted` module method.
(pressing RESET button makes this function to return False.)
[correct] - map to `is_correct` module method
[attempted] - map to `is_attempted` module method
[poll_answer] - map to `poll_answer` module attribute
[voted] - map to `voted` module attribute
show tag
--------
Symlink to some set of xmodules. The following attributes can
be specified for this tag::
sources - location id of modules, separated by ';'
=======
Example
=======
Examples of conditional depends on poll
-------------------------------------------
.. code-block:: xml
<conditional sources="i4x://MITx/0.000x/poll_question/first_real_poll_seq_with_reset" poll_answer="man"
message="{link} must be answered for this to become visible.">
<html>
<h2>You see this, cause your vote value for "First question" was "man"</h2>
</html>
</conditional>
Examples of conditional depends on poll (use <show> tag)
--------------------------------------------------------
.. code-block:: xml
<conditional sources="i4x://MITx/0.000x/poll_question/first_real_poll_seq_with_reset" poll_answer="man"
message="{link} must be answered for this to become visible.">
<html>
<show sources="i4x://MITx/0.000x/problem/test_1; i4x://MITx/0.000x/Video/Avi_resources; i4x://MITx/0.000x/problem/test_1"/>
</html>
</conditional>
Examples of conditional depends on problem
-------------------------------------------
.. code-block:: xml
<conditional sources="i4x://MITx/0.000x/problem/Conditional:lec27_Q1" attempted="True">
<html display_name="HTML for attempted problem">You see this, cause "lec27_Q1" is attempted.</html>
</conditional>
<conditional sources="i4x://MITx/0.000x/problem/Conditional:lec27_Q1" attempted="False">
<html display_name="HTML for not attempted problem">You see this, cause "lec27_Q1" is not attempted.</html>
</conditional>
.. _Gene Explorer:
**************************
Gene Explorer
**************************
The Gene Explorer (GeneX), from the biology department at `UMB <http://www.umb.edu/>`_, simulates the transcription, splicing, processing, and translation of a small hypothetical eukaryotic gene. GeneX allows students to make specific mutations in a gene sequence, and it then calculates and displays the effects of the mutations on the mRNA and protein.
Specifically, the Gene Explorer does the following:
#. Finds the promoter and terminator
#. Reads the DNA sequence to produce the pre-mRNA
#. Finds the splice sites
#. Splices and tails the mRNA
#. Finds the start codon
#. Translates the mRNA
.. image:: ../Images/GeneExplorer.png
:alt: Image of the Gene Explorer
For more information about the Gene Explorer, see `The Gene Explorer <http://intro.bio.umb.edu/GX/>`_.
=====================
Gene Explorer Code
=====================
::
<problem>
<p>Make a single base pair substitution mutation in the gene below that results in a protein that is longer than the protein produced by the original gene. When you are satisfied with your change and its effect, click the <b>SUBMIT</b> button.</p>
<p>Note that a "single base pair substitution mutation" is when a single base is changed to another base; for example, changing the A at position 80 to a T. Deletions and insertions are not allowed.</p>
<script type="loncapa/python">
def genex_grader(expect,ans):
if ans=="CORRECT": return True
import json
ans=json.loads(ans)
return ans["genex_answer"]=="CORRECT"
</script>
<customresponse cfn="genex_grader">
<editageneinput width="818" height="1000" dna_sequence="TAAGGCTATAACCGAGATTGATGCCTTGTGCGATAAGGTGTGTCCCCCCCCAAAGTGTCGGATGTCGAGTGCGCGTGCAAAAAAAAACAAAGGCGAGGACCTTAAGAAGGTGTGAGGGGGCGCTCGAT" genex_dna_sequence="TAAGGCTATAACCGAGATTGATGCCTTGTGCGATAAGGTGTGTCCCCCCCCAAAGTGTCGGATGTCGAGTGCGCGTGCAAAAAAAAACAAAGGCGAGGACCTTAAGAAGGTGTGAGGGGGCGCTCGAT" genex_problem_number="2"/>
</customresponse>
</problem>
In this code:
* **width** and **height** specify the dimensions of the application, in pixels.
* **genex_dna_sequence** is the default DNA sequence that appears when the problem opens.
* **dna_sequence** contains the application's state and the student's answer. This value must be the same as **genex_dna_sequence**.
* **genex_problem_number** specifies the number of the problem. This number is based on the five gene editor problems in the MITx 7.00x course--for example, if you want this problem to look like the second gene editor problem in the 7.00x course, you would set the **genex_problem_number** value to 2. The number must be 1, 2, 3, 4, or 5.
.. _Interactive Periodic Table:
**************************
Interactive Periodic Table
**************************
You can create an interactive periodic table of the elements to help your students learn about various elements' properties. In the table below, detailed information about each element appears as the student moves the mouse over the element.
.. image:: ../Images/Periodic_Table.png
:alt: Image of the interactive periodic table
.. _Create the Periodic Table:
==========================
Create the Periodic Table
==========================
To create a periodic table, you need the following files:
* Periodic-Table.js
* Periodic-Table.css
* Periodic-Table-Colors.css
* PeriodicTableHTML.txt
To download all of these files in a .zip archive, click http://files.edx.org/PeriodicTableFiles.zip.
To create the periodic table, you need an HTML component.
#. Upload all of the files listed above *except PeriodicTable.txt* to the **Files & Uploads** page in your course.
#. In the unit where you want to create the problem, click **HTML** under **Add New Component**, and then click **HTML**.
#. In the component that appears, click **Edit**.
#. In the component editor, switch to the **HTML** tab.
#. Open the PeriodicTable.txt file in any text editor.
#. Copy all of the text in the PeriodicTable.txt file, and paste it into the HTML component editor. (Note that the PeriodicTableHTML.txt file contains over 6000 lines of code. Paste all of this code into the component editor.)
#. Click **Save**.
.. _Molecule Editor:
************************
Molecule Editor
************************
Students can use the molecule editor to learn how to create molecules. The molecule editor allows students to draw molecules that follow the rules for covalent bond formation and formal charge, even if the molecules are chemically impossible, are unstable, or do not exist in living systems. The molecule editor warns students if they try to submit a structure that is chemically impossible.
The molecule editor incorporates two tools: the JSME molecule editor created by Peter Erl and Bruno Bienfait, and JSmol, a JavaScript-based molecular viewer from Jmol. (You don't need to download either of these tools--Studio uses them automatically.) For more information about the JSME molecule editor, see `JSME Molecule Editor <http://peter-ertl.com/jsme/index.html>`_. For more information about JSmol, see `JSmol <http://sourceforge.net/projects/jsmol/>`_.
.. image:: ../Images/Molecule_Editor.png
:alt: Image of the molecule editor
.. _Create the Molecule Editor:
==========================
Create the Molecule Editor
==========================
To create a molecule editor, you need the following files:
* MoleculeAnswer.png
* MoleculeEditor_HTML.png
* dopamine.mol
To download all of these files in a .zip archive, go to http://files.edx.org/MoleculeEditorFiles.zip.
.. note:: The molecule that appears when the tool starts is a dopamine molecule. To use a different molecule, download the .mol file for that molecule from the `list of molecules <http://www.biotopics.co.uk/jsmol/molecules/>`_ on the `BioTopics <http://www.biotopics.co.uk/>`_ website. Then, upload the .mol file to the **Files & Uploads** page for your course in Studio, and change "dopamine.mol" in the example code to the name of your .mol file.
To create the molecule editor that appears in the image above, you need an HTML component followed by a Problem component.
#. Upload all of the files listed above to the **Files & Uploads** page in your course.
#. Create the HTML component.
#. In the unit where you want to create the problem, click **HTML** under **Add New Component**, and then click **HTML**.
#. In the component that appears, click **Edit**.
#. In the component editor, paste the HTML component code from below.
#. Make any changes that you want, and then click **Save**.
3. Create the Problem component.
#. Under the HTML component, click **Problem** under **Add New Component**, and then click **Blank Advanced Problem**.
#. In the component that appears, click **Edit**.
#. In the component editor, paste the Problem component code from below.
#. Click **Save**.
.. _EMC Problem Code:
=====================
Molecule Editor Code
=====================
To create the molecule editor, you need an HTML component and a Problem component.
HTML Component Code
-------------------
.. code-block:: xml
<h2>Molecule Editor</h2>
<p>The molecule editor makes creating and visualizing molecules easy. A chemistry professor may have you build and submit a molecule as part of an exercise.</p>
<div>
<script type="text/javascript">// <![CDATA[
function toggle2(showHideDiv, switchTextDiv) {
var ele = document.getElementById(showHideDiv);
var text = document.getElementById(switchTextDiv);
if(ele.style.display == "block") {
ele.style.display = "none";
text.innerHTML = "+ open";
}
else {
ele.style.display = "block";
text.innerHTML = "- close";
}
}
// ]]></script>
</div>
<div>
<style type="text/css"></style>
</div>
<div id="headerDiv">
<div id="titleText">Using the Molecule Editor<a id="myHeader" href="javascript:toggle2('myContent','myHeader');">+ open </a></div>
</div>
<div id="contentDiv">
<div id="myContent" style="display: none;">
<p>In this problem you will edit a molecule using the molecular drawing program shown below:</p>
<img alt="" src="/static/MoleculeEditor_HTML.png" /></div>
</div>
<p>&nbsp;</p>
<div id="headerDiv">
<div id="titleText">Are the molecules I've drawn chemically possible?<a id="IntroductionHeader" href="javascript:toggle2('IntroductionContent','IntroductionHeader');">+ open </a></div>
</div>
<div id="contentDiv">
<div id="IntroductionContent" style="display: none;">
<p>The chemical editor you are using ensures that the structures you draw are correct in one very narrow sense, that they follow the rules for covalent bond formation and formal charge. However, there are many structures that follow these rules that are chemically impossible, unstable, do not exist in living systems, or are beyond the scope of this course. The editor will let you draw them because, in contrast to the rules of formal charge, these properties cannot be easily and reliably predicted from structures.</p>
<p>If you submit a structure that includes atoms that are not possible or are beyond the scope of this course, the software will warn you specifically about these parts of your structure and you will be allowed to edit your structure and re-submit. Submitting an improper structure will not count as one of your tries. In general, you should try to use only the atoms most commonly cited in this course: C, H, N, O, P, and S. If you want to learn about formal charge, you can play around with other atoms and unusual configurations and look at the structures that result.</p>
</div>
</div>
<div id="ap_listener_added">&nbsp;</div>
Problem Component Code
----------------------
.. code-block:: xml
<problem>
<p>The dopamine molecule, as shown, cannot make ionic bonds. Edit the dopamine molecule so it can make ionic bonds.</p>
<p>When you are ready, click Check. If you need to start over, click Reset.</p>
<script type="loncapa/python">
def check1(expect, ans):
import json
mol_info = json.loads(ans)["info"]
return any(res == "Can Make Ionic Bonds" for res in mol_info)
</script>
<customresponse cfn="check1">
<editamoleculeinput file="/static/dopamine.mol">
</editamoleculeinput>
</customresponse>
<solution>
<img src="/static/MoleculeAnswer.png"/>
</solution>
</problem>
**Problem 2**
::
<problem>
<p>The dopamine molecule, as shown, cannot make strong hydrogen bonds. Edit the dopamine molecule so that it can make strong hydrogen bonds.</p>
<script type="loncapa/python">
def grader_1(expect, ans):
import json
mol_info = json.loads(ans)["info"]
return any(res == "Cannot Make Strong Hydrogen Bonds" for res in mol_info)
</script>
<customresponse cfn="grader_1">
<editamoleculeinput file="/static/dopamine.mol">
</editamoleculeinput>
</customresponse>
</problem>
**Problem 3**
::
<problem>
<p>The dopamine molecule has an intermediate hydrophobicity. Edit the dopamine molecule so that it is more hydrophobic.</p>
<script type="loncapa/python">
def grader_2(expect, ans):
import json
mol_info = json.loads(ans)["info"]
hydrophobicity_index_str=mol_info[0]
hydrophobicity_index=float(hydrophobicity_index_str[23:])
return hydrophobicity_index &gt; .490
</script>
<customresponse cfn="grader_2">
<editamoleculeinput file="/static/dopamine.mol">
</editamoleculeinput>
</customresponse>
</problem>
.. _Multiple Choice and Numerical Input:
*******************************************
Multiple Choice and Numerical Input Problem
*******************************************
You can create a problem that combines a multiple choice and numerical input problems. Students not only select a response from options that you provide, but also provide more specific information, if necessary.
.. image:: ../Images/MultipleChoice_NumericalInput.png
:alt: Image of a multiple choice and numerical input problem
.. note:: Currently, students can only enter numerals in the text field. Students cannot enter words or mathematical expressions.
.. _Create an MCNA Problem:
====================================================
Create a Multiple Choice and Numerical Input Problem
====================================================
To create a multiple choice and numerical input problem:
#. In the unit where you want to create the problem, click **Problem** under **Add New Component**, and then click the **Advanced** tab.
#. Click **Blank Advanced Problem**.
#. In the component that appears, click **Edit**.
#. In the component editor, paste the code from below.
#. Replace the example problem and response options with your own text.
#. Click **Save**.
.. _MCNA Problem Code:
===================================================
Multiple Choice and Numerical Input Problem Code
===================================================
.. code-block:: xml
<problem>
The numerical value of pi, rounded to two decimal points, is 3.24.
<choicetextresponse>
<radiotextgroup>
<choice correct="false">True.</choice>
<choice correct="true">False. The correct value is <numtolerance_input answer="3.14"/>.</choice>
</radiotextgroup>
</choicetextresponse>
</problem>
.. _Polls:
******
Polls
******
You can run polls in your course so that your students can share opinions on different questions.
.. image:: ../Images/PollExample.png
.. note:: Creating a poll requires you to export your course, edit some of your course's XML files in a text editor, and then re-import your course. We recommend that you create a backup copy of your course before you create the poll. We also recommend that you only edit the files that will contain polls in the text editor if you're very familiar with editing XML.
===========
Terminology
===========
Sections, subsections, units, and components have different names in the **Course Outline** view and in the list of files that you'll see after you export your course and open the .xml files for editing. The following table lists the names of these elements in the **Course Outline** view and in a list of files.
.. list-table::
:widths: 15 15
:header-rows: 0
* - Course Outline View
- File List
* - Section
- Chapter
* - Subsection
- Sequential
* - Unit
- Vertical
* - Component
- Discussion, HTML, problem, or video
For example, when you want to find a specific section in your course, you'll look in the **Chapter** folder when you open the list of files that your course contains. To find a unit, you'll look in the **Vertical** folder.
.. _Create a Poll:
=============
Create a Poll
=============
#. In the unit where you want to create the poll, create components that contain all the content that you want *except* for the poll. Make a note of the 32-digit unit ID that appears in the **Unit Identifier** field under **Unit Location**.
#. Export your course. For information about how to do this, see :ref:`Exporting and Importing a Course`. Save the .tar.gz file that contains your course in a memorable location so that you can find it easily.
#. Locate the .tar.gz file that contains your course, and then unpack the .tar.gz file so that you can see its contents in a list of folders and files.
- To do this on a Windows computer, you'll need to download a third-party program. For more information, see `How to Unpack a tar File in Windows <http://www.haskell.org/haskellwiki/How_to_unpack_a_tar_file_in_Windows>`_, `How to Extract a Gz File <http://www.wikihow.com/Extract-a-Gz-File>`_, `The gzip Home Page <http://www.gzip.org/>`_, or the `Windows <http://www.ofzenandcomputing.com/how-to-open-tar-gz-files/#windows>`_ section of the `How to Open .tar.gz Files <http://www.ofzenandcomputing.com/how-to-open-tar-gz-files/>`_ page.
- For information about how to do this on a Mac, see the `Mac OS X <http://www.ofzenandcomputing.com/how-to-open-tar-gz-files/#mac-os-x>`_ section of the `How to Open .tar.gz Files <http://www.ofzenandcomputing.com/how-to-open-tar-gz-files/>`_ page.
#. In the list of folders and files, open the **Vertical** folder.
.. note:: If your unit is not published, open the **Drafts** folder, and then open the **Vertical** folder in the **Drafts** folder.
#. In the **Vertical** folder, locate the .xml file that has the same name as the unit ID that you noted in step 1, and then open the file in a text editor such as Sublime 2. For example, if the unit ID is e461de7fe2b84ebeabe1a97683360d31, you'll open the e461de7fe2b84ebeabe1a97683360d31.xml file.
The file contains a list of all the components in the unit, together with the URL names of the components. For example, the following file contains an HTML component followed by a Discussion component.
.. code-block:: xml
<vertical display_name="Test Unit">
<html url_name="b59c54e2f6fc4cf69ba3a43c49097d0b"/>
<discussion url_name="8320c3d511484f3b96bdedfd4a44ac8b"/>
</vertical>
#. Add the following poll code in the location where you want the poll. Change the text of the prompt to the text that you want.
.. code-block:: xml
<poll_question display_name="Poll Question">
<p>Text of the prompt</p>
<answer id="yes">Yes</answer>
<answer id="no">No</answer>
</poll_question>
In the example above, if you wanted your poll to appear between the HTML component and the Discussion component in the unit, your code would resemble the following.
.. code-block:: xml
<vertical display_name="Test Unit">
<html url_name="b59c54e2f6fc4cf69ba3a43c49097d0b"/>
<poll_question display_name="Poll Question">
<p>Text of the prompt</p>
<answer id="yes">Yes</answer>
<answer id="no">No</answer>
</poll_question>
<discussion url_name="8320c3d511484f3b96bdedfd4a44ac8b"/>
</vertical>
#. After you add the poll code, save and close the .xml file.
#. Re-package your course as a .tar.gz file.
* For information about how to do this on a Mac, see `How to Create a Tar GZip File from the Command Line <http://osxdaily.com/2012/04/05/create-tar-gzip/>`_.
* For information about how to do this on a Windows computer, see `How to Make a .tar.gz on Windows <http://stackoverflow.com/questions/12774707/how-to-make-a-tar-gz-on-windows>`_.
#. In Studio, re-import your course. You can now review the poll question and answers that you added in Studio.
.. note::
* Although polls render correctly in Studio, you cannot edit them in Studio. You will need to follow the export/import process outlined above to make any edits to your polls.
* A .csv file that contains student responses to the problem is not currently available for polls. However, you can obtain the aggregate data directly in the problem.
==================
Format description
==================
The main tag of Poll module input is:
.. code-block:: xml
<poll_question> ... </poll_question>
``poll_question`` can include any number of the following tags:
any xml and ``answer`` tag. All inner xml, except for ``answer`` tags, we call "question".
poll_question tag
-----------------
Xmodule for creating poll functionality - voting system. The following attributes can
be specified for this tag::
name - Name of xmodule.
[display_name| AUTOGENERATE] - Display name of xmodule. When this attribute is not defined - display name autogenerate with some hash.
[reset | False] - Can reset/revote many time (value = True/False)
answer tag
----------
Define one of the possible answer for poll module. The following attributes can
be specified for this tag::
id - unique identifier (using to identify the different answers)
Inner text - Display text for answer choice.
Example
=======
Examples of poll
----------------
.. code-block:: xml
<poll_question name="second_question" display_name="Second question">
<h3>Age</h3>
<p>How old are you?</p>
<answer id="less18">&lt; 18</answer>
<answer id="10_25">from 10 to 25</answer>
<answer id="more25">&gt; 25</answer>
</poll_question>
Examples of poll with unable reset functionality
------------------------------------------------
.. code-block:: xml
<poll_question name="first_question_with_reset" display_name="First question with reset"
reset="True">
<h3>Your gender</h3>
<p>You are man or woman?</p>
<answer id="man">Man</answer>
<answer id="woman">Woman</answer>
</poll_question>
.. _Protein Builder:
************************
Protex Protein Builder
************************
The Protex protein builder asks students to create specified protein shapes by stringing together amino acids. In the example below, the goal protein shape is a simple line.
.. image:: ../Images/ProteinBuilder.png
:alt: Image of the protein builder
.. _Create the Protein Builder:
==========================
Create the Protein Builder
==========================
To create the protein builder:
#. Under **Add New Component**, click **Problem**, and then click **Blank Advanced Problem**.
#. In the component that appears, click **Edit**.
#. In the component editor, paste the Problem component code from below.
#. Make any changes that you want, and then click **Save**.
.. _Protein Builder Code:
=====================
Protein Builder Code
=====================
.. code-block:: xml
<problem>
<p>The protein builder allows you string together the building blocks of proteins, amino acids, and see how that string will form into a structure. You are presented with a goal protein shape, and your task is to try to re-create it. In the example below, the shape that you are asked to form is a simple line.</p>
<p>Be sure to click "Fold" to fold your protein before you click "Check".</p>
<script type="loncapa/python">
def protex_grader(expect,ans):
import json
ans=json.loads(ans)
if "ERROR" in ans["protex_answer"]:
raise ValueError("Protex did not understand your answer. Try folding the protein.")
return ans["protex_answer"]=="CORRECT"
</script>
<text>
<customresponse cfn="protex_grader">
<designprotein2dinput width="855" height="500" target_shape="W;W;W;W;W;W;W"/>
</customresponse>
</text>
<solution>
<p>
Many protein sequences, such as the following example, fold to a straight line.You can play around with the protein builder if you're curious.
</p>
<ul>
<li>
Stick: RRRRRRR
</li>
</ul>
</solution>
</problem>
In this code:
* **width** and **height** specify the dimensions of the application, in pixels.
* **target_shape** lists the amino acids that, combined in the order specified, create the shape you've asked students to create. The list can only include the following letters, which correspond to the one-letter code for each amino acid. (This list appears in the upper-left corner of the protein builder.)
.. list-table::
:widths: 15 15 15 15
:header-rows: 0
* - A
- R
- N
- D
* - C
- Q
- E
- G
* - H
- I
- L
- K
* - M
- F
- P
- S
* - T
- W
- Y
- V
.. _Advanced Problems:
Advanced Problems
=================
Advanced problems are problems such as drag and drop, circuit schematic
builder, and math expression problems. Many of these problems appear on the
Advanced tab when you create a new Problem component. Studio provides
templates for these problems, but the problems open directly in the
**Advanced Editor** and have to be created in XML.
- :ref:`Circuit Schematic Builder` In circuit schematic problems, students
create and modify circuits on an interactive grid and submit
computer-generated analyses of the circuits for grading.
- :ref:`Custom JavaScript Display and Grading` With custom JavaScript display
and grading problems, you can incorporate problem types that you've created
in HTML into Studio via an IFrame.
- :ref:`Custom Python Evaluated Input` Custom Python-evaluated input (also called "write-your-own-grader" problems evaluate students' responses using an embedded Python script that you create. These problems can be any type.
- :ref:`Drag and Drop` Drag and drop problems require students to drag text
or objects to a specific location on an image.
- :ref:`Image Mapped Input` Image mapped input problems require students to
click a specific location on an image.
- :ref:`Math Expression Input` Math expression input problems require
students to enter a mathematical expression as text, such as
e=m\*c^2.
- :ref:`Problem with Adaptive Hint` These problems can give students
feedback or hints based on their responses. Problems with adaptive
hints can be text input or multiple choice problems.
- :ref:`Problem Written in LaTeX` This problem type allows you to convert problems that you’ve already written in LaTeX into the edX format. Note that this problem type is still a prototype, however, and may not be supported in the future.
These problems are easy to access in Studio. To create them, click
**Problem** under **Add New Component**, click the **Advanced** tab, and
then click the name of the problem that you want to create.
.. _Circuit Schematic Builder:
Circuit Schematic Builder
-------------------------
In circuit schematic builder problems, students can arrange circuit
elements such as voltage sources, capacitors, resistors, and MOSFETs on
an interactive grid. They then submit a DC, AC, or transient analysis of
their circuit to the system for grading.
.. image:: ../Images/CircuitSchematicExample.png
:alt: Image of a circuit schematic builder
Create a Circuit Schematic Builder Problem
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#. In the unit where you want to create the problem, click **Problem**
under **Add New Component**, and then click the **Advanced** tab.
#. Click **Circuit Schematic Builder**.
#. In the component that appears, click **Edit**.
#. In the component editor, replace the example code with your own code.
#. Click **Save**.
**Problem Code**
To create the problem in the picture, paste the following code into the Advanced Editor.
.. code-block:: xml
<problem>
<p>Make a voltage divider that splits the provided voltage evenly.</p>
<schematicresponse>
<center>
<schematic height="500" width="600" parts="g,r" analyses="dc"
initial_value="[["v",[168,144,0],{"value":"dc(1)","_json_":0},["1","0"]],["r",[296,120,0],{"r":"1","_json_":1},["1","output"]],["L",[296,168,3],{"label":"output","_json_":2},["output"]],["w",[296,216,168,216]],["w",[168,216,168,192]],["w",[168,144,168,120]],["w",[168,120,296,120]],["g",[168,216,0],{"_json_":7},["0"]],["view",-67.49999999999994,-78.49999999999994,1.6000000000000003,"50","10","1G",null,"100","1","1000"]]"
/>
</center>
<answer type="loncapa/python">
dc_value = "dc analysis not found"
for response in submission[0]:
if response[0] == 'dc':
for node in response[1:]:
dc_value = node['output']
if dc_value == .5:
correct = ['correct']
else:
correct = ['incorrect']
</answer>
</schematicresponse>
<schematicresponse>
<p>Make a high pass filter.</p>
<center>
<schematic height="500" width="600" parts="g,r,s,c" analyses="ac"
submit_analyses="{"ac":[["NodeA",1,9]]}"
initial_value="[["v",[160,152,0],{"name":"v1","value":"sin(0,1,1,0,0)","_json_":0},["1","0"]],["w",[160,200,240,200]],["g",[160,200,0],{"_json_":2},["0"]],["L",[240,152,3],{"label":"NodeA","_json_":3},["NodeA"]],["s",[240,152,0],{"color":"cyan","offset":"0","_json_":4},["NodeA"]],["view",64.55878906250004,54.114697265625054,2.5000000000000004,"50","10","1G",null,"100","1","1000"]]"/>
</center>
<answer type="loncapa/python">
ac_values = None
for response in submission[0]:
if response[0] == 'ac':
for node in response[1:]:
ac_values = node['NodeA']
print "the ac analysis value:", ac_values
if ac_values == None:
correct = ['incorrect']
elif ac_values[0][1] < ac_values[1][1]:
correct = ['correct']
else:
correct = ['incorrect']
</answer>
</schematicresponse>
<solution>
<div class="detailed-solution">
<p>Explanation</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><img src="/c4x/edX/edX101/asset/images_voltage_divider.png"/></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>
<p><img src="/c4x/edX/edX101/asset/images_high_pass_filter.png"/></p>
</div>
</solution>
</problem>
.. _Custom JavaScript Display and Grading:
Custom JavaScript Display and Grading
-------------------------------------
Custom JavaScript display and grading problems (also called *custom JavaScript problems*
or *JS Input problems*) allow you to create a custom problem or tool that uses JavaScript
and then add the problem or tool directly into Studio. When you create a JS Input problem,
Studio embeds the problem in an inline frame (IFrame) so that your students can interact with
it in the LMS. You can grade your students’ work using JavaScript and some basic Python, and
the grading is integrated into the edX grading system.
The JS Input problem that you create must use HTML, JavaScript, and cascading style sheets
(CSS). You can use any application creation tool, such as the Google Web Toolkit (GWT), to
create your JS Input problem.
.. image:: ../Images/JavaScriptInputExample.png
:alt: Image of a JavaScript Input problem
Create a Custom JavaScript Display and Grading Problem
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#. Create your JavaScript application, and then upload all files associated with
that application to the **Files & Uploads** page.
#. In the unit where you want to create the problem, click **Problem**
under **Add New Component**, and then click the **Advanced** tab.
#. Click **Custom JavaScript Display and Grading**.
#. In the component that appears, click **Edit**.
#. In the component editor, modify the example code according to your problem.
- All problems have more than one element. Most problems conform to the same-origin
policy (SOP), meaning that all elements have the same protocol, host, and port.
For example, **http**://**store.company.com**:**81**/subdirectory_1/JSInputElement.html and
**http**://**store.company.com**:**81**/subdirectory_2/JSInputElement.js have the same protocol
(http), host (store.company.com), and port (81).
If any elements of your problem use a different protocol, host, or port, you need to
bypass the SOP. For example, **https**://**info.company.com**/JSInputElement2.html
uses a different protocol, host, and port. To bypass the SOP, change
**sop="false"** in line 8 of the example code to **sop="true"**. For more information, see the same-origin policy
page on the `Mozilla Developer Network <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Same_origin_policy_for_JavaScript>`_
or on `Wikipedia <http://en.wikipedia.org/wiki/Same_origin_policy>`_.
#. If you want your problem to have a **Save** button, click the **Settings** tab, and then set
**Maximum Attempts** to a number larger than zero.
#. Click **Save**.
Re-create the Example Problem
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To re-create the example problem above, you'll need the following files.
- webGLDemo.html
- webGLDemo.js
- webGLDemo.css
- three.min.js
To download these files in a .zip archive, go to http://files.edx.org/JSInput.zip.
..note:: If you need to bypass the SOP, you'll also need the **jschannel.js** file, and your webGLDemo.html file will be slightly different. To download all these files in a .zip archive, go to http://files.edx.org/JSInput_BypassSOP.zip.
#. Download and unpackage the files in either the JSInput.zip file or the JSInput_BypassSOP.zip file.
#. On the **Files & Uploads** page, upload all the files from the .zip file.
#. Create a new custom JavaScript display and grading problem component.
#. On the **Settings** tab, set **Maximum Attempts** to a number larger than
zero.
#. In the problem component editor, replace the example code with the code below.
#. Click **Save.**
JavaScript Input Problem Code
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: xml
<problem display_name="webGLDemo">
In the image below, click the cone.
<script type="loncapa/python">
import json
def vglcfn(e, ans):
'''
par is a dictionary containing two keys, "answer" and "state"
The value of answer is the JSON string returned by getGrade
The value of state is the JSON string returned by getState
'''
par = json.loads(ans)
# We can use either the value of the answer key to grade
answer = json.loads(par["answer"])
return answer["cylinder"] and not answer["cube"]
# Or we can use the value of the state key
'''
state = json.loads(par["state"])
selectedObjects = state["selectedObjects"]
return selectedObjects["cylinder"] and not selectedObjects["cube"]
'''
</script>
<customresponse cfn="vglcfn">
<jsinput
gradefn="WebGLDemo.getGrade"
get_statefn="WebGLDemo.getState"
set_statefn="WebGLDemo.setState"
width="400"
height="400"
html_file="/static/webGLDemo.html"
/>
</customresponse>
</problem>
.. note:: When you create this problem, keep the following in mind.
- The webGLDemo.js file defines the three JavaScript functions (**WebGLDemo.getGrade**, **WebGLDemo.getState**, and **WebGLDemo.setState**).
- The JavaScript input problem code uses **WebGLDemo.getGrade**, **WebGLDemo.getState**, and **WebGLDemo.setState** to grade, save, or restore a problem. These functions must be global in scope.
- **WebGLDemo.getState** and **WebGLDemo.setState** are optional. You only have to define these functions if you want to conserve the state of the problem.
- **Width** and **height** represent the dimensions of the IFrame that holds the application.
- When the problem opens, the cone and the cube are both blue, or "unselected." When you click either shape once, the shape becomes yellow, or "selected." To unselect the shape, click it again. Continue clicking the shape to select and unselect it.
- The response is graded as correct if the cone is selected (yellow) when the user clicks **Check**.
- Clicking **Check** or **Save** registers the problem's current state.
.. _Custom Python Evaluated Input:
Custom Python-Evaluated Input ("Write-Your-Own-Grader")
-------------------------------------------------------
In custom Python-evaluated input (also called "write-your-own-grader problems" problems), the grader uses a Python script that you create and embed in the problem to evaluates a student's response or provide hints. These problems can be any type. Numerical input and text input problems are the most popular write-your-own-grader problems.
.. image:: ../Images/CustomPythonExample.png
:alt: Image of a write your own grader problem
Custom Python-evaluated input problems can include the following:
* :ref:`Chemical Equation`
* :ref:`Custom JavaScript Display and Grading`
* :ref:`Custom Python Evaluated Input`
* :ref:`Gene Explorer`
* :ref:`Molecule Editor`
* :ref:`Protein Builder`
.. list-table::
:widths: 20 80
* - ``<script type="loncapa/python">``
- Indicates that the problem contains a Python script.
* - ``<customresponse cfn="test_add_to_ten">``
-
* - ``<customresponse cfn="test_add" expect="20">``
-
* - <textline size="10" correct_answer="3"/>
- This tag includes the ``size``, ``correct_answer``, and ``label`` attributes. The ``correct_answer`` attribute is optional.
You can create one of these problems in :ref:`Answer Tag Format` or :ref:`Script Tag Format`.
.. _Answer Tag Format:
Answer Tag Format
~~~~~~~~~~~~~~~~~
The answer tag format encloses the Python script in an ``<answer>`` tag:
.. code-block:: xml
<answer>
if answers[0] == expect:
correct[0] = 'correct'
overall_message = 'Good job!'
else:
correct[0] = 'incorrect'
messages[0] = 'This answer is incorrect'
overall_message = 'Please try again'
</answer>
.. important:: Python honors indentation. Within the ``<answer>`` tag, you must begin your script with no indentation.
The Python script interacts with these variables in the global context:
* ``answers``: An ordered list of answers the student provided. For example, if the student answered ``6``, ``answers[0]`` would equal ``6``.
* ``expect``: The value of the ``expect`` attribute of ``<customresponse>`` (if provided).
* ``correct``: An ordered list of strings indicating whether the student answered the question correctly. Valid values are ``"correct"``, ``"incorrect"``, and ``"unknown"``. You can set these values in the script.
* ``messages``: An ordered list of messages that appear under each response field in the problem. You can use this to provide hints to users. For example, if you include ``messages[0] = "The capital of California is Sacramento"``, that message appears under the first response field in the problem.
* ``overall_message``: A message that appears beneath the entire problem. You can use this to provide a hint that applies to the entire problem rather than a particular response field.
Create a Custom Python-Evaluated Input Problem in Answer Tag Format
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To create a custom Python-evaluated input problem using an ``<answer>`` tag:
#. In the unit where you want to create the problem, click **Problem**
under **Add New Component**, and then click the **Advanced** tab.
#. Click **Custom Python-Evaluated Input**.
#. In the component that appears, click **Edit**.
#. In the component editor, replace the example code with the following code.
#. Click **Save**.
.. code-block:: xml
<problem>
<p>What is the sum of 2 and 3?</p>
<customresponse expect="5">
<textline math="1" />
</customresponse>
<answer>
if answers[0] == expect:
correct[0] = 'correct'
overall_message = 'Good job!'
else:
correct[0] = 'incorrect'
messages[0] = 'This answer is incorrect'
overall_message = 'Please try again'
</answer>
</problem>
.. important:: Python honors indentation. Within the ``<answer>`` tag, you must begin your script with no indentation.
.. _Script Tag Format:
Script Tag Format
~~~~~~~~~~~~~~~~~
The script tag format encloses a Python script that contains a "check function" in a ``<script>`` tag, and adds the ``cfn`` attribute of the ``<customresponse>`` tag to reference that function:
.. code-block:: xml
<problem>
<script type="loncapa/python">
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)
</script>
<p>Enter two integers that sum to 10. </p>
<customresponse cfn="test_add_to_ten">
<textline size="10"/><br/>
<textline size="10/>
</customresponse>
</problem>
**Important**: Python honors indentation. Within the ``<script>`` tag, the ``def check_func(expect, ans):`` line must have no indentation.
The **check** function accepts two arguments:
* ``expect`` is the value of the ``expect`` attribute of ``<customresponse>`` (if provided)
* ``answer`` is either:
* The value of the answer the student provided, if the problem only has one response field.
* An ordered list of answers the student provided, if the problem has multiple response fields.
The **check** function can return any of the following to indicate whether the student's answer is correct:
* ``True``: Indicates that the student answered correctly for all response fields.
* ``False``: Indicates that the student answered incorrectly. All response fields are marked as incorrect.
* A dictionary of the form: ``{ 'ok': True, 'msg': 'Message' }``
If the dictionary's value for ``ok`` is set to ``True``, all response fields are marked correct; if it is set to ``False``, all response fields are marked incorrect. The ``msg`` is displayed beneath all response fields, and it may contain XHTML markup.
* A dictionary of the form
.. code-block:: xml
{ 'overall_message': 'Overall message',
'input_list': [
{ 'ok': True, 'msg': 'Feedback for input 1'},
{ 'ok': False, 'msg': 'Feedback for input 2'},
... ] }
The last form is useful for responses that contain multiple response fields. It allows you to provide feedback for each response field individually, as well as a message that applies to the entire response.
Example of a checking function:
.. code-block:: python
def check_func(expect, answer_given):
check1 = (int(answer_given[0]) == 1)
check2 = (int(answer_given[1]) == 2)
check3 = (int(answer_given[2]) == 3)
return {'overall_message': 'Overall message',
'input_list': [
{ 'ok': check1, 'msg': 'Feedback 1'},
{ 'ok': check2, 'msg': 'Feedback 2'},
{ 'ok': check3, 'msg': 'Feedback 3'} ] }
The function checks that the user entered ``1`` for the first input, ``2`` for the second input, and ``3`` for the third input. It provides feedback messages for each individual input, as well as a message displayed beneath the entire problem.
Create a Custom Python-Evaluated Input Problem in Script Tag Format
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To create a custom Python-evaluated input problem using a ``<script>`` tag:
#. In the unit where you want to create the problem, click **Problem**
under **Add New Component**, and then click the **Advanced** tab.
#. Click **Custom Python-Evaluated Input**.
#. In the component that appears, click **Edit**.
#. In the component editor, replace the example code with the following code.
#. Click **Save**.
**Problem Code**:
.. code-block:: xml
<problem>
<p>This question has two parts.</p>
<script type="loncapa/python">
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)
</script>
<p>Part 1: Enter two integers that sum to 10. </p>
<customresponse cfn="test_add_to_ten">
<textline size="10" correct_answer="3" label="Integer #1"/><br/>
<textline size="10" correct_answer="7" label="Integer #2"/>
</customresponse>
<p>Part 2: Enter two integers that sum to 20. </p>
<customresponse cfn="test_add" expect="20">
<textline size="10" label="Integer #1"/><br/>
<textline size="10" label="Integer #2"/>
</customresponse>
<solution>
<div class="detailed-solution">
<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>
**Templates**
The following template includes answers that appear when the student clicks **Show Answer**.
.. 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>Problem text</p>
<customresponse cfn="test_add" expect="20">
<textline size="10" correct_answer="11" label="Integer #1"/><br/>
<textline size="10" correct_answer="9" label="Integer #2"/>
</customresponse>
<solution>
<div class="detailed-solution">
<p>Solution or Explanation Heading</p>
<p>Solution or explanation text</p>
</div>
</solution>
</problem>
The following template does not return answers when the student clicks **Show Answer**. If your problem doesn't include answers for the student to see, make sure to set **Show Answer** to **Never** in the problem component.
.. 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 that sum to 20: </p>
<customresponse cfn="test_add" expect="20">
<textline size="10" label="Integer #1"/><br/>
<textline size="10" label="Integer #2"/>
</customresponse>
<solution>
<div class="detailed-solution">
<p>Solution or Explanation Heading</p>
<p>Solution or explanation text</p>
</div>
</solution>
</problem>
.. _Drag and Drop:
Drag and Drop
-------------
In drag and drop problems, students respond to a question by dragging
text or objects to a specific location on an image.
.. image:: ../Images/DragAndDropProblem.png
:alt: Image of a drag and drop problem
Create a Drag and Drop Problem
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To create a drag and drop problem, you'll need the following files:
* Allopurinol.gif
* AllopurinolAnswer.gif
To download both these files in a .zip archive, go to http://files.edx.org/DragAndDropProblemFiles.zip.
To create the molecule editor that appears in the image above, you'll upload the files for this problem, and then paste the code below into a Problem component.
#. Upload the Allopurinol.gif and AllopurinolAnswer.gif files to the **Files & Uploads** page.
#. In the unit where you want to create the problem, click **Problem** under **Add New Component**, and then click the **Advanced** tab.
#. Click **Drag and Drop**.
#. In the component that appears, click **Edit**.
#. In the component editor, replace the example code with the following code.
#. Click **Save**.
**Problem Code**:
.. code-block:: xml
<problem>
<p> Allopurinol is a drug used to treat and prevent gout, a very painful form of arthritis. Once only a “rich man’s disease”, gout has become more and more common in recent decades – affecting about 3 million people in the United States alone. Deposits of needle-like crystals of uric acid in connective tissue or joint spaces cause the symptoms of swelling, stiffness and intense pain. Individuals with gout overproduce uric acid because they cannot eliminate it efficiently. Allopurinol treats and prevents gout by stopping the overproduction of uric acid through inhibition of an enzyme required for the synthesis of uric acid. </p>
<p> You are shown one of many possible molecules. On the structure of allopurinol below, identify the functional groups that are present by dragging the functional group name listed onto the appropriate target boxes on the structure. If you want to change an answer, you have to drag off the name as well. You may need to scroll through the names of functional groups to see all options. </p>
<customresponse>
<drag_and_drop_input no_labels="true" one_per_target="true" target_outline="true" img="/static/Allopurinol.gif">
<draggable can_reuse="true" label="methyl" id="1"/>
<draggable can_reuse="true" label="hydroxyl" id="2"/>
<draggable can_reuse="true" label="amino" id="3"/>
<draggable can_reuse="true" label="carboxyl" id="4"/>
<draggable can_reuse="true" label="aldehyde" id="5"/>
<draggable can_reuse="true" label="phosphate" id="6"/>
<draggable can_reuse="true" label="sulfhydryl" id="7"/>
<draggable can_reuse="true" label="phenyl" id="8"/>
<draggable can_reuse="true" label="none" id="none"/>
<target id="0" h="53" w="66" y="55.100006103515625" x="131.5"/>
<target id="1" h="113" w="55" y="140.10000610351562" x="181.5"/>
</drag_and_drop_input>
<answer type="loncapa/python"> correct_answer = [ {'draggables': ['2'], 'targets': ['0' ], 'rule':'unordered_equal' }, {'draggables': ['none'], 'targets': ['1' ], 'rule':'unordered_equal' }] if draganddrop.grade(submission[0], correct_answer): correct = ['correct'] else: correct = ['incorrect'] </answer>
</customresponse>
<solution>
<img src="/static/AllopurinolAnswer.gif"/>
</solution>
</problem>
.. _Image Mapped Input:
Image Mapped Input
------------------
In an image mapped input problem, students click inside a defined area
in an image. You define this area by including coordinates in the body
of the problem.
.. image:: ../Images/ImageMappedInputExample.png
:alt: Image of an image mapped input problem
Create an Image Mapped Input Problem
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To create a image mapped input problem:
#. In the unit where you want to create the problem, click **Problem**
under **Add New Component**, and then click the **Advanced** tab.
#. Click **Image Mapped Input**.
#. In the component that appears, click **Edit**.
#. In the component editor, replace the example code with your own code.
#. Click **Save**.
**Problem Code**:
.. code-block:: xml
<problem>
<p><b>Example Problem</b></p>
<startouttext/>
<p>In the image below, click the triangle.</p>
<endouttext/>
<imageresponse>
<imageinput src="/static/threeshapes.png" width="220" height="150" rectangle="(80,40)-(130,90)" />
</imageresponse>
</problem>
.. _Math Expression Input:
Math Expression Input
---------------------
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.
.. image:: ../Images/MathExpressionInputExample.png
: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.
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`.
Create a Math Expression Input Problem
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To create a math expression input problem:
#. In the unit where you want to create the problem, click **Problem**
under **Add New Component**, and then click the **Advanced** tab.
#. Click **Math Expression Input**.
#. In the component that appears, click **Edit**.
#. In the component editor, replace the example code with your own code.
#. Click **Save**.
**Problem Code**
.. code-block:: xml
<problem>
<p>Some problems may ask for a mathematical expression. Practice creating mathematical expressions by answering the questions below.</p>
<p>Write an expression for the product of R_1, R_2, and the inverse of R_3.</p>
<formularesponse type="ci" samples="R_1,R_2,R_3@1,2,3:3,4,5#10" answer="$VoVi">
<responseparam type="tolerance" default="0.00001"/>
<formulaequationinput size="40" label="Enter the equation"/>
</formularesponse>
<script type="loncapa/python">
VoVi = "(R_1*R_2)/R_3"
</script>
<p>Let <i>x</i> be a variable, and let <i>n</i> be an arbitrary constant. What is the derivative of <i>x<sup>n</sup></i>?</p>
<script type="loncapa/python">
derivative = "n*x^(n-1)"
</script>
<formularesponse type="ci" samples="x,n@1,2:3,4#10" answer="$derivative">
<responseparam type="tolerance" default="0.00001"/>
<formulaequationinput size="40" label="Enter the equation"/>
</formularesponse>
<solution>
<div class="detailed-solution">
<p>Explanation or Solution Header</p>
<p>Explanation or solution text</p>
</div>
</solution>
</problem>
**Notes for Students**
When you answer a math expression input problem, follow these guidelines.
* Use standard arithmetic operation symbols.
* Indicate multiplication explicitly by using an asterisk (*).
* Use a caret (^) to raise to a power.
* Use an underscore (_) to indicate a subscript.
* Use parentheses to specify the order of operations.
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.
.. _Problem with Adaptive Hint:
Problem with Adaptive Hint
--------------------------
A problem with an adaptive hint evaluates a student's response, then
gives the student feedback or a hint based on that response so that the
student is more likely to answer correctly on the next attempt. These
problems can be text input or multiple choice problems.
.. image:: ../Images/ProblemWithAdaptiveHintExample.png
:alt: Image of a problem with an adaptive hint
Create a Problem with an Adaptive Hint
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To create a problem with an adaptive hint:
#. In the unit where you want to create the problem, click **Problem**
under **Add New Component**, and then click the **Advanced** tab.
#. Click **Problem with Adaptive Hint**.
#. In the component that appears, click **Edit**.
#. In the component editor, replace the example code with your own code.
#. Click **Save**.
.. _Problem Written in LaTeX:
Problem Written in LaTeX
------------------------
.. warning:: This problem type is still a prototype and may not be supported in the future. By default, the ability to create these problems is not enabled in Studio. You must change the advanced settings in your course before you can create problems with LaTeX. Use this problem type with caution.
If you have an problem that is already written in LaTeX, you can use
this problem type to easily convert your code into XML. After you paste
your code into the LaTeX editor, you'll only need to make a few minor
adjustments.
.. note:: If you want to use LaTeX to typeset mathematical expressions
in problems that you haven't yet written, use any of the other problem
templates together with `MathJax <http://www.mathjax.org>`_. For more
information about how to create mathematical expressions in Studio using
MathJax, see *A Brief Introduction to MathJax in Studio*.
.. image:: ../Images/ProblemWrittenInLaTeX.png
:alt: Image of a problem written in LaTeX
Create a Problem Written in LaTeX
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To create a problem written in LaTeX:
#. Enable the policy key in your course.
#. In Studio, click **Settings**, and then click **Advanced Settings**.
#. On the **Advanced Settings** page, scroll down to the **use_latex_compiler** policy key.
#. In the **Policy Value** field next to the **use_latex_compiler** policy key, change **false** to **true**.
#. At the bottom of the page, click **Save Changes**.
#. In the unit where you want to create the problem, click **Problem**
under **Add New Component**, and then click the **Advanced** tab.
#. Click **Problem Written in LaTeX**.
#. In the component editor that appears, click **Edit**.
#. In the lower left corner of the component editor, click **Launch
LaTeX Source Compiler**.
#. Replace the example code with your own code. You can also upload a Latex file into the editor from your computer by clicking **Upload** in the bottom right corner.
#. In the lower left corner of the LaTeX source compiler, click **Save &
Compile to edX XML**.
\ No newline at end of file
.. _Common Problems:
###############
Common Problems
###############
*Common problems* are typical problems such as multiple choice problems and other problems whose answers are simple for students to select or enter. You can create all of these problems using the Simple Editor in Studio. You don't have to use XML or switch to the Advanced Editor. (However, this section also provides sample XML code for these problems in the Advanced Editor.)
The following are the common problem types in Studio:
- :ref:`Checkbox` In checkbox problems, students select one or more options
from a list of possible answers.
- :ref:`Dropdown` In dropdown problems, students select one answer from a
dropdown list.
- :ref:`Multiple Choice` Multiple choice problems require students to
select one answer from a list of choices that appear directly below
the question.
- :ref:`Numerical Input` Numerical input problems require answers that
include only integers, fractions, and a few common constants and
operators.
- :ref:`Text Input` In text input problems, students enter a short text
answer to a question.
These problems are easy to access in Studio. To create them, click
**Problem** under **Add New Component**, click the **Common Problem
Types** tab, and then click the name of the problem.
.. note:: All problems must include labels for accessibility. The label generally includes the text of the main question in your problem. To add a label for a common problem, surround the text of the label with angle brackets pointed toward the text (>>*label text*<<).
.. _Checkbox:
*******************
Checkbox
*******************
In checkbox problems, the student selects one or more options from a
list of possible answers. The student must select all the options that
apply to answer the problem correctly. Each checkbox problem must have
at least one correct answer.
.. image:: ../Images/CheckboxExample.png
:alt: Image of a checkbox problem
==========================
Create a Checkbox Problem
==========================
You can create checkbox problems in the Simple Editor or in the Advanced Editor.
++++++++++++++++++++++++++++++++++++++++++
Simple Editor
++++++++++++++++++++++++++++++++++++++++++
#. Under **Add New Component**, click **Problem**.
#. In the **Select Problem Component Type** screen, click **Checkboxes** on the **Common Problem Types** tab.
#. In the Problem component that appears, click **Edit**.
#. In the component editor, replace the default text with the text of your
problem. Enter each answer option on its own line.
#. Determine the text of the problem to use as a label, and then surround that text with two sets of angle brackets (>><<).
#. Select all the answer options, and then click the checkbox button.
.. image:: ../Images/ProbComponent_CheckboxIcon.png
:alt: Image of the checkbox button
When you do this, brackets appear next to each answer choice.
#. Add an **x** between the brackets for the correct answer or answers.
#. In the component editor, select the text of the explanation, and then click the
explanation button to add explanation tags around the text.
.. image:: ../Images/ProbCompButton_Explanation.png
:alt: Image of the explanation button
#. On the **Settings** tab, specify the settings that you want.
#. Click **Save**.
For the example problem above, the text in the Problem component is the
following.
.. code-block:: xml
Learning about the benefits of preventative healthcare can be particularly
difficult. >>Check all of the reasons below why this may be the case.<<
[x] A large amount of time passes between undertaking a preventative measure and seeing the result.
[ ] Non-immunized people will always fall sick.
[x] If others are immunized, fewer people will fall sick regardless of a particular individual's choice to get immunized or not.
[x] Trust in healthcare professionals and government officials is fragile.
[explanation]
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.
[explanation]
++++++++++++++++++++++++++++++++++++++++++
Advanced Editor
++++++++++++++++++++++++++++++++++++++++++
To create this problem in the Advanced Editor, click the **Advanced** tab in the Problem component editor, and then replace the existing code with the following code.
.. 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>
<choiceresponse>
<checkboxgroup direction="vertical" label="Check all of the reasons below why this may be the case">
<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>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>
</div>
</solution>
</choiceresponse>
</problem>
.. _Dropdown:
*******************
Dropdown
*******************
Dropdown problems allow the student to choose from a collection of
answer options, presented as a dropdown list. Unlike multiple choice
problems, whose answers are always visible directly below the question,
dropdown problems don't show answer choices until the student clicks
the dropdown arrow.
.. image:: ../Images/DropdownExample.png
:alt: Image of a dropdown problem
==========================
Create a Dropdown Problem
==========================
You can create dropdown problems in the Simple Editor or in the Advanced Editor.
++++++++++++++++++++++++++++++++++++++++++
Simple Editor
++++++++++++++++++++++++++++++++++++++++++
To create a dropdown problem, follow these steps.
#. Under **Add New Component**, click **Problem**.
#. In the **Select Problem Component Type** screen, click
**Dropdown** on the **Common Problem Types** tab.
#. In the new Problem component that appears, click **Edit**.
#. Replace the default text with the text for your problem. Enter each of the possible
answers on the same line, separated by commas.
#. Determine the text of the problem to use as a label, and then surround that text with two sets of angle brackets (>><<).
#. Select all the answer options, and then click the dropdown button.
.. image:: ../Images/ProbCompButton_Dropdown.png
:alt: Image of the dropdown button
When you do this, a double set of brackets ([[ ]]) appears and surrounds the
answer options.
#. Inside the brackets, surround the correct answer with parentheses.
#. In the component editor, select the text of the explanation, and then click the
explanation button to add explanation tags around the text.
.. image:: ../Images/ProbCompButton_Explanation.png
:alt: Image of the explanation button
#. On the **Settings** tab, specify the settings that you want.
#. Click **Save**.
For the example problem above, the text in the Problem component is the
following.
::
>>What type of data are the following?<<
Age:
[[Nominal, Discrete, (Continuous)]]
Age, rounded to the nearest year:
[[Nominal, (Discrete), Continuous]]
Life stage - infant, child, and adult:
[[(Nominal), Discrete, Continuous]]
++++++++++++++++++++++++++++++++++++++++++
Advanced Editor
++++++++++++++++++++++++++++++++++++++++++
To create this problem in the Advanced Editor, click the **Advanced** tab in the Problem component editor, and then replace the existing code with the following code.
**Problem Code:**
.. code-block:: xml
<problem>
<p>
<em>This exercise first appeared in HarvardX's PH207x Health in Numbers: Quantitative Methods in Clinical &amp; Public Health Research course, fall 2012.</em>
</p>
<p>What type of data are the following?</p>
<p>Age:</p>
<optionresponse>
<optioninput options="('Nominal','Discrete','Continuous')" correct="Continuous" label="Age"/>
</optionresponse>
<p>Age, rounded to the nearest year:</p>
<optionresponse>
<optioninput options="('Nominal','Discrete','Continuous')" correct="Discrete" label="Age, rounded to the nearest year"/>
</optionresponse>
<p>Life stage - infant, child, and adult:</p>
<optionresponse>
<optioninput options="('Nominal','Discrete','Continuous')" correct="Nominal" label="Life stage"/>
</optionresponse>
</problem>
.. _Multiple Choice:
*******************
Multiple Choice
*******************
In multiple choice problems, students select one option from a list of
answer options. Unlike with dropdown problems, whose answer choices
don't appear until the student clicks the drop-down arrow, answer
choices for multiple choice problems are always visible directly below
the question.
.. image:: ../Images/MultipleChoiceExample.png
:alt: Image of a multiple choice problem
You can also configure the following:
* :ref:`Shuffle Answers in a Multiple Choice Problem`
* :ref:`Targeted Feedback in a Multiple Choice Problem`
* :ref:`Answer Pools in a Multiple Choice Problem`
==================================
Create a Multiple Choice Problem
==================================
You can create multiple choice problems in the Simple Editor or in the Advanced Editor.
++++++++++++++++++++++++++++++++++++++++++
Simple Editor
++++++++++++++++++++++++++++++++++++++++++
#. Under **Add New Component**, click **Problem**.
#. In the **Select Problem Component Type** screen, click **Multiple
Choice** on the **Common Problem Types** tab.
#. When the new Problem component appears, click **Edit**.
#. In the component editor, replace the sample problem text with the text of your
problem. Enter each answer option on its own line.
#. Determine the text of the problem to use as a label, and then surround that text with two sets of angle brackets (>><<).
#. Select all the answer options, and then click the multiple choice button.
.. image:: ../Images/ProbCompButton_MultChoice.png
:alt: Image of the multiple choice button
When you do this, the component editor adds a pair of parentheses next to each
possible answer.
#. Add an "x" between the parentheses next to the correct answer.
#. In the component editor, select the text of the explanation, and then click the
explanation button to add explanation tags around the text.
.. image:: ../Images/ProbCompButton_Explanation.png
:alt: Image of the explanation button
#. On the **Settings** tab, specify the settings that you want.
#. Click **Save**.
For the example problem above, the text in the Problem component is the
following.
::
>>Lateral inhibition, as was first discovered in the horsehoe crab:<<
( ) is a property of touch sensation, referring to the ability of crabs to
detect nearby predators.
( ) is a property of hearing, referring to the ability of crabs to detect
low frequency noises.
(x) is a property of vision, referring to the ability of crabs eyes to
enhance contrasts.
( ) has to do with the ability of crabs to use sonar to detect fellow horseshoe
crabs nearby.
( ) has to do with a weighting system in the crabs skeleton that allows it to
balance in turbulent water.
[Explanation]
Horseshoe crabs were essential to the discovery of lateral inhibition, a property of
vision present in horseshoe crabs as well as humans, that enables enhancement of
contrast at edges of objects as was demonstrated in class. In 1967, Haldan Hartline
received the Nobel prize for his research on vision and in particular his research
investigating lateral inhibition using horseshoe crabs.
[Explanation]
++++++++++++++++++++++++++++++++++++++++++
Advanced Editor
++++++++++++++++++++++++++++++++++++++++++
To create this problem in the Advanced Editor, click the **Advanced** tab in the Problem component editor, and then replace the existing code with the following code.
.. code-block:: xml
<problem>
<p>Lateral inhibition, as was first discovered in the horsehoe crab...</p>
<multiplechoiceresponse>
<choicegroup type="MultipleChoice" label="Lateral inhibition, as was first discovered in the horsehoe crab">
<choice correct="false">is a property of touch sensation, referring to the ability of crabs to detect nearby predators.</choice>
<choice correct="false">is a property of hearing, referring to the ability of crabs to detect low frequency noises.</choice>
<choice correct="false">is a property of vision, referring to the ability of crabs eyes to enhance contrasts.</choice>
<choice correct="true">has to do with the ability of crabs to use sonar to detect fellow horseshoe crabs nearby.</choice>
<choice correct="false">has to do with a weighting system in the crabs skeleton that allows it to balance in turbulent water.</choice>
</choicegroup>
</multiplechoiceresponse>
<solution>
<div class="detailed-solution">
<p>Explanation</p>
<p>Horseshoe crabs were essential to the discovery of lateral inhibition, a property of vision present in horseshoe crabs as well as humans, that enables enhancement of contrast at edges of objects as was demonstrated in class. In 1967, Haldan Hartline received the Nobel prize for his research on vision and in particular his research investigating lateral inhibition using horseshoe crabs.</p>
</div>
</solution>
</problem>
.. _Shuffle Answers in a Multiple Choice Problem:
=============================================
Shuffle Answers in a Multiple Choice Problem
=============================================
Optionally, you can configure a multiple choice problem so that it shuffles the order of possible answers.
For example, one view of the problem could be:
.. image:: ../Images/multiple-choice-shuffle-1.png
:alt: Image of a multiple choice problem
And another view of the same problem, for another student or for the same student of a subsequent view of the unit, could be:
.. image:: ../Images/multiple-choice-shuffle-2.png
:alt: Image of a multiple choice problem with shuffled answers
You can also have some answers shuffled, but not others. For example, you may want to have the answer "All of the Above" fixed at the end of the list, but shuffle other answers.
You can configure the problem to shuffle answers through :ref:`Simple Editor` or :ref:`Advanced Editor`.
++++++++++++++++++++++++++++++++++++++++++
Use the Simple Editor to Shuffle Answers
++++++++++++++++++++++++++++++++++++++++++
You can configure the problem to shuffle answers in :ref:`Simple Editor`.
For example, the following text defines a multiple choice problem, before shuffling is enabled. The ``(x)`` indicates the correct answer::
>>What Apple device competed with the portable CD player?<<
( ) The iPad
( ) Napster
(x) The iPod
( ) The vegetable peeler
To add shuffling to this problem, add ``!`` in the parenthesis of the first answer::
>>What Apple device competed with the portable CD player?<<
(!) The iPad
( ) Napster
(x) The iPod
( ) The vegetable peeler
To fix an answer's location in the list, add ``@`` in the parenthesis of that answer::
>>What Apple device competed with the portable CD player?<<
(!) The iPad
( ) Napster
(x) The iPod
( ) The vegetable peeler
(@) All of the above
You can combine symbols within parenthesis as necessary. For example, to show the correct answer in a fixed location, you could use::
(x@) The iPod
++++++++++++++++++++++++++++++++++++++++++
Use the Advanced Editor to Shuffle Answers
++++++++++++++++++++++++++++++++++++++++++
You can configure the problem to shuffle answers through XML in :ref:`Advanced Editor`.
For example, the following XML defines a multiple choice problem, before shuffling is enabled:
.. code-block:: xml
<p>What Apple device competed with the portable CD player?</p>
<multiplechoiceresponse>
<choicegroup type="MultipleChoice">
<choice correct="false">The iPad</choice>
<choice correct="false">Napster</choice>
<choice correct="true">The iPod</choice>
<choice correct="false">The vegetable peeler</choice>
</choicegroup>
</multiplechoiceresponse>
To add shuffling to this problem, add ``shuffle="true"`` to the ``<choicegroup>`` element:
.. code-block:: xml
<p>What Apple device competed with the portable CD player?</p>
<multiplechoiceresponse>
<choicegroup type="MultipleChoice" shuffle="true">
<choice correct="false">The iPad</choice>
<choice correct="false">Napster</choice>
<choice correct="true">The iPod</choice>
<choice correct="false">The vegetable peeler</choice>
</choicegroup>
</multiplechoiceresponse>
To fix an answer's location in the list, add ``fixed="true"`` to the ``choice`` element for the answer:
.. code-block:: xml
<p>What Apple device competed with the portable CD player?</p>
<multiplechoiceresponse>
<choicegroup type="MultipleChoice" shuffle="true">
<choice correct="false">The iPad</choice>
<choice correct="false">Napster</choice>
<choice correct="true">The iPod</choice>
<choice correct="false">The vegetable peeler</choice>
<choice correct="false" fixed="true">All of the above</choice>
</choicegroup>
</multiplechoiceresponse>
.. _Targeted Feedback in a Multiple Choice Problem:
===============================================
Targeted Feedback in a Multiple Choice Problem
===============================================
You can configure a multiple choice problem so that explanations for incorrect answers are automatically shown to students. You can use these explanations to guide students towards the right answer. Therefore, targeted feedback is most useful for multiple choice problems for which students are allowed multiple attempts.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Use the Advanced Editor to Configure Targeted Feedback
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
You configure the problem to provide targeted feedback through XML in :ref:`Advanced Editor`.
Follow these XML guidelines:
* Add a ``targeted-feedback`` attribute to the ``<multiplechoiceresponse>`` element, with no value: ``<multiplechoiceresponse targeted-feedback="">``
* Add a ``<targetedfeedbackset>`` element before the ``<solution>`` element.
* Within ``<targetedfeedbackset>``, add one or more ``<targetedfeedback>`` elements.
* Within each ``<targetedfeedback>`` element, enter your explanation for the incorrect answer in HTML as markup described below.
* Connect the ``<targetedfeedback>`` element with a specific incorrect answer by using the same ``explanation-id`` attribute value for each.
* Use the ``<solution>`` element for the correct answer, with the same ``explanation-id`` attribute value as the correct ``<choice>``.
For example, the XML for the multiple choice problem is:
.. code-block:: xml
<p>What Apple device competed with the portable CD player?</p>
<multiplechoiceresponse targeted-feedback="">
<choicegroup type="MultipleChoice">
<choice correct="false" explanation-id="feedback1">The iPad</choice>
<choice correct="false" explanation-id="feedback2">Napster</choice>
<choice correct="true" explanation-id="correct">The iPod</choice>
<choice correct="false" explanation-id="feedback3">The vegetable peeler</choice>
</choicegroup>
</multiplechoiceresponse>
This is followed by XML that defines the targeted feedback:
.. code-block:: xml
<targetedfeedbackset>
<targetedfeedback explanation-id="feedback1">
<div class="detailed-targeted-feedback">
<p>Targeted Feedback</p>
<p>The iPad came out later and did not directly compete the portable CD players.</p>
</div>
</targetedfeedback>
<targetedfeedback explanation-id="feedback2">
<div class="detailed-targeted-feedback">
<p>Targeted Feedback</p>
<p>Napster was not an Apple product.</p>
</div>
</targetedfeedback>
<targetedfeedback explanation-id="feedback3">
<div class="detailed-targeted-feedback">
<p>Targeted Feedback</p>
<p>No, not even close.</p>
</div>
</targetedfeedback>
</targetedfeedbackset>
<solution explanation-id="correct">
<div class="detailed-solution">
<p>Yes, the iPod competed with portable CD players.</p>
</div>
</solution>
.. _Answer Pools in a Multiple Choice Problem:
=============================================
Answer Pools in a Multiple Choice Problem
=============================================
You can configure a multiple choice problem so that a random subset of choices are shown to each student. For example, you can add 10 possible choices to the problem, and each student views a set of five choices.
The answer pool must have at least one correct answer, and can have more than one. In each set of choices shown to a student, one correct answer is included. For example, you may configure two correct answers in the set of 10. One of the two correct answers is included in each set a student views.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Use the Advanced Editor to Configure Answer Pools
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
You configure the problem to provide answer pools through XML in :ref:`Advanced Editor`.
Follow these XML guidelines:
* In the ``<choicegroup>`` element, add the ``answer-pool`` attribute, with the numerical value indicating the number of possible answers in the set. For example, ``<choicegroup answer-pool="4">``.
* For each correct answer, to the ``<choice>`` element, add an ``explanation-id`` attribute and value that maps to a solution. For example, ``<choice correct="true" explanation-id="iPod">The iPod</choice>``.
* For each ``<solution>`` element, add an ``explanation-id`` attribute and value that maps back to a correct answer. For example, ``<solution explanation-id="iPod">``.
.. note:: If the choices include only one correct answer, you do not have to use the ``explanation-id`` in either the ``choice`` or ``<solution>`` element. You do still use the ``<solutionset>`` element to wrap the ``<solution>`` element.
For example, for the following multiple choice problem, a student will see four choices, and in each set one of the choices will be one of the two correct ones. The explanation shown for the correct answer is the one with the same explanation ID.
.. code-block:: xml
<problem>
<p>What Apple devices let you carry your digital music library in your pocket?</p>
<multiplechoiceresponse>
<choicegroup type="MultipleChoice" answer-pool="4">
<choice correct="false">The iPad</choice>
<choice correct="false">Napster</choice>
<choice correct="true" explanation-id="iPod">The iPod</choice>
<choice correct="false">The vegetable peeler</choice>
<choice correct="false">The iMac</choice>
<choice correct="true" explanation-id="iPhone">The iPhone</choice>
</choicegroup>
</multiplechoiceresponse>
<solutionset>
<solution explanation-id="iPod">
<div class="detailed-solution">
<p>Explanation</p>
<p>Yes, the iPod is Apple's portable digital music player.</p>
</div>
</solution>
<solution explanation-id="iPhone">
<div class="detailed-solution">
<p>Explanation</p>
<p>In addition to being a cell phone, the iPhone can store and play your digital music.</p>
</div>
</solution>
</solutionset>
</problem>
.. _Numerical Input:
*******************
Numerical Input
*******************
In numerical input problems, students enter numbers or specific and
relatively simple mathematical expressions to answer a question.
.. image:: ../Images/image292.png
:alt: Image of a numerical input problem
Note that students' responses don't have to be exact for these problems. You can
specify a margin of error, or tolerance. You can also specify a correct answer explicitly, or use a Python script. For more information, see the instructions below.
Responses for numerical input problems can include integers, fractions,
and constants such as *pi* and *g*. Responses can also include text
representing common functions, such as square root (sqrt) and log base 2
(log2), as well as trigonometric functions and their inverses, such as
sine (sin) and arcsine (arcsin). For these functions, Studio changes the
text that the student enters into mathematical symbols. The following
example shows the way Studio renders students' text responses in
numerical input problems.
.. image:: ../Images/Math5.png
:alt: Image of a numerical input probem rendered by Studio
The following are a few more examples of the way that Studio renders numerical input
text that students enter.
.. image:: ../Images/Math1.png
:alt: Image of a numerical input probem rendered by Studio
.. image:: ../Images/Math2.png
:alt: Image of a numerical input probem rendered by Studio
.. image:: ../Images/Math3.png
:alt: Image of a numerical input probem rendered by Studio
.. image:: ../Images/Math4.png
:alt: Image of a numerical input probem rendered by Studio
.. image:: ../Images/Math5.png
:alt: Image of a numerical input probem rendered by Studio
==================
Student Answers
==================
.. _Math Expression Syntax:
+++++++++++++++++++++++
Math Expression Syntax
+++++++++++++++++++++++
In numerical input problems, the **student's input** may be more complicated than a
simple number. Expressions like ``sqrt(3)`` and even ``1+e^(sin(pi/2)+2*i)``
are valid, and evaluate to 1.73 and -0.13 + 2.47i, respectively.
A summary of the syntax follows:
Numbers
~~~~~~~
Accepted number types:
- Integers: '2520'
- Normal floats: '3.14'
- With no integer part: '.98'
- Scientific notation: '1.2e-2' (=0.012)
- More s.n.: '-4.4e+5' = '-4.4e5' (=-440,000)
- Appending SI suffixes: '2.25k' (=2,250). The full list:
====== ========== ===============
Suffix Stands for One of these is
====== ========== ===============
% percent 0.01 = 1e-2
k kilo 1000 = 1e3
M mega 1e6
G giga 1e9
T tera 1e12
c centi 0.01 = 1e-2
m milli 0.001 = 1e-3
u micro 1e-6
n nano 1e-9
p pico 1e-12
====== ========== ===============
The largest possible number handled currently is exactly the largest float
possible (in the Python language). This number is 1.7977e+308. Any expression
containing larger values will not evaluate correctly, so it's best to avoid
this situation.
Default Constants
~~~~~~~~~~~~~~~~~
Simple and commonly used mathematical/scientific constants are included by
default. These include:
- ``i`` and ``j`` as ``sqrt(-1)``
- ``e`` as Euler's number (2.718...)
- ``pi``
- ``k``: the Boltzmann constant (~1.38e-23 in Joules/Kelvin)
- ``c``: the speed of light in m/s (2.998e8)
- ``T``: the positive difference between 0K and 0°C (285.15)
- ``q``: the fundamental charge (~1.602e-19 Coloumbs)
Operators and Functions
~~~~~~~~~~~~~~~~~~~~~~~
The normal operators apply (with normal order of operations):
``+ - * / ^``. Also provided is a special "parallel resistors" operator given
by ``||``. For example, an input of ``1 || 2`` would represent the resistance
of a pair of parallel resistors (of resistance 1 and 2 ohms), evaluating to 2/3
(ohms).
At the time of writing, factorials written in the form '3!' are invalid, but
there is a workaround. Students can specify ``fact(3)`` or ``factorial(3)`` to
access the factorial function.
The default included functions are the following:
- Trig functions: sin, cos, tan, sec, csc, cot
- Their inverses: arcsin, arccos, arctan, arcsec, arccsc, arccot
- Other common functions: sqrt, log10, log2, ln, exp, abs
- Factorial: ``fact(3)`` or ``factorial(3)`` are valid. However, you must take
care to only input integers. For example, ``fact(1.5)`` would fail.
- Hyperbolic trig functions and their inverses: sinh, cosh, tanh, sech, csch,
coth, arcsinh, arccosh, arctanh, arcsech, arccsch, arccoth
=================================
Create a Numerical Input Problem
=================================
You can create numerical problems in the Simple Editor and in the Advanced Editor regardless of the answer to the problem. If the text of your problem doesn't include any italics, bold formatting, or special characters, you can create the problem in the Simple Editor. If the text of your problem contains special formatting or characters, or if your problem contains a Python script, you'll use the Advanced Editor.
For example, the following example problems require the Advanced Editor.
.. image:: ../Images/NumericalInput_Complex.png
:alt: Image of a more complex numerical input problem
For more information about including a Python script in your problem, see :ref:`Custom Python Evaluated Input`.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Create a Numerical Input Problem in the Simple Editor
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#. Under **Add New Component**, click **Problem**.
#. In the **Select Problem Component Type** screen, click **Numerical
Input** on the **Common Problem Types** tab.
3. When the new Problem component appears, click **Edit**.
#. In the component editor, replace the sample problem text with your own text.
#. Determine the text of the problem to use as a label, and then surround that text with two sets of angle brackets (>><<).
#. Select the text of the answer, and then click the numerical input button.
.. image:: ../Images//ProbCompButton_NumInput.png
:alt: Image of the numerical input button
When you do this, an equal sign appears next to the answer.
7. (Optional) Specify a margin of error, or tolerance. You can specify a percentage, number, or range.
* To specify a percentage on either side of the correct answer, add **+-NUMBER%** after the answer. For example, if you want to include a 2% tolerance, add **+-2%**.
* To specify a number on either side of the correct answer, add **+-NUMBER** after the answer. For example, if you want to include a tolerance of 5, add **+-5**.
* To specify a range, use brackets [] or parentheses (). A bracket indicates that range includes the number next to it. A parenthesis indicates that the range does not include the number next to it. For example, if you specify **[5, 8)**, correct answers can be 5, 6, and 7, but not 8. Likewise, if you specify **(5, 8]**, correct answers can be 6, 7, and 8, but not 5.
8. In the component editor, select the text of the explanation, and then click the
explanation button to add explanation tags around the text.
.. image:: ../Images/ProbCompButton_Explanation.png
:alt: Image of athe explanation button
9. On the **Settings** tab, specify the settings that you want.
#. Click **Save**.
For the first example problem above, the text in the Problem component is the
following.
::
>>What base is the decimal numeral system in?<<
= 10
[explanation]
The decimal numerial system is base ten.
[explanation]
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Create a Numerical Input Problem in the Advanced Editor
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
**Examples**
The following are a few more examples of the way that Studio renders numerical input
text that students enter.
.. image:: ../Images/Math1.gif
:alt: Image of a numerical input probem rendered by Studio
.. image:: ../Images/Math2.gif
:alt: Image of a numerical input probem rendered by Studio
.. image:: ../Images/Math3.gif
:alt: Image of a numerical input probem rendered by Studio
.. image:: ../Images/Math4.gif
:alt: Image of a numerical input probem rendered by Studio
.. image:: ../Images/Math5.gif
:alt: Image of a numerical input probem rendered by Studio
To create this problem in the Advanced Editor, click the **Advanced** tab in the Problem component editor, and then replace the existing code with the following code.
**Problem Code**:
.. code-block:: xml
<problem>
<p><b>Example Problem</b></p>
<p>What base is the decimal numeral system in?
<numericalresponse answer="10">
<formulaequationinput label="What base is the decimal numeral system in?"/>
</numericalresponse>
</p>
<p>What is the value of the standard gravity constant <i>g</i>, measured in m/s<sup>2</sup>? Give your answer to at least two decimal places.
<numericalresponse answer="9.80665">
<responseparam type="tolerance" default="0.01" />
<formulaequationinput label="Give your answer to at least two decimal places"/>
</numericalresponse>
</p>
<!-- Use python script spacing. The following should not be indented! -->
<script type="loncapa/python">
computed_response = math.sqrt(math.fsum([math.pow(math.pi,2), math.pow(math.e,2)]))
</script>
<p>What is the distance in the plane between the points (pi, 0) and (0, e)? You can type math.
<numericalresponse answer="$computed_response">
<responseparam type="tolerance" default="0.0001" />
<formulaequationinput label="What is the distance in the plane between the points (pi, 0) and (0, e)?"/>
</numericalresponse>
</p>
<solution>
<div class="detailed-solution">
<p>Explanation</p>
<p>The decimal numerical system is base ten.</p>
<p>The standard gravity constant is defined to be precisely 9.80665 m/s<sup>2</sup>.
This is 9.80 to two decimal places. Entering 9.8 also works.</p>
<p>By the distance formula, the distance between two points in the plane is
the square root of the sum of the squares of the differences of each coordinate.
Even though an exact numerical value is checked in this case, the
easiest way to enter this answer is to type
<code>sqrt(pi^2+e^2)</code> into the editor.
Other answers like <code>sqrt((pi-0)^2+(0-e)^2)</code> also work.
</p>
</div>
</solution>
</problem>
.. _Text input:
*******************
Text Input
*******************
In text input problems, students enter text into a response field. The
response can include numbers, letters, and special characters such as
punctuation marks. Because the text that the student enters must match
the instructor's specified answer exactly, including spelling and
punctuation, we recommend that you specify more than one attempt for
text input problems to allow for typographical errors.
.. image:: ../Images/TextInputExample.png
:alt: Image of a text input probem
==================================
Create a Text Input Problem
==================================
You can create multiple choice problems in the Simple Editor or in the Advanced Editor.
++++++++++++++++++++++++++++++++++++++++++
Simple Editor
++++++++++++++++++++++++++++++++++++++++++
To create a text input problem in the Simple Editor, follow these steps.
#. Under **Add New Component**, click **Problem**.
#. In the **Select Problem Component Type** screen, click **Text Input**
on the **Common Problem Types** tab.
#. In the new Problem component that appears, click **Edit**.
#. Replace the default text with the text for your problem.
#. Determine the text of the problem to use as a label, and then surround that text with two sets of angle brackets (>><<).
#. Select the text of the answer, and then click the text input button.
.. image:: ../Images/ProbCompButton_TextInput.png
:alt: Image of the text input button
When you do this, an equal sign appears next to the answer.
#. In the component editor, select the text of the explanation, and then click the
explanation button to add explanation tags around the text.
.. image:: ../Images/ProbCompButton_Explanation.png
:alt: Image of the explanation button
#. On the **Settings** tab, specify the settings that you want.
#. Click **Save**.
For the example problem above, the text in the Problem component is the
following.
::
>>What is the technical term that refers to the fact that, when enough people
sleep under a bednet, the disease may altogether disappear?<<
= herd immunity
[explanation]
The correct answer is herd immunity. As more and more people use bednets,
the risk of malaria begins to fall for everyone – users and non-users alike.
This can fall to such a low probability that malaria is effectively eradicated
from the group (even when the group does not have 100% bednet coverage).
[explanation]
++++++++++++++++++++++++++++++++++++++++++
Advanced Editor
++++++++++++++++++++++++++++++++++++++++++
To create this problem in the Advanced Editor, click the **Advanced** tab in the Problem component editor, and then replace the existing code with the following code.
.. code-block:: xml
<problem>
<p>
<em>This problem is adapted from an exercise that first appeared in MITx's 14.73x The Challenges of Global Poverty course, spring 2013.</em>
</p>
<p>What is the technical term that refers to the fact that, when enough people sleep under a bednet, the disease may altogether disappear?</p>
<stringresponse answer=".*herd immunity.*" type="ci regexp">
<additional_answer>community immunity</additional_answer>
<additional_answer>population immunity</additional_answer>
<textline size="20" label="What is the technical term that refers to the fact that, when enough people sleep under a bednet, the disease may altogether disappear?"/>
<hintgroup>
<stringhint answer="contact immunity" type="ci" name="contact_immunity_hint" />
<hintpart on="contact_immunity_hint">
<startouttext />
In contact immunity, a vaccinated individual passes along his immunity to another person through contact with feces or bodily fluids. The answer to the question above refers to the form of immunity that occurs when so many members of a population are protected, an infectious disease is unlikely to spread to the unprotected population.
<endouttext />
</hintpart >
<stringhint answer="firewall immunity" type="ci" name="firewall_immunity_hint" />
<hintpart on="firewall_immunity_hint">
<startouttext />
Although a firewall provides protection for a population, the term "firewall" is used more in computing and technology than in epidemiology.
<endouttext />
</hintpart >
</hintgroup>
</stringresponse>
<solution>
<div class="detailed-solution">
<p>Explanation</p>
<p>The correct answer is <b>herd immunity</b>. As more and more people use bednets, the risk of malaria begins to fall for everyone – users and non-users alike. This can fall to such a low probability that malaria is effectively eradicated from the group (even when the group does not have 100% bednet coverage).</p>
</div>
</solution>
</problem>
=========================================
Multiple Responses in Text Input Problems
=========================================
You can specify more than one correct response for text input problems.
For example, instead of requiring students to enter exactly "Dr. Martin Luther
King, Junior," you can allow answers of "Martin Luther King," "Doctor Martin
Luther King," and other variations. To do this, you can use the Simple Editor or the Advanced Editor.
++++++++++++++++++++++++++++++++++++++++++
Simple Editor
++++++++++++++++++++++++++++++++++++++++++
To specify additional correct responses in the Simple Editor, include "or=" (without the quotation marks) before each additional correct response.
::
>>What African-American led the United States civil rights movement during the 1960s?<<
= Dr. Martin Luther King, Jr.
or= Dr. Martin Luther King, Junior
or= Martin Luther King, Jr.
or= Martin Luther King
++++++++++++++++++++++++++++++++++++++++++
Advanced Editor
++++++++++++++++++++++++++++++++++++++++++
To specify additional correct responses in the Advanced Editor, add an ``<additional_answer>`` for each correct response inside the opening and closing ``<stringresponse>`` tags.
.. code-block:: xml
<problem>
<p>What African-American led the United States civil rights movement during the 1960s?</p>
<stringresponse answer="Dr. Martin Luther King, Jr." type="ci" >
<additional_answer>Dr. Martin Luther King, Junior</additional_answer>
<additional_answer>Martin Luther King, Jr.</additional_answer>
<additional_answer>Martin Luther King</additional_answer>
<textline label="What African-American led the United States civil rights movement during the 1960s?" size="20"/>
</stringresponse>
</problem>
=========================================
Case Sensitivity and Text Input Problems
=========================================
By default, text input problems do not require a case sensitive response. You can change this
and require a case sensitive answer.
To make a text input response case sensitive, you must use :ref:`Advanced Editor`.
In the Advanced Editor, you see that the **type** attribute of the **stringresponse**
element equals **ci**, for *case insensitive*. For example:
::
<stringresponse answer="Michigan" type="ci">
<textline size="20"/>
</stringresponse>
To make the response case sensitive, change the value of the **type** attribute to **cs**.
::
<stringresponse answer="Michigan" type="cs">
<textline size="20"/>
</stringresponse>
=============================================
Response Field Length of Text Input Problems
=============================================
By default, the response field for text input problems is 20 characters long.
You should preview the unit to ensure that the length of the response input field
accommodates the correct answer, and provides extra space for possible incorrect answers.
If the default response field length is not sufficient, you can change it using :ref:`Advanced Editor`.
In the advanced editor, in the XML block for the answer, you see that the **size** attribute of the **textline** element equals **20**:
::
<stringresponse answer="Democratic Republic of the Congo" type="ci">
<textline size="20"/>
</stringresponse>
To change the response field length, change the value of the **size** attribute:
::
<stringresponse answer="Democratic Republic of the Congo" type="ci">
<textline size="40"/>
</stringresponse>
====================================================
Hints and Regular Expressions in Text Input Problems
====================================================
You can provide hints that appear when students enter common incorrect answers in text input problems. You can also set a text input problem to allow a regular expression as an answer. To do this, you'll have to modify the problem's XML in the Advanced Editor.
The regular expression that the student enters must contain the part of the answer that the instructor specifies. For example, if an instructor has specified ``<answer=".*example answer.*" type="regexp">``, correct answers include ``example answered``, ``two example answers``, or even ``==example answer==``, but not ``examples`` or ``example anser``.
You can add ``regexp`` to the value of the ``type`` attribute, for example: ``type="ci regexp"`` or ``type="regexp"`` or ``type="regexp cs"``. In this case, any answer or hint are treated as regular expressions.
You can provide hints for common incorrect answers in text input problems. You can also set a text input problem to allow a regular expression as an answer. To do this, you'll have to modify the problem's XML in the Advanced Editor. For more information, see :ref:`Text Input`.
Although you can create text input problems by using the Simple Editor in Studio, you may want to see or change the problem's underlying XML. For example, you can add hints that appear when students enter common incorrect answers, or modify the problem's XML so that students can submit regular expressions as answers.
The regular expression that the student enters must contain the part of the answer that the instructor specifies. For example, if an instructor has specified ``<answer=".*example answer.*" type="regexp">``, correct answers include ``example answered``, ``two example answers``, or even ``==example answer==``, but not ``examples`` or ``example anser``.
You can add ``regexp`` to the value of the ``type`` attribute, for example: ``type="ci regexp"`` or ``type="regexp"`` or ``type="regexp cs"``. In this case, any answer or hint will be treated as regular expressions.
**Sample Problem**
.. image:: /Images/TextInputExample.gif
:alt: Image of a string response problem
**XML Tags**
.. list-table::
:widths: 20 80
* - ``<stringresponse>``
- Indicates that the problem is a text input problem.
* - ``<textline>``
- Child of ``<stringresponse>``. Lists the answer options and contains the ``label`` attribute.
* - ``<additional_answer>`` (optional)
- Specifies an additional correct answer for the problem. A problem can contain an unlimited number of additional answers.
* - ``<hintgroup>`` (optional)
- Indicates that the instructor has provided hints for certain common incorrect answers.
* - ``<stringhint />`` (optional)
- Child of ``<hintgroup>``. Specifies the text of the incorrect answer to provide the hint for. Contains answer, type, name.
* - ``<hintpart>``
- Contains the name from ``<stringhint>``. Associates the incorrect answer with the hint text for that incorrect answer.
* - ``<startouttext />``
- Indicates the beginning of the text of the hint.
* - ``<endouttext />``
- Indicates the end of the text of the hint.
**Sample Problem Code**
.. code-block:: xml
<problem>
<p>
<em>This problem is adapted from an exercise that first appeared in MITx's 14.73x The Challenges of Global Poverty course, spring 2013.</em>
</p>
<p>What is the technical term that refers to the fact that, when enough people sleep under a bednet, the disease may altogether disappear?</p>
<stringresponse answer=".*herd immunity.*" type="ci regexp">
<additional_answer>community immunity</additional_answer>
<additional_answer>population immunity</additional_answer>
<textline size="20" label="What is the technical term that refers to the fact that, when enough people sleep under a bednet, the disease may altogether disappear?"/>
<hintgroup>
<stringhint answer="contact immunity" type="ci" name="contact_immunity_hint" />
<hintpart on="contact_immunity_hint">
<startouttext />
In contact immunity, a vaccinated individual passes along his immunity to another person through contact with feces or bodily fluids. The answer to the question above refers to the form of immunity that occurs when so many members of a population are protected, an infectious disease is unlikely to spread to the unprotected population.
<endouttext />
</hintpart >
<stringhint answer="firewall immunity" type="ci" name="firewall_immunity_hint" />
<hintpart on="firewall_immunity_hint">
<startouttext />
Although a firewall provides protection for a population, the term "firewall" is used more in computing and technology than in epidemiology.
<endouttext />
</hintpart >
</hintgroup>
</stringresponse>
<solution>
<div class="detailed-solution">
<p>Explanation</p>
<p>The correct answer is <b>herd immunity</b>. As more and more people use bednets, the risk of malaria begins to fall for everyone – users and non-users alike. This can fall to such a low probability that malaria is effectively eradicated from the group (even when the group does not have 100% bednet coverage).</p>
</div>
</solution>
</problem>
**Template**
.. code-block:: xml
<problem>
<p>Problem text</p>
<stringresponse answer="**.Correct answer 1.**" type="ci regexp">
<additional_answer>Correct answer 2</additional_answer>
<additional_answer>Correct answer 3</additional_answer>
<textline size="20" label="label text"/>
<hintgroup>
<stringhint answer="Incorrect answer A" type="ci" name="hintA" />
<hintpart on="hintA">
<startouttext />Text of hint for incorrect answer A<endouttext />
</hintpart >
<stringhint answer="Incorrect answer B" type="ci" name="hintB" />
<hintpart on="hintB">
<startouttext />Text of hint for incorrect answer B<endouttext />
</hintpart >
<stringhint answer="Incorrect answer C" type="ci" name="hintC" />
<hintpart on="hintC">
<startouttext />Text of hint for incorrect answer C<endouttext />
</hintpart >
</hintgroup>
</stringresponse>
<solution>
<div class="detailed-solution">
<p>Explanation or Solution Header</p>
<p>Explanation or solution text</p>
</div>
</solution>
</problem>
You can provide hints for common incorrect answers in text input problems. You can also set a text input problem to allow a regular expression as an answer. To do this, you'll have to modify the problem's XML in the Advanced Editor. For more information, see :ref:`Text Input`.
.. _Appendix E:
################################
Problem and Tool XML
################################
This section provides information about the XML tags for most problem and tool types in Studio:
* :ref:`General`
* :ref:`Checkbox Problem XML`
* :ref:`Chemical Equation Problem XML`
* :ref:`Drag and Drop Problem XML`
* :ref:`Dropdown Problem XML`
* :ref:`Image Mapped Input Problem XML`
* :ref:`JS Input Problem XML`
* :ref:`Multiple Choice Problem XML`
* :ref:`Numerical Input Problem XML`
* :ref:`Math Expression Input Problem XML`
* :ref:`Text Input Problem XML`
.. _General:
=======
General
=======
Most problems have the following tags.
.. list-table::
:widths: 20 80
* - ``<problem> </problem>``
- These must be the first and last tags for any content created in the Advanced Editor in a Problem component.
* - ``<startouttext/>``
- The ``<startouttext />`` tag indicates the beginning of a line or block of text.
* - ``<endouttext/>``
- The ``<endouttext />`` tag indicates the end of a line or block of text.
* - ``<solution> <div class="detailed-solution"> </div> </solution>`` (optional)
- If you want to include more information in the problem, such as a detailed explanation of the problem's answer, you'll enter the text between the two ``<div>`` tags, which are inside the ``<solution>`` tags. (These tags do not have to be on the same line.)
Additionally, all problems must include a **label** attribute. This attribute adds a descriptive label that helps visually impaired students navigate through the problem.
You'll add a **label** attribute to one of the XML tags for the problem. Each example problem below includes a label.
.. _Checkbox Problem XML:
=============================
Checkbox Problem XML
=============================
Template
--------
.. code-block:: xml
<problem>
<startouttext/>
<p>Question text</p>
<choiceresponse>
<checkboxgroup direction="vertical" label="label text">
<choice correct="false"><text>Answer option 1 (incorrect)</text></choice>
<choice correct="true"><text>Answer option 2 (correct)</text></choice>
</checkboxgroup>
<solution>
<div class="detailed-solution">
<p>Solution or Explanation Heading</p>
<p>Solution or explanation text</p>
</div>
</solution>
</choiceresponse>
</problem>
Tags
----
* ``<choiceresponse>`` (required): Specifies that the problem contains options for students to choose from.
* ``<checkboxgroup>`` (required): Specifies that the problem is a checkbox problem.
* ``<choice>`` (required): Designates an answer option.
**Tag:** ``<choiceresponse>``
Specifies that the problem contains options for students to choose from.
Attributes
(none)
Children
* ``<checkboxgroup>``
**Tag:** ``<checkboxgroup>``
Specifies that the problem is a checkbox problem.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - direction (optional)
- Specifies the orientation of the list of answers. The default is vertical.
* - label (required)
- Specifies the name of the response field.
Children
* ``<choice>``
**Tag:** ``<choice>``
Designates an answer option.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - true (at least one required)
- Indicates a correct answer. For checkbox problems, one or more ``<choice>`` tags can contain a correct answer.
* - false (at least one required)
- Indicates an incorrect answer.
Children
(none)
.. _Chemical Equation Problem XML:
=============================
Chemical Equation Problem XML
=============================
Template
--------
.. code-block:: xml
<problem>
<startouttext/>
<p>Problem text</p>
<customresponse>
<chemicalequationinput size="NUMBER" label="LABEL TEXT"/>
<answer type="loncapa/python">
if chemcalc.chemical_equations_equal(submission[0], 'TEXT REPRESENTING CHEMICAL EQUATION'):
correct = ['correct']
else:
correct = ['incorrect']
</answer>
</customresponse>
<endouttext/>
<solution>
<div class="detailed-solution">
<p>Solution or Explanation Header</p>
<p>Solution or explanation text</p>
</div>
</solution>
</problem>
Tags
----
* ``<customresponse>``: Indicates that this problem has a custom response.
* ``<chemicalequationinput>``: Specifies that the answer to this problem is a chemical equation.
* ``<answer type=loncapa/python>``: Contains the Python script that grades the problem.
**Tag:** ``<customresponse>``
Indicates that this problem has a custom response. The ``<customresponse>`` tags must surround the ``<chemicalequation>`` tags.
Attributes
(none)
Children
* ``<chemicalequationinput>``
* ``<answer>``
**Tag:** ``<chemicalequationinput>``
Indicates that the answer to this problem is a chemical equation and creates a response field where the student enters an answer.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - size
- Specifies the size of the response field, in characters.
* - label (required)
- Contains the text of the principal question in the problem.
Children
(none)
**Tag:** ``<answer>``
Contains the Python script that grades the problem.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - type (required)
- Must be "loncapa/python".
Children
(none)
.. _Drag and Drop Problem XML:
=========================
Drag and Drop Problem XML
=========================
Template
--------
.. code-block:: xml
<problem>
<p>Problem text</p>
<customresponse>
<drag_and_drop_input no_labels="false" one_per_target="true" target_outline="true" img="/static/TARGET_IMAGE.gif">
<draggable can_reuse="true" label="NAME 1" id="1"/>
<draggable can_reuse="true" label="NAME 2" id="2"/>
<target id="0" h="HEIGHT (in pixels)" w="WIDTH (in pixels)" y="Y-COORDINATE" x="X-COORDINATE"/>
<target id="1" h="HEIGHT (in pixels)" w="WIDTH (in pixels)" y="Y-COORDINATE" x="X-COORDINATE"/>
</drag_and_drop_input>
<answer type="loncapa/python"> correct_answer = [ {'draggables': ['2'], 'targets': ['0' ], 'rule':'unordered_equal' }, {'draggables': ['none'], 'targets': ['1' ], 'rule':'unordered_equal' }] if draganddrop.grade(submission[0], correct_answer): correct = ['correct'] else: correct = ['incorrect'] </answer>
</customresponse>
<solution>
<img src="/static/ANSWER_IMAGE.gif"/>
</solution>
</problem>
Tags
----
* ``<drag_and_drop_input/>``: Indicates the problem is a drag and drop problem.
* ``<draggable/>``: Specifies a single object that a student will drag onto the base image.
* ``<target>``: Specifies the location on the base image where a draggable must be dropped.
**Tag:** ``<drag_and_drop_input/>``
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - img (required)
- Relative path to an image that will be the base image. All draggables can be dragged onto it.
* - target_outline
- Specifies whether an outline (gray dashed line) should be drawn around targets (if they are specified). It can be either 'true' or 'false'. If not specified, the targets do not have outlines.
* - one_per_target
- Specify whether to allow more than one draggable to be placed onto a single target. It can be either 'true' or 'false'. If not specified, the default value is 'true'.
* - no_labels (required)
- default is false, in default behaviour if label is not set, label is obtained from id. If no_labels is true, labels are not automatically populated from id, and one can not set labels and obtain only icons.
Children
* ``<draggable>``
* ``<target>``
**Tag:** ``<draggable/>``
Specifies a single draggable object in a drag and drop problem.
A draggable is what the user must drag out of the slider and drop onto the base image. After a drag operation, if the center of the draggable is located outside the rectangular dimensions of the image, it will be returned to the slider.
For the grader to work, each draggable must have a unique ID.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - id (required)
- Unique identifier of the draggable object.
* - label (optional)
- Text label that the user sees.
* - icon (optional)
- For draggables that are images, the relative path to the image file.
* - can_reuse
- true or false, default is false. If true, same draggable can be used multiple times.
Children
(none)
**Tag:** ``<target>``
Specifies the location on the base image where a student must drop a draggable item. By design, if the center of a draggable lies within the target (i.e. in the rectangle defined by [[x, y], [x + w, y + h]], it is within the target. Otherwise, it is outside.
If you specify at least one target, and a student drops a draggable item on a location that is outside a target, the draggable item returns to the slider.
If you don't specify a target, a student can drop a draggable item anywhere on the base image.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - id (required)
- Unique identifier of the target object.
* - x
- X-coordinate on the base image where the top left corner of the target will be positioned.
* - y
- Y-coordinate on the base image where the top left corner of the target will be positioned.
* - w
- Width of the target, in pixels.
* - h
- Height of the target, in pixels.
Children
(none)
For more information about how to create drag and drop problems, see `XML Format of Drag and Drop Input
<https://edx.readthedocs.org/en/latest/course_data_formats/drag_and_drop/drag_and_drop_input.html>`_.
.. _Dropdown Problem XML:
==========================
Dropdown Problem XML
==========================
Template
--------
.. code-block:: xml
<problem>
<p>
Problem text</p>
<optionresponse>
<optioninput options="('Option 1','Option 2','Option 3')" correct="Option 2" label="label text"/>
</optionresponse>
<solution>
<div class="detailed-solution">
<p>Explanation or Solution Header</p>
<p>Explanation or solution text</p>
</div>
</solution>
</problem>
.. code-block:: xml
<problem>
<p>Problem text</p>
<optionresponse>
options="('A','B')"
correct="A"/>
label="label text"
</optionresponse>
<solution>
<div class="detailed-solution">
<p>Explanation or Solution Header</p>
<p>Explanation or solution text</p>
</div>
</solution>
</problem>
Tags
----
* ``<optionresponse>`` (required): Indicates that the problem is a dropdown problem.
* ``<optioninput>`` (required): Lists the answer options.
**Tag:** ``<optionresponse>``
Indicates that the problem is a dropdown problem.
Attributes
(none)
Children
* ``<optioninput>``
**Tag:** ``<optioninput>``
Lists the answer options.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - options (required)
- Lists the answer options. The list of all answer options is surrounded by parentheses. Individual answer options are surrounded by single quotation marks (') and separated by commas (,).
* - correct (required)
- Indicates whether an answer is correct. Possible values are "true" and "false". Only one **correct** attribute can be set to "true".
* - label (required)
- Specifies the name of the response field.
Children
(none)
.. _Image Mapped Input Problem XML:
==============================
Image Mapped Input Problem XML
==============================
Template
--------
.. code-block:: xml
<problem>
<startouttext/>
<p>In the image below, click the triangle.</p>
<endouttext/>
<imageresponse>
<imageinput src="IMAGE FILE PATH" width="NUMBER" height="NUMBER" rectangle="(X-AXIS,Y-AXIS)-(X-AXIS,Y-AXIS)" />
</imageresponse>
</problem>
Tags
----
* ``<imageresponse>``: Indicates that the problem is an image mapped input problem.
* ``<imageinput>``: Specifies the image file and the region in the file that the student must click.
**Tag:** ``<imageresponse>``
Indicates that the problem is an image mapped input problem.
Attributes
(none)
Children
* ``<imageinput>``
**Tag:** ``<imageinput>``
Specifies the image file and the region in the file that the student must click.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - src (required)
- The URL of the image
* - height (required)
- The height of the image, in pixels
* - width (required)
- The width of the image, in pixels
* - rectangle (required)
- An attribute with four embedded values in the format (<start_width>,<start_height>)-(<end_width>,<end-height>). All coordinates start with (0,0) in the top left corner and increase in value toward the bottom right corner, very similar to the progression of reading English. The two coordinates defined form the two opposite corners of a box which a student can click inside of.
Children
(none)
.. _JS Input Problem XML:
=============================
JavaScript Input Problem XML
=============================
JSInput allows problem authors to turn stand-alone HTML files into problems that can be integrated into the edX platform. Since its aim is flexibility, it can be seen as the input and client-side equivalent of **CustomResponse**.
A JSInput exercise creates an IFrame in a static HTML page, and passes the return value of author-specified functions to the enclosing response type (generally **CustomResponse**). JSInput can also store and retrieve state.
Template
--------
The following is the basic format of a JSInput problem:
.. code-block:: xml
<problem>
<script type="loncapa/python">
def all_true(exp, ans): return ans == "hi"
</script>
<customresponse cfn="all_true">
<jsinput gradefn="gradefn"
height="500"
get_statefn="getstate"
set_statefn="setstate"
html_file="/static/jsinput.html"/>
</customresponse>
</problem>
The accepted attributes are:
============== ============== ========= ==========
Attribute Name Value Type Required Default
============== ============== ========= ==========
html_file URL string Yes None
gradefn Function name Yes `gradefn`
set_statefn Function name No None
get_statefn Function name No None
height Integer No `500`
width Integer No `400`
============== ============== ========= ==========
Required Attributes
-------------------
* **html_file**
The **html_file** attribute specifies the HTML file that the IFrame will point to. The HTML file
must be located in the content directory.
The IFrame is created using the sandbox attribute. Although pop-ups, scripts, and pointer locks are allowed, the IFrame cannot access its parent's attributes.
The HTML file must contain a **gradefn** function that the JSInput file can access. To determine whether the **gradefn** function is accessible, in the console, make sure that **gradefn** returns the right thing. When JSInput uses the **gradefn** function, `gradefn` is called with `gradefn`.call(`obj`), where **obj** is the object-part of **gradefn**. For example, if **gradefn** is **myprog.myfn**, JSInput calls **myprog.myfun.call(myprog)**. (This is to ensure "`this`" continues to refer to what `gradefn` expects.)
Aside from that, more or less anything goes. Note that currently there is no support for inheriting CSS or JavaScript from the parent (aside from the Chrome-only **seamless** attribute, which is set to True by default).
* **gradefn**
The **gradefn** attribute specifies the name of the function that will be called when a user clicks **Check**, and that returns the student's answer. Unless both the **get_statefn** and **set_statefn** attributes are also used, this answer is passed as a string to the enclosing response type. In the **customresponse** example above, this means **cfn** will be passed this answer as ``ans``.
If the **gradefn** function throws an exception when a student attempts to submit a problem, the submission is aborted, and the student receives a generic alert. The alert can be customised by making the exception name ``Waitfor Exception``; in that case, the alert message will be the exception message.
.. important:: To make sure the student's latest answer is passed correctly, make sure that the **gradefn** function is not asynchronous. Additionally, make sure that the function returns promptly. Currently the student has no indication that her answer is being calculated or produced.
Optional Attributes
-------------------
* **set_statefn**
Sometimes a problem author will want information about a student's previous answers ("state") to be saved and reloaded. If the attribute **set_statefn** is used, the function given as its value will be passed the state as a string argument whenever there is a state, and the student returns to a problem. The function has the responsibility to then use this state approriately.
The state that is passed is:
* The previous output of **gradefn** (i.e., the previous answer) if **get_statefn** is not defined.
* The previous output of **get_statefn** (see below) otherwise.
It is the responsibility of the iframe to do proper verification of the argument that it receives via **set_statefn**.
* **get_statefn**
Sometimes the state and the answer are quite different. For instance, a problem that involves using a javascript program that allows the student to alter a molecule may grade based on the molecule's hydrophobicity, but from the hydrophobicity it might be incapable of restoring the state. In that case, a
*separate* state may be stored and loaded by **set_statefn**. Note that if **get_statefn** is defined, the answer (i.e., what is passed to the enclosing response type) will be a json string with the following format:
.. code-block:: xml
{
answer: `[answer string]`
state: `[state string]`
}
The enclosing response type must then parse this as json.
* **height** and **width**
The **height** and **width** attributes are straightforward: they specify the height and width of the IFrame. Both are limited by the enclosing DOM elements, so for instance there is an implicit max-width of around 900.
In the future, JSInput may attempt to make these dimensions match the HTML file's dimensions (up to the aforementioned limits), but currently it defaults to `500` and `400` for **height** and **width**, respectively.
.. _Multiple Choice Problem XML:
=============================
Multiple Choice Problem XML
=============================
Template
--------
.. code-block:: xml
<problem>
<p>Question text</p>
<multiplechoiceresponse>
<choicegroup type="MultipleChoice" label="label text">
<choice correct="false" name="a">Incorrect choice</choice>
<choice correct="true" name="b">Correct choice</choice>
</choicegroup>
</multiplechoiceresponse>
<solution>
<div class="detailed-solution">
<p>Explanation or solution header</p>
<p>Explanation or solution text</p>
</div>
</solution>
</problem>
Tags
----
* ``<multiplechoiceresponse>`` (required): Indicates that the problem is a multiple choice problem.
* ``<choicegroup>`` (required): Indicates the beginning of the list of options.
* ``<choice>`` (required): Lists an answer option.
**Tag:** ``<multiplechoiceresponse>``
Indicates that the problem is a multiple choice problem.
Attributes
(none)
Children
* ``<choicegroup>``
* All standard HTML tags (can be used to format text)
**Tag:** ``<choicegroup>``
Indicates the beginning of the list of options.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - label (required)
- Specifies the name of the response field.
* - type (required)
- Must be set to "MultipleChoice".
Children
* ``<choice>``
**Tag:** ``<choice>``
Lists an answer option.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - correct (at least one required)
- Indicates a correct or incorrect answer. When the attribute is set to "true", the choice is a correct answer. When the attribute is set to "false", the choice is an incorrect answer. Only one choice can be a correct answer.
* - name
- A unique name that the back end uses to refer to the choice.
Children
(none)
.. _Numerical Input Problem XML:
===========================
Numerical Input Problem XML
===========================
Templates
---------
The following templates represent problems with and without a decimal or percentage tolerance.
Problem with no tolerance
~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: xml
<p>TEXT OF PROBLEM
<numericalresponse answer="ANSWER (NUMBER)">
<formulaequationinput label="TEXT OF PROBLEM"/>
</numericalresponse>
</p>
<solution>
<div class="detailed-solution">
<p>TEXT OF SOLUTION</p>
</div>
</solution>
</problem>
Problem with a decimal tolerance
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: xml
<problem>
<p>TEXT OF PROBLEM
<numericalresponse answer="ANSWER (NUMBER)">
<responseparam type="tolerance" default="NUMBER (DECIMAL, e.g., .02)" />
<formulaequationinput label="TEXT OF PROBLEM"/>
</numericalresponse>
</p>
<solution>
<div class="detailed-solution">
<p>TEXT OF SOLUTION</p>
</div>
</solution>
</problem>
Problem with a percentage tolerance
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: xml
<problem>
<p>TEXT OF PROBLEM
<numericalresponse answer="ANSWER (NUMBER)">
<responseparam type="tolerance" default="NUMBER (PERCENTAGE, e.g., 3%)" />
<formulaequationinput label="TEXT OF PROBLEM"/>
</numericalresponse>
</p>
<solution>
<div class="detailed-solution">
<p>TEXT OF SOLUTION</p>
</div>
</solution>
</problem>
Answer created with a script
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: xml
<problem>
<!-- Use python script spacing. The following should not be indented! -->
<script type="loncapa/python">
computed_response = math.sqrt(math.fsum([math.pow(math.pi,2), math.pow(math.e,2)]))
</script>
<p>TEXT OF PROBLEM
<numericalresponse answer="$computed_response">
<responseparam type="tolerance" default="0.0001" />
<formulaequationinput label="TEXT OF PROBLEM"/>
</numericalresponse>
</p>
<solution>
<div class="detailed-solution">
<p>TEXT OF SOLUTION</p>
</div>
</solution>
</problem>
Tags
----
* ``<numericalresponse>`` (required): Specifies that the problem is a numerical input problem.
* ``<formulaequationinput />`` (required): Provides a response field where the student enters a response.
* ``<responseparam>`` (optional): Specifies a tolerance, or margin of error, for an answer.
* ``<script>`` (optional):
.. note:: Some older problems use the ``<textline math="1" />`` tag instead of the ``<formulaequationinput />`` tag. However, the ``<textline math="1" />`` tag has been deprecated. All new problems should use the ``<formulaequationinput />`` tag.
**Tag:** ``<numericalresponse>``
Specifies that the problem is a numerical input problem. The ``<numericalresponse>`` tag is similar to the ``<formularesponse>`` tag, but the ``<numericalresponse>`` tag does not allow unspecified variables.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - answer (required)
- The correct answer to the problem, given as a mathematical expression.
.. note:: If you include a variable name preceded with a dollar sign ($) in the problem, you can include a script in the problem that computes the expression in terms of that variable.
The grader evaluates the answer that you provide and the student's response in the same way. The grader also automatically simplifies any numeric expressions that you or a student provides. Answers can include simple expressions such as "0.3" and "42", or more complex expressions such as "1/3" and "sin(pi/5)".
Children
* ``<responseparam>``
* ``<formulaequationinput>``
**Tag:** * ``<formulaequationinput>``
Creates a response field in the LMS where students enter a response.
Attributes
.. list-table::
:widths: 20 80
* - size (optional)
- Defines the width, in characters, of the response field in the LMS.
Children
(none)
**Tag:** ``<responseparam>``
Specifies a tolerance, or margin of error, for an answer.
Attributes
.. list-table::
:widths: 20 80
* - type (optional)
- "tolerance": Defines a tolerance for a number
* - default (optional)
- A number or a percentage specifying a numerical or percent tolerance.
Children
(none)
**Tag:** ``<script>``
Specifies a script that the grader uses to evaluate a student's response. A problem behaves as if all of the code in all of the script tags were in a single script tag. Specifically, any variables that are used in multiple ``<script>`` tags share a namespace and can be overriden.
As with all Python, indentation matters, even though the code is embedded in XML.
Attributes
.. list-table::
:widths: 20 80
* - type (required)
- Must be set to "loncapa/python".
Children
(none)
.. _Math Expression Input Problem XML:
==================================
Math Expression Input Problem XML
==================================
Templates
---------
.. code-block:: xml
<problem>
<p>Write an expression for the product of R_1, R_2, and the inverse of R_3.</p>
<formularesponse type="ci" samples="R_1,R_2,R_3@1,2,3:3,4,5#10" answer="R_1*R_2/R_3">
<responseparam type="tolerance" default="0.00001"/>
<formulaequationinput size="40" />
</formularesponse>
</problem>
.. code-block:: xml
<problem>
<p>Problem text</p>
<formularesponse type="ci" samples="VARIABLES@LOWER_BOUNDS:UPPER_BOUNDS#NUMBER_OF_SAMPLES" answer="$VoVi">
<responseparam type="tolerance" default="0.00001"/>
<formulaequationinput size="20" label="Enter the equation"/>
</formularesponse>
<script type="loncapa/python">
PYTHON SCRIPT
</script>
<solution>
<div class="detailed-solution">
<p>Explanation or Solution Header</p>
<p>Explanation or solution text</p>
</div>
</solution>
</problem>
Tags
----
* ``<formularesponse>``
* ``<formulaequationinput />``
* ``<responseparam>``
* ``<script>``
**Tag:** ``<formularesponse>``
Specifies that the problem is a math expression input problem. The ``<formularesponse>`` tag is similar to ``<numericalresponse>``, but ``<formularesponse>`` allows unknown variables.
Attributes
**type**: Can be "cs" (case sensitive, the default) or "ci" (case insensitive, so that capitalization doesn't matter in variable names).
**answer**: The correct answer to the problem, given as a mathematical expression. If you precede a variable name in the problem with a dollar sign ($), you can include a script in the problem that computes the expression in terms of that variable.
**samples**: Specifies important information about the problem in four lists:
* **variables**: A set of variables that students can enter.
* **lower_bounds**: For every defined variable, a lower bound on the numerical tests to use for that variable.
* **upper_bounds**: For every defined variable, an upper bound on the numerical tests to use for that variable.
* **num_samples**: The number of times to test the expression.
Commas separate items inside each of the four individual lists, and the at sign (@), colon (:), and pound sign (#) characters separate the four lists. The format is the following:
``"variables@lower_bounds:upper_bounds#num_samples``
For example, a ``<formularesponse>`` tag that includes the **samples** attribute may look like either of the following.
``<formularesponse samples="x,n@1,2:3,4#10">``
``<formularesponse samples="R_1,R_2,R_3@1,2,3:3,4,5#10">``
Children
* ``<formulaequationinput />``
**Tag:** ``<formulaequationinput />``
Creates a response field where a student types an answer to the problem in plain text, as well as a second field below the response field where the student sees a typeset version of the plain text. The parser that renders the student's plain text into typeset math is the same parser that evaluates the student's response for grading.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - size (optional)
- Specifies the width, in characters, of the response field where students enter answers.
Children
(none)
**Tag:** ``<responseparam>``
Used to define an upper bound on the variance of the numerical methods used to approximate a test for equality.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - default (required)
- A number or a percentage specifying how close the student and grader expressions must be. Failure to include a tolerance leaves expressions vulnerable to unavoidable rounding errors during sapling, causing some student input to be graded as incorrect, even if it is algebraically equivalent to the grader's expression.
* - type
- "tolerance"--defines a tolerance for a number
Children
(none)
.. _Text Input Problem XML:
======================
Text Input Problem XML
======================
Template
--------
.. code-block:: xml
<problem>
<p>Problem text</p>
<stringresponse answer="**.Correct answer 1.**" type="ci regexp">
<additional_answer>Correct answer 2</additional_answer>
<additional_answer>Correct answer 3</additional_answer>
<textline size="20" label="label text"/>
<hintgroup>
<stringhint answer="Incorrect answer A" type="ci" name="hintA" />
<hintpart on="hintA">
<startouttext />Text of hint for incorrect answer A<endouttext />
</hintpart >
<stringhint answer="Incorrect answer B" type="ci" name="hintB" />
<hintpart on="hintB">
<startouttext />Text of hint for incorrect answer B<endouttext />
</hintpart >
<stringhint answer="Incorrect answer C" type="ci" name="hintC" />
<hintpart on="hintC">
<startouttext />Text of hint for incorrect answer C<endouttext />
</hintpart >
</hintgroup>
</stringresponse>
<solution>
<div class="detailed-solution">
<p>Explanation or Solution Header</p>
<p>Explanation or solution text</p>
</div>
</solution>
</problem>
Tags
----
* ``<stringresponse>``: Indicates that the problem is a text input problem.
* ``<textline>``: Child of ``<stringresponse>``. Creates a response field in the LMS where the student enters a response.
* ``<additional_answer>`` (optional): Specifies an additional correct answer for the problem. A problem can contain an unlimited number of additional answers.
* ``<hintgroup>`` (optional): Indicates that the instructor has provided hints for certain common incorrect answers.
* ``<stringhint />`` (optional): Child of ``<hintgroup>``. Specifies the text of the incorrect answer to provide the hint for. Contains answer, type, name.
* ``<hintpart>``: Contains the name from ``<stringhint>``. Associates the incorrect answer with the hint text for that incorrect answer.
* ``<startouttext />``: Indicates the beginning of the text of the hint.
* ``<endouttext />``: Indicates the end of the text of the hint.
**Tag:** ``<stringresponse>``
Indicates that the problem is a text input problem.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - answer (required)
- Specifies the correct answer. To designate the answer as a regular expression, add "regexp" to the **type** attribute. If you do not add "regexp" to the **type** attribute, the student's answer must match the value in this attribute exactly.
* - type (optional)
- Can specify whether the problem is case sensitive and allows regular expressions. If the ``<stringresponse>`` tag includes ``type="ci"``, the problem is not case sensitive. If the tag includes ``type="cs"``, the problem is case sensitive. If the tag includes ``type="regexp"``, the problem allows regular expressions. A **type** attribute in a ``<stringresponse>`` tag can also combine these values. For example, ``<stringresponse type="regexp cs">`` specifies that the prolem allows regular expressions and is case sensitive.
Children
* ``<textline />`` (required)
* ``<additional_answer>`` (optional)
* ``<hintgroup>`` (optional)
**Tag:** ``<textline />``
Creates a response field in the LMS where the student enters a response.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - label (required)
- Contains the text of the problem.
* - size (optional)
- Specifies the size, in characters, of the response field in the LMS.
* - hidden (optional)
- If set to "true", students cannot see the response field.
* - correct_answer (optional)
- Lists the correct answer to the problem.
Children
(none)
**Tag:** ``<additional_answer>``
Specifies an additional correct answer for the problem. A problem can contain an unlimited number of additional answers.
Attributes
(none)
Children
(none)
**Tag:** ``<hintgroup>``
Indicates that the instructor has provided hints for certain common incorrect answers.
Attributes
(none)
Children
* ``<stringhint>`` (required)
**Tag:** ``<stringhint>``
Specifies a common incorrect answer to the problem.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - answer (required)
- The text of the incorrect answer.
* - name (required)
- The name of the hint that you want to provide.
* - type
- Specifies whether the text of the specified incorrect answer is case sensitive. Can be set to "cs" (case sensitive) or "ci" (case insensitive).
Children
* ``<hintpart>`` (required)
**Tag:** ``<hintpart>``
Associates a common incorrect answer with the hint for that incorrect answer.
Attributes
.. list-table::
:widths: 20 80
* - Attribute
- Description
* - on
- The name of the hint. This must be the same as the **name** attribute of the ``<stringhint>`` tag. (The ``<stringhint>`` tag provides the name of the hint and the incorrect answer to associate with the hint. The ``<hintpart>`` tag contains the name of the hint and the text of the hint.)
Children
* ``<startouttext />`` (required)
* ``<endouttext />`` (required)
**Tags:** ``<startouttext />`` and ``<endouttext>``
Surround the text of the hint.
Attributes
(none)
Children
(none)
.. _Appendix F:
Files for the Example Custom JavaScript Display and Grading Problem
================================================================================
For the example :ref:`Custom JavaScript Display and Grading` problem, you need the following files. You can find
instructions for obtaining each
of these files below. After you obtain the files, add all of them to the **Files & Uploads** page in Studio.
- :ref:`webGLDemo.html`
- :ref:`webGLDemo.css`
- :ref:`webGLDemo.js`
- `three.min.js <http://threejs.org>`_
For the **webGLDemo.html**, **webGLDemo.js**, and **webGLDemo.css** files, copy the code provided
for each file into a text editor, and then save each file. Make sure to use the correct
file name extension when you save each file.
For the **three.min.js** library file, go to the `three.js home page <http://threejs.org>`_ page,
and then click **Download** in
the left pane. After the .zip file has finished downloading, open the .zip file, and then
open the **build** folder to access the **three.min.js** file.
.. note:: If you need to bypass the same-origin policy (SOP), you also need the
`jschannel.js <https://github.com/mozilla/jschannel/blob/master/src/jschannel.js>`_ file. On
the `jschannel.js <https://github.com/mozilla/jschannel/blob/master/src/jschannel.js>`_
web page, copy the code for the file into a text editor, and then save the file as **jschannel.js**.
.. _webGLDemo.html:
webGLDemo.html
--------------
If you **don't** need to bypass the SOP, use the following code.
::
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="webGLDemo.css">
<script src="three.min.js"></script>
<script src="webGLDemo.js" defer='defer'></script>
</head>
<body>
<div id="container"></div>
</body>
</html>
If you need to bypass the SOP, use the following code.
::
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="webGLDemo.css">
<script src="jschannel.js"></script>
<script src="three.min.js"></script>
<script src="webGLDemo.js" defer='defer'></script>
</head>
<body>
<div id="container"></div>
</body>
</html>
.. _webGLDemo.css:
webGLDemo.css
-------------
::
#container {
background-color: black;
width: 400px;
height:400px;
}
.. _webGLDemo.js:
webGLDemo.js
------------
::
var WebGLDemo = (function() {
var width = 400, height = 400;
var container, renderer, scene, camera, projector,
ambientlight, directionalLight,
cylinder, cube, nonSelectedMaterial, selectedMaterial;
// Revolutions per second
var angularSpeed = 0.5, lastTime = 0;
var state = {
'selectedObjects': {
'cylinder': false,
'cube': false
}
},
channel;
// Establish a channel only if this application is embedded in an iframe.
// This will let the parent window communicate with this application using
// RPC and bypass SOP restrictions.
if (window.parent !== window) {
channel = Channel.build({
window: window.parent,
origin: "*",
scope: "JSInput"
});
channel.bind("getGrade", getGrade);
channel.bind("getState", getState);
channel.bind("setState", setState);
}
function init() {
container = document.getElementById('container');
// Renderer
// First check if WebGL is supported. If not, rely on the canvas
// render and use a scene with less triangles as it is slow.
var testCanvas = document.createElement("canvas");
var webglContext = null;
var contextNames = ["experimental-webgl", "webgl", "moz-webgl",
"webkit-3d"];
var radiusSegments, heightSegments;
for (var i = 0; i < contextNames.length; i++) {
try {
webglContext = testCanvas.getContext(contextNames[i]);
if (webglContext) {
break;
}
}
catch (e) {
}
}
if (webglContext) {
renderer = new THREE.WebGLRenderer({antialias:true});
radiusSegments = 50;
heightSegments = 50;
}
else {
renderer = new THREE.CanvasRenderer();
radiusSegments = 10;
heightSegments = 10;
}
renderer.setSize(width, height);
renderer.setClearColor(0x000000, 1);
container.appendChild(renderer.domElement);
// Scene
scene = new THREE.Scene();
// Camera
camera = new THREE.PerspectiveCamera(45, width/height, 1, 1000);
camera.position.z = 700;
// Materials
unselectedMaterial = new THREE.MeshPhongMaterial({
specular: '#a9fcff',
color: '#00abb1',
emissive: '#006063',
shininess: 100
});
selectedMaterial = new THREE.MeshPhongMaterial({
specular: '#a9fcff',
color: '#abb100',
emissive: '#606300',
shininess: 100
});
if (!webglContext) {
unselectedMaterial.overdraw = 1.0;
selectedMaterial.overdraw = 1.0;
}
// Cylinder: bottomRadius, topRadius, height, segmentsRadius,
// segmentsHeight
cylinder = new THREE.Mesh(new THREE.CylinderGeometry(0, 100, 150,
radiusSegments,
heightSegments,
false),
unselectedMaterial);
cylinder.position.x = -125;
cylinder.overdraw = true;
scene.add(cylinder);
// Cube
cube = new THREE.Mesh(new THREE.CubeGeometry(120, 120, 120),
unselectedMaterial);
cube.position.x = 125;
cube.overdraw = true;
scene.add(cube);
// Ambient light
ambientLight = new THREE.AmbientLight(0x222222);
scene.add(ambientLight);
// Directional light
directionalLight = new THREE.DirectionalLight(0xffffff);
directionalLight.position.set(1, 1, 1).normalize();
scene.add(directionalLight);
// Used to select element with mouse click
projector = new THREE.Projector();
renderer.domElement.addEventListener('click', onMouseClick, false);
// Start animation
animate();
}
// This function is executed on each animation frame
function animate() {
// Request new frame
requestAnimationFrame(animate);
render();
}
function render() {
// Update
var time = (new Date()).getTime(),
timeDiff = time - lastTime,
angleChange = angularSpeed * timeDiff * 2 * Math.PI / 1000;
cylinder.rotation.x += angleChange;
cylinder.rotation.z += angleChange;
cube.rotation.x += angleChange;
cube.rotation.y += angleChange;
lastTime = time;
// Render
renderer.render(scene, camera);
}
function onMouseClick(event) {
var vector, raycaster, intersects;
vector = new THREE.Vector3((event.clientX / width) * 2 - 1,
-(event.clientY / height) * 2 + 1, 1);
projector.unprojectVector(vector, camera);
raycaster = new THREE.Raycaster(camera.position,
vector.sub(camera.position).normalize());
intersects = raycaster.intersectObjects(scene.children);
if (intersects.length > 0) {
if (intersects[0].object === cylinder) {
state.selectedObjects.cylinder = !state.selectedObjects.cylinder;
}
else if (intersects[0].object === cube) {
state.selectedObjects.cube = !state.selectedObjects.cube;
}
updateMaterials();
}
}
function updateMaterials() {
if (state.selectedObjects.cylinder) {
cylinder.material = selectedMaterial;
}
else {
cylinder.material = unselectedMaterial;
}
if (state.selectedObjects.cube) {
cube.material = selectedMaterial;
}
else {
cube.material = unselectedMaterial;
}
}
init();
function getGrade() {
// The following return value may or may not be used to grade
// server-side.
// If getState and setState are used, then the Python grader also gets
// access to the return value of getState and can choose it instead to
// grade.
return JSON.stringify(state['selectedObjects']);
}
function getState() {
return JSON.stringify(state);
}
// This function will be called with 1 argument when JSChannel is not used,
// 2 otherwise. In the latter case, the first argument is a transaction
// object that will not be used here
// (see http://mozilla.github.io/jschannel/docs/)
function setState() {
stateStr = arguments.length === 1 ? arguments[0] : arguments[1];
state = JSON.parse(stateStr);
updateMaterials();
}
return {
getState: getState,
setState: setState,
getGrade: getGrade
};
}());
.. _Working with Problems Index:
##########################
Working with Problems
##########################
.. toctree::
:maxdepth: 2
create_problem_component
common_problems
advanced_problems
specialized_problems
e
external_graders
open_response_assessment
tools
additional_tools
google_hangouts
f
g
.. _Specialized Problems:
Specialized Problems
====================
Specialized problems are advanced problems such as annotations. These problems are available through the Advanced component in Studio. To add the Advanced component to your course, you'll modify your course's advanced settings. The Advanced component then appears under **Add New Component** in each unit.
- :ref:`Annotation` Annotation problems ask students to respond to
questions about a specific block of text. The question appears above
the text when the student hovers the mouse over the highlighted text
so that students can think about the question as they read.
- :ref:`Word Cloud` Word clouds arrange text that students enter - for example, in response to a question - into a colorful graphic that students can see.
.. _ Add Advanced Component:
**Add the Advanced Component to Your Course**
By default, when you create a new component in Studio, you see the
following options.
.. image:: ../Images/AddNewComponent.png
:alt: Image of the Add a New Component panel
To create a specialized problem, you must first add the Advanced
component to your course. To do this, follow these steps.
#. On the **Settings** menu, click **Advanced Settings**.
#. On the **Advanced Settings** page, locate the **Manual Policy
Definition** section, and then locate the **advanced_modules**
policy key (this key is at the top of the list).
.. image:: ../Images/AdvancedModulesEmpty.png
:alt: Image of the Manual Policy Definition section of the Advanced Settings page
3. Under **Policy Value**, place your cursor between the brackets, and
then enter the value for the type of problem that you want to create.
Make sure to include the quotation marks, but not the period.
- For annotations, enter **"annotatable"**.
- For word clouds, enter **"word_cloud"**.
You can enter more than one problem type at a time. When you do,
make sure to surround each problem type with quotation marks and
separate each problem type with a comma, but do not include any
spaces.
For example, if you wanted to add annotations and word cloud problems in your course, you would enter
the following between the brackets.
::
"annotatable","word_cloud"
.. image:: ../Images/AdvSettings_Before.png
:alt: Image of the Manual Policy Definition section of the Advanced Settings page, with specialized problems added
4. At the bottom of the page, click **Save Changes**.
The page refreshes automatically. At the top of the page, you see a
notification that your changes have been saved.
The text in the **Policy Value** field now appears as follows.
.. image:: ../Images/AdvSettings_After.png
:alt: Image of the Manual Policy Definition section of the Advanced Settings page, with specialized problems added after saving
5. Return to the unit where you want to add the specialized problem. The
list of possible components now contains an Advanced component.
.. image:: ../Images/AdvancedComponent.png
:alt: Image of the Add a New Component panel with the Advanced component option
When you click the Advanced component, you can see **Annotation** and **Word cloud** in the list. More information about how to create each problem is provided in the page for that problem type.
.. _Annotation:
Annotation
----------
In an annotation problem, the instructor highlights specific text
inside a larger text block and then asks questions about that text. The
questions appear when students hover the mouse over the highlighted
text. The questions also appear in a section below the text block, along
with space for students' responses.
.. image:: ../Images/AnnotationExample.png
:alt: Image of an annotation problem
Create an Annotation Problem
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To create an annotation problem:
Add the Annotation advanced component. To do this, add the "annotatable"
key value to the **Advanced Settings** page. (For more information, see
the instructions in :ref:`Specialized Problems`.)
Add the **Instructions** and **Guided Discussion** segments of the
problem.
#. In the unit where you want to create the problem, click **Advanced**
under **Add New Component**.
#. In the list of problem types, click **Annotation**.
#. In the component that appears, click **Edit**.
#. In the component editor, replace the example code with your own code.
#. Click **Save**.
Add the **Annotation problem** segment of the problem.
#. Under the Annotation component, create a new blank Advanced Problem
component.
#. Paste the following code in the Advanced Problem component, replacing
placeholders with your own information.
::
<problem>
<annotationresponse>
<annotationinput>
<text>PLACEHOLDER: Text of annotation</text>
<comment>PLACEHOLDER: Text of question</comment>
<comment_prompt>PLACEHOLDER: Type your response below:</comment_prompt>
<tag_prompt>PLACEHOLDER: In your response to this question, which tag below
do you choose?</tag_prompt>
<options>
<option choice="incorrect">PLACEHOLDER: Incorrect answer (to make this
option a correct or partially correct answer, change choice="incorrect"
to choice="correct" or choice="partially-correct")</option>
<option choice="correct">PLACEHOLDER: Correct answer (to make this option
an incorrect or partially correct answer, change choice="correct" to
choice="incorrect" or choice="partially-correct")</option>
<option choice="partially-correct">PLACEHOLDER: Partially correct answer
(to make this option a correct or partially correct answer,
change choice="partially-correct" to choice="correct" or choice="incorrect")
</option>
</options>
</annotationinput>
</annotationresponse>
<solution>
<p>PLACEHOLDER: Detailed explanation of solution</p>
</solution>
</problem>
#. Click **Save**.
.. _Tools:
#############################
Working with Tools
#############################
***************************
Overview of Tools in Studio
***************************
In addition to text, images, and different types of problems, Studio allows you
to add customized learning tools such as word clouds to your course.
- :ref:`Full Screen Image`: The Full Screen Image tool allows a student to enlarge an image in the whole browser window. This is useful when the image contains a large amount of detail and text that is easier to view in context when enlarged.
- :ref:`LTI Component`: LTI components allow you to add an external learning application or textbook to Studio.
- :ref:`Word Cloud`: Word clouds arrange text that students enter - for example, in response to a question - into a colorful graphic that students can see.
- :ref:`Zooming image`: Zooming images allow you to enlarge sections of an image so that students can see the section in detail.
.. _Full Screen Image:
******************
Full Screen Image
******************
Some large images are difficult for students to view in the courseware. The full screen image tool allows students to enlarge the image, so they can see all the detail in context.
The Student View of a Full Screen Image
-----------------------------------------
The student sees the full screen image in a unit page. When the student hovers the mouse pointer over the image, the **Fullscreen** button appears:
.. image:: ../Images/image-modal.png
:alt: Image of the full screen image tool with the Full Screen button.
When the student clicks **Fullscreen**, the image opens and expands in the full browser window. The buttons **Close**, **Zoom In**, and **Zoom Out** appear:
.. image:: ../Images/image-modal-window.png
:alt: Image of the Image Modal tool with the Full Screen button.
The student can then zoom in on the image, and drag the image to view the desired part of it:
.. image:: ../Images/image-modeal-zoomed.png
:alt: Image of the Image Modal tool with the Full Screen button.
Create a Full Screen Image
---------------------------
#. Upload your image file to the **Files & Uploads** page. For more information about how to do this, see :ref:`Add Files to a Course`.
#. Under **Add New Component**, click **html**, and then click **Full Screen Image**.
#. In the new component that appears, click **Edit**.
#. In the component editor, replace the default title, remove the instructional paragraph, and add text as needed.
#. Switch to the **HTML** tab.
#. Replace the following placeholders with your own content.
* Replace the value of the <a> element's href attribute with the path to your image. Do not change the value of the class attribute. For example:
**<a href="/static/Image1.jpg" class="modal-content">**
* Replace the value of the <img> element's src attribute with the path to your image. For example:
**<img alt="Full screen image" src="/static/Image1.jpg"/>**
* Ensure that the value of the href and src attributes are the same, and that you do not change the class attribute. Your sample code should look like the following:
.. code-block:: xml
<h2>Sample Image Modal</h2>
<a href="/static/Image1.jpg" class="modal-content">
<img alt="Full screen image" src="/static/Image1.jpg"/>
</a>
.. note:: You can use this same HTML code in any HTML component, not just those components you created as full screen images.
#. Click **Save** to save the HTML component.
.. _LTI Component:
**************
LTI Components
**************
You may have discovered or developed an external learning application
that you want to add to your online course. Or, you may have a digital
copy of your textbook that uses a format other than PDF. You can add
external learning applications or textbooks to Studio by using a
Learning Tools Interoperability (LTI) component. The LTI component is
based on the `IMS Global Learning Tools
Interoperability <http://www.imsglobal.org/LTI/v1p1p1/ltiIMGv1p1p1.html>`_
version 1.1.1 specifications.
You can use an LTI component in two ways.
- You can add external LTI content that is displayed only, such as
textbook content that doesn’t require a student response.
- You can add external LTI content that requires a student response. An
external provider will grade student responses.
Before you create an LTI component from an external LTI provider in a
unit, you need the following information.
- The **LTI ID**. This is a value that you create to refer to the external LTI
provider. You should create an LTI ID that you can remember easily.
The LTI ID can contain uppercase and lowercase alphanumeric
characters, as well as underscore characters (_). It can contain any
number of characters. For example, you may create an LTI ID that is
as simple as **test_lti_id**, or your LTI ID may be a string of
numbers and letters such as **id_21441** or
**book_lti_provider_from_new_york**.
- The **client key**. This value is a sequence of characters that you
obtain from the LTI provider. The client key is used for
authentication and can contain any number of characters. For example,
your client key may be **b289378-f88d-2929-ctools.umich.edu**.
- The **client secret**. This value is a sequence of characters that
you obtain from the LTI provider. The client secret is used for
authentication and can contain any number of characters. For example,
your client secret may be something as simple as **secret**, or it
may be a string of numbers and letters such as **23746387264** or
**yt4984yr8**.
- The **launch URL** (if the LTI component requires a student response
that will be graded). You obtain the launch URL from the LTI
provider. The launch URL is the URL that Studio sends to the external
LTI provider so that the provider can send back students’ grades.
Create an LTI Component
-----------------------
Creating an LTI component in your course has three steps.
#. Add LTI to the **advanced_modules** policy key.
#. Register the LTI provider.
#. Create the LTI component in an individual unit.
Step 1. Add LTI to the Advanced Modules Policy Key
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#. On the **Settings** menu, click **Advanced Settings**.
#. On the **Advanced Settings** page, locate the **Manual Policy
Definition** section, and then locate the **advanced_modules**
policy key (this key is at the top of the list).
.. image:: ../Images/AdvancedModulesEmpty.png
:alt: Image of the advanced_modules key in the Advanced Settings page
#. Under **Policy Value**, place your cursor between the brackets, and
then enter **“lti”**. Make sure to include the quotation marks, but
not the period.
.. image:: ../Images/LTIPolicyKey.png
:alt: Image of the advanced_modules key in the Advanced Settings page, with the LTI value added
**Note** If the **Policy Value** field already contains text, place your
cursor directly after the closing quotation mark for the final item, and
then enter a comma followed by **“lti”** (make sure that you include the
quotation marks).
#. At the bottom of the page, click **Save Changes**.
The page refreshes automatically. At the top of the page,
you see a notification that your changes have been saved.
Step 2. Register the External LTI Provider
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To regiser the external LTI provider, you’ll add the LIT ID, the client
key, and the client secret in the **lti_passports** policy key.
#. On the **Advanced Settings** page, locate the **lti_passports**
policy key.
#. Under **Policy Value**, place your cursor between the brackets, and
then enter the LTI ID, client key, and client secret in the following
format (make sure to include the quotation marks and the colons).
::
“lti_id:client_key:client_secret”
For example, the value in the **lti_passports** field may be the following.
::
“test_lti_id:b289378-f88d-2929-ctools.umich.edu:secret”
If you have multiple LTI providers, separate the values with a comma.
Make sure to surround each entry with quotation marks.
::
"test_lti_id:b289378-f88d-2929-ctools.umich.edu:secret",
"id_21441:b289378-f88d-2929-ctools.school.edu:23746387264",
"book_lti_provider_from_new_york:b289378-f88d-2929-ctools.company.com:yt4984yr8"
#. At the bottom of the page, click **Save Changes**.
The page refreshes automatically. At the top of the page,
you see a notification that your changes have been saved, and you can
see your entries in the **lti_passports** policy key.
Step 3. Add the LTI Component to a Unit
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#. In the unit where you want to create the problem, click **Advanced**
under **Add New Component**, and then click **LTI**.
#. In the component that appears, click **Edit**.
#. In the component editor, set the options that you want. See the table
below for a description of each option.
#. Click **Save**.
.. list-table::
:widths: 10 80
:header-rows: 1
* - `Setting`
- Description
* - `Display Name`
- Specifies the name of the problem. This name appears above the problem and in
the course ribbon at the top of the page in the courseware.
* - `custom_parameters`
- Enables you to add one or more custom parameters. For example, if you've added an
e-book, a custom parameter may include the page that your e-book should open to.
You could also use a custom parameter to set the background color of the LTI component.
Every custom parameter has a key and a value. You must add the key and value in the following format.
::
key=value
For example, a custom parameter may resemble the following.
::
bgcolor=red
page=144
To add a custom parameter, click **Add**.
* - `graded`
- Indicates whether the grade for the problem counts towards student's total grade. By
default, this value is set to **False**.
* - `has_score`
- Specifies whether the problem has a numerical score. By default, this value
is set to **False**.
* - `launch_url`
- Lists the URL that Studio sends to the external LTI provider so that the provider
can send back students' grades. This setting is only used if **graded** is set to
**True**.
* - `lti_id`
- Specifies the LTI ID for the external LTI provider. This value must be the same
LTI ID that you entered on the **Advanced Settings** page.
* - `open_in_a_new_page`
- Indicates whether the problem opens in a new page. If you set this value to **True**,
the student clicks a link that opens the LTI content in a new window. If you set
this value to **False**, the LTI content opens in an IFrame in the current page.
* - `weight`
- Specifies the number of points possible for the problem. By default, if an
external LTI provider grades the problem, the problem is worth 1 point, and
a student’s score can be any value between 0 and 1.
For more information about problem weights and computing point scores, see :ref:`Problem Weight`.
.. _Word Cloud:
**********
Word Cloud
**********
In a word cloud exercise, students enter words into a field in response
to a question or prompt. The words all the students have entered then
appear instantly as a colorful graphic, with the most popular responses
appearing largest. The graphic becomes larger as more students answer.
Students can both see the way their peers have answered and contribute
their thoughts to the group.
For example, the following word cloud was created from students'
responses to a question in a HarvardX course.
.. image:: ../Images/WordCloudExample.png
:alt: Image of a word cloud problem
Create a Word Cloud Exercise
----------------------------
To create a word cloud exercise:
#. Add the Word Cloud advanced component. To do this, add the
"word_cloud" key value to the **Advanced Settings** page. (For more
information, see the instructions in :ref:`Specialized Problems`.)
#. In the unit where you want to create the problem, click **Advanced**
under **Add New Component**.
#. In the list of problem types, click **Word Cloud**.
#. In the component that appears, click **Edit**.
#. In the component editor, specify the settings that you want. You can
leave the default value for everything except **Display Name**.
- **Display Name**: The name that appears in the course ribbon and
as a heading above the problem.
- **Inputs**: The number of text boxes into which students can enter
words, phrases, or sentences.
- **Maximum Words**: The maximum number of words that the word cloud
displays. If students enter 300 different words but the maximum is
set to 250, only the 250 most commonly entered words appear in the
word cloud.
- **Show Percents**: The number of times that students have entered
a given word as a percentage of all words entered appears near
that word.
#. Click **Save**.
For more information, see `Xml Format of "Word Cloud" Module
<https://edx.readthedocs.org/en/latest/course_data_formats/word_cloud/word_cloud.html#>`_.
.. _Zooming Image:
******************
Zooming Image Tool
******************
You may want to present information to your students as an image. If your image is very large or very detailed, students may not be able to see all the information in the image. You can use the zooming image tool to enlarge areas of your image as the student moves the mouse over the image, as in the example below.
.. image:: ../Images/Zooming_Image.png
:alt: Example zooming image tool showing a chemistry exercise
Components of a Zooming Image Tool
----------------------------------
To create a zooming image tool, you need the following files.
* The image that you want students to see when they access the unit.
* The image that appears in the magnified area when a student clicks the regular image. This image may be larger than the regular image.
* The **jquery.loupeAndLightbox.js** JavaScript file. Every zooming image tool uses this JavaScript file, and you won't make any changes to it. `To download this file, right-click here <http://files.edx.org/jquery.loupeAndLightbox.js>`_, and then click **Save Link As** to save the file on your computer.
Create a Zooming Image Tool
---------------------------
#. Upload your regular-sized image file, your small image file, and the **jquery.loupeAndLightbox.js** file to the **Files & Uploads** page. For more information about how to do this, see :ref:`Add Files to a Course`.
#. Under **Add New Component**, click **html**, and then click **Zooming Image**.
#. In the new component that appears, click **Edit**.
#. In the component editor, replace the default problem text with your own text.
#. Switch to the **HTML** tab.
#. Replace the following placeholders with your own content.
- Replace the following file name and path with the name and path of the image that you want to appear magnified when the user hovers over the regular image.
**https://studio.edx.org/c4x/edX/DemoX/asset/pathways_detail_01.png**
For example, your file name and path may be **/static/Image1.jpg**.
- Replace the following file name and path with the name and path of the image that you want to appear when the page opens.
**https://studio.edx.org/c4x/edX/DemoX/asset/pathways_overview_01.png**
For example, your file name and path may be **/static/Image2.jpg**.
- Replace the following name and file path with the name and path of the JavaScript file for your course.
**https://studio.edx.org/c4x/edX/DemoX/asset/jquery.loupeAndLightbox.js**
Because you uploaded the **jquery.loupeAndLightbox.js** file to the **Files & Uploads** page, your file name and path is **/static/jquery.loupeAndLightbox.js**.
- (Optional) If you want the magnified area to be larger or smaller, change the **width** and **height** values from 350 to larger or smaller numbers. For example, you can change both numbers to 450. Or, if you want a horizontal oval instead of a circle, you can change the **width** value to a number such as 500 and the **height** value to a number such as 150.
The HTML in your zooming image tool may resemble the following.
.. image:: ../Images/ZoomingImage_Modified.png
:alt: Example HTML for a zooming image tool
#. Click **Save** to save the HTML component.
...@@ -7,5 +7,6 @@ Information for Your Students ...@@ -7,5 +7,6 @@ Information for Your Students
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
ora_students
login_guide login_guide
math_students
ora_students
.. _Math Response Formatting for Students:
#####################################
Math Response Formatting for Students
#####################################
In numerical input problems, the student's response may be more complicated than a
simple number. Expressions like ``sqrt(3)`` and even ``1+e^(sin(pi/2)+2*i)``
are valid, and evaluate to 1.73 and -0.13 + 2.47i, respectively.
The parser renders text that students enter into "beautiful math" that appears below the problem's response field:
.. image:: /Images/Math1.png
:alt: Image of a numerical input probem rendered by the parser
.. image:: /Images/Math2.png
:alt: Image of a numerical input probem rendered by the parser
.. image:: /Images/Math3.png
:alt: Image of a numerical input probem rendered by the parser
.. image:: /Images/Math4.png
:alt: Image of a numerical input probem rendered by the parser
.. image:: /Images/Math5.png
:alt: Image of a numerical input probem rendered by the parser
Students can enter any of the following into the response field.
*******
Numbers
*******
- Integers: '2520'
- Fractions: 2/3
- Normal floats: '3.14'
- With no integer part: '.98'
- Scientific notation: '1.2e-2' (=0.012)
- More scientific notation: '-4.4e+5' = '-4.4e5' (=-440,000)
- SI suffixes: '2.25k' (=2,250). The full list:
====== ========== ===============
Suffix Stands for Example
====== ========== ===============
% percent 0.01 = 1e-2
k kilo 1000 = 1e3
M mega 1e6
G giga 1e9
T tera 1e12
c centi 0.01 = 1e-2
m milli 0.001 = 1e-3
u micro 1e-6
n nano 1e-9
p pico 1e-12
====== ========== ===============
The largest possible number handled currently is exactly the largest float
possible (in the Python language). This number is 1.7977e+308. Any expression
containing larger values will not evaluate correctly, so it's best to avoid
this situation.
*********************
Default Constants
*********************
Simple and commonly used mathematical/scientific constants are included by
default. These include:
- ``i`` and ``j`` as ``sqrt(-1)``
- ``e`` as Euler's number (2.718...)
- ``g``: gravity (9.80 m/s^2)
- ``pi``
- ``k``: the Boltzmann constant (~1.38e-23 in Joules/Kelvin)
- ``c``: the speed of light in m/s (2.998e8)
- ``T``: the positive difference between 0K and 0°C (285.15)
- ``q``: the fundamental charge (~1.602e-19 Coloumbs)
**************
Greek Letters
**************
The parser automatically converts the following Greek letter names into the corresponding Greek characters:
.. 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.
****************************
Operators and Functions
****************************
* Use standard arithmetic operation symbols.
* Indicate multiplication explicitly by using an asterisk (*).
* Use a caret (^) to raise to a power.
* Use an underscore (_) to indicate a subscript.
* Use parentheses to specify the order of operations.
The normal operators apply (with normal order of operations):
``+ - * / ^``. Also provided is a special "parallel resistors" operator given
by ``||``. For example, an input of ``1 || 2`` would represent the resistance
of a pair of parallel resistors (of resistance 1 and 2 ohms), evaluating to 2/3
(ohms).
Currently, factorials written in the form '3!' are invalid, but
there is a workaround. Students can specify ``fact(3)`` or ``factorial(3)`` to
access the factorial function.
The default included functions are the following:
- Trig functions: sin, cos, tan, sec, csc, cot
- Their inverses: arcsin, arccos, arctan, arcsec, arccsc, arccot
- Other common functions: sqrt, log10, log2, ln, exp, abs
- Factorial: ``fact(3)`` or ``factorial(3)`` are valid. However, you must take
care to only input integers. For example, ``fact(1.5)`` would fail.
- Hyperbolic trig functions and their inverses: sinh, cosh, tanh, sech, csch,
coth, arcsinh, arccosh, arctanh, arcsech, arccsch, arccoth
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment