<answer>
Attribute Examples Part 1
The following examples illustrate use of the <answer>
tag attributes.
Attributes
Attribute | Type | Values |
---|---|---|
allowedErrorInNumbers = "…" | number | |
allowedErrorIsAbsolute = "…" | boolean | "true" "false" |
caseInsensitiveMatch = "…" | boolean | "true" "false" |
creditByAttempt = "…" | numberList | |
disableAfterCorrect = "…" | boolean | "true" "false" |
disableWrongChoices = "…" | boolean | "true" "false" |
displayDigitsForCreditAchieved = "…" | integer | |
displayDigitsForResponses = "…" | integer | |
expanded = "…" | boolean | "true" "false" |
expandOnCompare = "…" | boolean | "true" "false" |
forceFullCheckworkButton = "…" | boolean | "true" "false" |
handGraded = "…" | boolean | "true" "false" |
includeErrorInNumberExponents = "…" | boolean | "true" "false" |
inline = "…" | boolean | "true" "false" |
matchBlanks = "…" | boolean | "true" "false" |
matchByExactPositions = "…" | boolean | "true" "false" |
matchPartial = "…" | boolean | "true" "false" |
maxNumAttempts = "…" | integer | |
numAwardsCredited = "…" | integer | |
numPeriodicSetMatchesRequired = "…" | integer | |
numSignErrorsMatched = "…" | number | |
parseScientificNotation = "…" | boolean | "true" "false" |
preserveLastChoice = "…" | boolean | "true" "false" |
selectMultiple = "…" | boolean | "true" "false" |
showCorrectness = "…" | "true" "false" | |
shuffleOrder = "…" | boolean | "true" "false" |
simplifyOnCompare = "…" | text | "none" "full" "numbers" "numberspreserveorder" |
splitSymbols = "…" | boolean | "true" "false" |
submitLabel = "…" | text | |
submitLabelNoCorrectness = "…" | text | |
symbolicEquality = "…" | boolean | "true" "false" |
type = "…" | ||
unorderedCompare = "…" | boolean | "true" "false" |
weight = "…" | number |
Example: disabled
The condition within the disabled
attribute is true
until the
user achieves credit for the first <answer>
.
The symbolicEquality
attribute was added to prevent mathematical operations
in the answer validation, so that, for example, 2-1
is not a correct
answer to the first question.
Example: weight
This example illustrates the use the weight
attribute
within an <answer>
. Use weight
to reduce or enhance the
proportion of total credit on the page obtained for a correct response to a
single <answer>
. By default, each <answer>
has an equal weight of .
Example: inline
For a multiple choice question, the inline
attribute causes the choices to displayed using an inline format.
Example: handGraded
The handGraded
attribute is applied when auto-grading is not possible or
preferred. The student’s responses are stored for future grading.
Example: matchPartial
When the matchPartial
attribute is applied, an automated partial
credit evaluation will be attempted, potentially giving credit between 0 and 1. Without the matchPartial
attribute, the response
must be completely correct before it receives credit.
The automated partial credit algorithm will attempt to break up logical conditions into pieces, look separately at components of vectors, and award partially matched choices.
More fine grained control can be obtained by adding multiple <award>
children to an <answer>
and giving
each <award>
a different credit
attribute.
For comparison of vectors, the attributes matchByExactPositions
and unorderedCompare
influence the partial credit algorithm.
Example: symbolicEquality
Note that you cannot repeat the original expression in the first question, and you cannot commute the terms in the second question.
For answer validation that is more liberal (but still stricter than the default numerical checker),
combine symbolicEquality
with the simplifyOnCompare
and expandOnCompare
attributes.
Example: forceFullCheckWorkButton
When an <answer>
has an input field inside it, it will, by default use a small checkwork button to the right of the
input field. To override this default and use the large button, add the forceFullCheckWorkButton
attribute.
An answer without an input field always uses the large button.
With the large button, it is also possible to customize the message on the button using the submitLabel
attribute.
Example: simplifyOnCompare
Specifying the symbolicEquality
attribute switches to a symbolic answer-checker that demands exact syntatical equality. The symbolic equality can be relaxed with the simplifyOnCompare
attribute.
The simplifyOnCompare
attribute has four options:
simplifyOnCompare="none"
: the default value of demanding exact equality.simplifyOnCompare="full"
(or simplysimplifyOnCompare
by itself): apply currently available simplification routines before checking. Does not include expanding factored expressions.simplifyOnCompare="numbers"
: simplify numerical expressions like1+2
but not algebraic expressions. Permute terms and factors into a canonical order before checking equality.simplifyOnCompare="numbersPreserveOrder"
: simplify numbers but without permuting terms or factors.
To include expansion of factored expressions, you can add the expandOnCompare
attribute.
Example: expandOnCompare
The default comparison is a numerical answer-checker with a liberal definition of equality.
Specifying the symbolicEquality
attribute switches to a symbolic answer-checker
that demands exact syntactical equality. The symbolic equality can be relaxed with
the simplifyOnCompare
attribute. To expand factor expressions prior to comparison, you should also include the expandOnCompare
attribute.
Example: unorderedCompare
When multiple values are compared within a single <answer>
tag, the
default behavior is to match the order of the sequenced values. If order is
irrelevant, use the unorderedCompare
attribute.
unorderedCompare
can be used with list components (e.g., <mathList>
, <numberList>
,
and <textList>
) as well as the <math>
component containing a list (e.g, ), tuple
(e.g., ) or array (e.g., ).
Alternatively, and for more control over what is ordered, one can add the unordered
attribute
directly to a list component or a <math>
, which will cause an unordered comparison
to be used when comparing it to anything else.
Example: matchByExactPositions
The attribute matchByExactPositions
influences how the matchPartial
calculates partial
credit involving vectors, lists, and related quantities. Without matchByExactPositions
,
the vectors and would be deemed by matchPartial
to have a 67% match, as
both contain the sequence , even though no components match. With matchByExactPositions
,
they would have a 0% match, as none of the first, second or third coordinates match.
In general, for a comparison of vectors, one would want to include matchByExactPositions
along
with matchPartial
to give partial credit only for matches in a coordinate. For comparing
ordered lists, matchByExactPositions
may not be desired.
matchByExactPositions
implies an ordered comparison, so attributes like unorderedCompare
and unordered
are ignored.
Example: numAwardsCredited
By default, if an <answer>
has multiple <award>
children, only a single
award will be credited. If multiple awards match, then the award with the largest credit
will be chosen (with order in the document breaking ties).
The behavior can be changed by setting the numAwardsCredited
attribute to an
integer larger than the default of 1. If numAwardsCredited="2"
, then up to two <award>
s can
be matched, and the credit achieved will the sum of their corresponding credits (up to a maximum of 1).
Combining multiple <award>
s with numAwardsCredited
can be an approach for
assigning partial credit based on different required aspects of the answer.