Skip to content
Classroom

Common Question Options

These options are shared across question types, but most of them are not panel settings. Tolerance, hints, feedback, part weights and answer-box display are variables you set in the question's code (the Common Control box), for example $reltolerance = 0.001. Extra credit, and whether students may get a similar question, are set per question in the assessment, not in the question itself. Options apply only where they make sense: a tolerance means nothing to a multiple-choice question.

Tolerance (Numeric Questions)

For questions with numeric answers, set how close the student's answer must be to the correct answer:

  • Absolute tolerance: $abstolerance = 0.001 accepts answers within ±0.001 of the correct value
  • Relative tolerance: $reltolerance = 0.001 accepts answers within 0.1% of the correct value. Write a decimal fraction, never a percent sign. 0.1% is a syntax error that breaks the whole code block, and "0.1%" is read as 0.1, a 10% tolerance.

If you set neither, a relative tolerance of 0.0015 applies.

Set $abstolerance = 0 to require the exact value. This does not require a particular form: with an answer of 1/2, a student who types 0.5 is still marked correct. To require a fraction, use the Calculated type with $answerformat = "fraction" (or "reducedfraction").

Hints

Hints are optional text, set as the array $hints in Common Control and released by try number. $hints[0] shows before the first try, $hints[1] after one incorrect try, and so on; the last hint stays up after that. There is no "Show Hint" button. The hint appears wherever you place $hintloc in the question text (the engine wraps it in its own paragraph with a "Hint:" label), and only if hints are turned on in the assessment, either for all its questions or for this one. Write hints that guide without giving away the answer.

Common Control — setup:

$a,$b = diffrands(2,9,2)
$hints = array("", "Start by factoring the numerator: `$a x^2 + $b x`")

Question Text:

<p>Simplify `($a x^2 + $b x)/x`.</p>
$hintloc

Reading a hint costs nothing. But hints unlock only after incorrect tries, so a student has to spend tries to see the later ones.

Feedback

There is no separate feedback field. Feedback is built in the control code with a getfeedback* macro. The macro returns a block of HTML (with a correct/incorrect icon) that you place in the question text, and it appears once the student has submitted. See Feedback Macros.

  • Right/wrong feedback: getfeedbackbasic($correct, $wrong, $thisq) shows one message for a correct answer and another for an incorrect one
  • Answer-specific feedback: getfeedbacktxt (multiple choice), getfeedbacktxtnumber (number), getfeedbacktxtcalculated (calculated) and getfeedbacktxtnumfunc (function) show a message tied to the particular answer the student gave
  • Solution text: the worked solution in the question's Detailed Solution box. It is shown with the answer (when the assessment's show-answers setting allows) only if the question's solution options enable that. If the solution is also marked for use as help, and the assessment is set to show written examples, students can open it as a "Written Example" while they are still working.

Feedback uses the same HTML/AsciiMath notation as question text. Use backticks for inline math.

Partial Credit

For questions with multiple answer parts, each part can have its own point weight. The student earns the fraction of points corresponding to the parts they answer correctly.

Display Options

  • $ansprompt: text shown immediately before the answer box (e.g., $ansprompt = "x = ")
  • $answerboxsize: width of the answer box in characters (default 20). Widen it for long expressions.

There is no units-label option. To show a unit after the box, write it in the question text after the box (e.g., $answerbox meters). Do not use $answerformat = "units" for this: it makes the student type the units and grades them.

Required vs. Optional

By default, all questions in an assessment are required. To make a question extra credit, tick Count as extra credit? in that question's settings within the assessment (the checkbox is not offered for a question inside a question group). Extra-credit questions add points but do not increase the total possible.

Randomization Scope

Random values belong to a question version, not to a try. Every try a student makes on one version uses the same values, so a student who answers wrongly and tries again sees the same numbers. New values appear only with a new version:

  • Get a similar question: in an assessment submitted question by question, the student can ask for a new version, up to the assessment's limit. Each question in the assessment can turn this off (listed as "No try similar").
  • A new assessment attempt: retaking the assessment normally generates new versions of all questions.

Assessment settings can also give every student the same version, use one random seed for all questions, or restrict a question to a fixed list of seeds.