Multiple Answer¶
Answer type: multans
The student ticks every option that applies — one or several. Ticking nothing scores 0 whenever at least one option is correct; if no option is correct, leave $answers empty and the engine adds a "None of these" option for the student to tick. It adds nothing if an option's text already contains "none of"; in that case put that option's index in $answers.
The minimum¶
$questions holds the options; $answers holds the indices of all correct ones.
Common Control:
$questions = array("2", "3", "4", "5", "6")
$answers = "1,3"
$answers, plural
Multiple Choice uses $answer with a single index. This type uses
$answers with a comma-separated string of them, such as "1,3" — not
an array, which the engine silently ignores. $answer is accepted as a
fallback in the same string form, but write $answers — it makes the
difference from Multiple Choice visible at a glance.
Options¶
| Variable | Effect |
|---|---|
$questions |
the list of options — required, must be an array |
$answers |
indices of the correct options as a comma-separated string, e.g. "1,3" — an array is ignored. If empty, the engine adds a "None of these" option and makes it the only correct answer |
$noshuffle |
which options stay put — same values as Multiple Choice |
$displayformat |
layout of the option list |
$scoremethod |
how partial credit is apportioned |
$scoremethod¶
Decides what a partly-right selection earns.
| Value | Effect |
|---|---|
| (not set) | each option is worth 1/n of the score (n = number of options); every wrong tick and every missed correct option loses that share |
"answers" |
every wrong tick or missed correct option loses 1/k (k = number of correct options), floored at 0 |
"allornothing" |
full marks only for an exactly correct selection |
"takeanything" |
full marks for any selection with at least one option ticked |
Set it deliberately: with several options these produce very different score distributions, and the difference is invisible to the student unless the question text says so.
Example¶
Common Control — setup:
$questions = array("2", "3", "4", "5", "6", "7")
$correct = array(0, 1, 3, 5) // the primes
Question Text:
<p>Select <strong>all</strong> of the following that are prime.</p>
Common Control, continued — answer and options:
$answers = arraytolist($correct)
$scoremethod = "answers"
See Also¶
- Multiple Choice — exactly one correct option
- Matching — pairing two lists
- Common Options — hints and shared display options