Assessment Development
Multiple-Choice Problem
The following template code can be used as a recommended starting point for developing a Multiple-Choice Problem. It includes the following standard modifications:
Application of standardized CSS stylesheet (green box highlight).
Four choices instead of three, with the correct choice listed at the top instead of the middle so that it is easy to identify the correct choice.
Shuffle choices turned on.
A prompt for students to select the best answer.
Switch the Multiple-Choice Problem to used the Advanced Editor, then overwrite the standard HTML code with the following:
<problem>
<div class="edx_problem">
<multiplechoiceresponse>
<p>You can use this template as a guide to the simple editor markdown and OLX markup to use for multiple choice problems. Edit this component to replace this template with your own assessment.</p>
<label>Add the question text, or prompt, here. This text is required.</label>
<description>Select the best answer.</description>
<choicegroup type="MultipleChoice" shuffle="true">
<choice correct="true">the correct answer</choice>
<choice correct="false">an incorrect answer</choice>
<choice correct="false">an incorrect answer</choice>
<choice correct="false">an incorrect answer</choice>
</choicegroup>
</multiplechoiceresponse>
</div>
</problem>
Custom Python-Evaluated Input
The following template code can be used as a recommended starting point for developing a Custom Python-Evaluated Input problem.
<problem>
<div class="edx_problem">
<p>
You can use script tag format or answer tag format to create these problems.
</p>
<customresponse cfn="check_submission" expect="20">
<script type="loncapa/python">
def check_submission(expect, ans):
feedback = {'overall_message' : "",
'input_list': [
{'ok': False, 'msg' : ""},
{'ok': False, 'msg' : ""},
{'ok': False, 'msg' : ""},
]}
try:
if ans[0] == "6" :
feedback['input_list'][0]['ok'] = True
if ans[1] == "2" :
feedback['input_list'][1]['ok'] = True
if ans[2] == "3" :
feedback['input_list'][2]['ok'] = True
return feedback
except ValueError:
return False
</script>
<label>Enter the pin numbers on the 741 op amp for the corresponding functions.</label>
<textline size="20" label="Enter pin number for output:" /><br/>
<textline size="20" label="Enter pin number for inverting input:" /><br />
<textline size="20" label="Enter pin number for non-inverting input:" />
</customresponse>
</div>
</problem>
Check Function
For each <customresponse>
field, a check function is specified. The name of the check function is specified as the cfn
parameter of the <customresponse>
tag.
<customresponse cfn="check_answer">
<script type="loncapa/python">
def check_answer(expect, ans) :
...
</script>
...
</customresponse>
The ans
parameter of the check function is either a single value or a list, if there are more than one fields for the student to submit.
The check function of the Python-Evaluated Input Problem can return different types of responses. See the documentation for more details: https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/open-release-koa.master/exercises_tools/custom_python.html#the-check-function
Formula Equation Input
The formula equation input field is an input field that provides immediate feedback to the user on how the input has been parsed/interpreted.
<formulaequationinput size="40" default="Number"/>
Text Input
<textline size="20"/>
Trailing Text
This is to place text after (to the right of) an entry field. Add a trailing_text
attribute to the input field. If the LateX engine is enabled, LateX formatted text can be used.
<formulaequationinput size="40" default="Number" trailing_text="\(\frac{N}{C}\)"/>