Single Select Problem OLX Reference#
Note
You can also set attributes and options by adding a <script>
element.
For more information, see Using the Script Element.
Template#
<problem>
<multiplechoiceresponse>
<label>Question or prompt text</label>
<description>Optional information about how to answer the question</description>
<choicegroup type="MultipleChoice">
<choice correct="false" name="a">Incorrect choice
<choicehint>Hint for incorrect choice.</choicehint>
</choice>
<choice correct="true" name="b">Correct choice
<choicehint>Hint for correct choice.</choicehint>
</choice>
</choicegroup>
<solution>
<div class="detailed-solution">
<p>Optional header for the explanation or solution</p>
<p>Optional explanation or solution text</p>
</div>
</solution>
</multiplechoiceresponse>
<demandhint>
<hint>Hint 1</hint>
<hint>Hint 2</hint>
</demandhint>
</problem>
Elements#
For single select problems, the <problem>
element can include this
hierarchy of child elements.
<multiplechoiceresponse>
<label>
<description>
<choicegroup>
<choice>
<choicehint>
<solution>
<demandhint>
<hint>
In addition, standard HTML tags can be used to format text.
<multiplechoiceresponse>
#
Required. Indicates that the problem is a single select problem.
Attributes#
Attribute
Description
partial_credit
Optional. Specifies that the problem can award partial credit. If used, must be set to
"points"
.
targeted-feedback
Optional. Set to targeted-feedback=”” if using targeted feedback. Otherwise, do not add this attribute.
Children#
<label>
<description>
<choicegroup>
<solution>
<label>
#
Required. Identifies the question or prompt. You can include HTML tags within this element.
Attributes#
None.
Children#
None.
<description>
#
Optional. Provides clarifying information about how to answer the question. You can include HTML tags within this element.
Attributes#
None.
Children#
None.
<choicegroup>
#
Required. Indicates the beginning of the list of answer options.
Attributes#
Attribute |
Description |
---|---|
|
Required. Must be set to |
|
Optional. See Shuffle Answers.
When set to |
|
Optional. See Answer Pools. Set a numerical value to indicate the number of answers to show to learners. |
Children#
<choice>
<choice>
#
Required. Lists an answer option.
Attributes#
Attribute |
Description |
---|---|
|
Indicates a correct, incorrect, or partially correct answer.
You can specify more than one correct or partially correct answer, but learners can select only one choice to submit as their answer. |
|
When |
|
A unique name that is used internally to refer to the choice. |
|
Optional. See Shuffle Answers.
When set to |
|
Optional. See Targeted Feedback.
Links this answer to the corresponding |
Children#
<choicehint>
<choicehint>
#
Optional. Specifies feedback for the answer.
Attributes#
None.
Children#
None.
<solution>
#
Optional. Identifies the explanation or solution for the problem, or for one of the questions in a problem that includes multiple questions.
This element contains an HTML division <div>
. The division contains one or
more paragraphs <p>
of explanatory text.
Attributes#
Attribute |
Description |
---|---|
|
Optional. See Targeted Feedback.
Links this answer to the corresponding |
<demandhint>
#
Optional. Specifies hints for the learner. For problems that include multiple questions, the hints apply to the entire problem.
Attributes#
None.
Children#
<hint>
<hint>
#
Required. Specifies additional information that learners can access if needed.
Children#
None.
<targetedfeedbackset>
#
Optional. Groups a set of targeted feedbacks that assist learners. See Targeted Feedback.
Attributes#
None.
Children#
<targetedfeedback>
<targetedfeedback>
#
Optional. Specifies targeted feedback shown automatically to learners. This element
contains an HTML division <div>
. The division contains one or more paragraphs
<p>
of explanatory text. See Targeted Feedback.
Attributes#
Attribute |
Description |
---|---|
|
Optional. See Targeted Feedback.
Links this answer to the corresponding |
<solutionset>
#
Optional. Groups a set of explanations that assist learners. See Answer Pools.
Attributes#
None.
Children#
<solution>
<solution>
#
Optional. Specifies the explanation shown to learners for a given answer. This
element contains an HTML division <div>
. The division contains one or more
paragraphs <p>
of explanatory text. See
Answer Pools.
Attributes#
Attribute |
Description |
---|---|
|
Optional. See Answer Pools.
Links this answer to the corresponding |
Using the Script Element#
You can use the <script>
element to programmatically set attributes and
options for your single select problems. You could use this feature to
display different questions/answers depending on variable factors, like time of
day, or randomly generated numbers.
You must use the advanced editor to configure a
<script>
element.
The contents of the <script>
element must be enclosed in <![CDATA[
…
]]>
markers, to indicate that the enclosed code should not be interpreted
as XML.
The code in the <script>
element is run on the server before the problem is
shown to learners. Note that only Python script types are supported.
The following OLX example uses random numbers to generate different answer choices for each learner, and mathematical operators to determine each choice’s correctness.
<problem>
<script type="text/python">
<![CDATA[
random.seed(anonymous_student_id) # Use different random numbers for each student.
a = random.randint(1,10)
b = random.randint(1,10)
c = a + b
ok0 = c % 2 == 0 # check remainder modulo 2
text0 = "$a + $b is even"
ok1 = c % 2 == 1 #check remainder modulo 2
text1 = "$a + $b is odd"
]]>
</script>
<multiplechoiceresponse>
<label>Is $a+$b even or odd? Select the true statement.</label>
<choicegroup type="MultipleChoice">
<choice correct="$ok0">$text0 ... (should be $ok0)</choice>
<choice correct="$ok1">$text1 ... (should be $ok1)</choice>
</choicegroup>
</multiplechoiceresponse>
</problem>
Note
After saving a block with scripts, you’ll see an error on the block in your unit if your script cannot be executed. One common error is the indentation error. The script must start on no indentation regardless of the indentation of the previous line.
See also
About Single Select Problems (concept)
Add a Single Select Problem (how to)
Award Partial Credit in a Multiple Choice Problem (how to)
Edit Single Select Problems using the Advanced Editor (how to)
Maintenance chart
Review Date |
Working Group Reviewer |
Release |
Test situation |