Skip to content
Classroom

Question Parts

Every question in Varsity Learning is built from several distinct sections. Understanding the structure helps you write questions efficiently and control exactly what students see.

Question Structure Overview

Question
├── Setup code (randomization, calculations)
├── Question text (displayed to student)
├── One or more answer parts
│   ├── Answer template (input field type)
│   ├── Correct answer (evaluated server-side)
│   └── Per-part tolerance / scoring settings
├── Hint text (optional, shown on request)
└── Solution text (optional, shown after submission)

Setup Code

The setup block runs before the question is displayed. Use it to: - Generate random values - Compute derived quantities - Define variables used in the question text and answer

$a = randint(2, 9);
$b = randint(1, 5);
$ans = $a + $b;

Variables defined here are available in all other parts of the question using $variablename.

Question Text

Written in a mix of HTML and AsciiMath. Use backticks to delimit inline math:

<p>Find the sum of `$a` and `$b`.</p>

For display math (centered, larger), use double backticks or wrap in a <div>:

<p>Evaluate: ``\frac{$a}{$b}``</p>

Answer Parts

Each answer part defines one input field. A question can have multiple parts (e.g., Part a, Part b).

For each part, you configure: - Answer type — number, string, multiple choice, etc. (see Question Types) - Correct answer — the value or expression the student must match - Tolerance — how close a numeric answer must be (absolute or relative) - Score weight — how many points this part is worth

Hint Text

Optional. Shown when a student clicks "Show Hint." Write guidance without giving away the answer:

<p>Try substituting `$a` into the formula first.</p>

Solution Text

Optional. Shown after a student submits (depending on the assessment's feedback settings). Write a full step-by-step solution:

<p>Step 1: Identify the values: `a = $a`, `b = $b`.</p>
<p>Step 2: Add them: `$a + $b = $ans`.</p>

Conditional Content

You can show different text based on the random values chosen:

if ($a > 5) {
    $scenario = "large";
} else {
    $scenario = "small";
}

Then reference $scenario in the question text to adapt the wording.

Testing Your Question

Use the Preview button while editing to see how the question renders for a student. Use Randomize to generate a different set of random values and verify the question works correctly across the range of possible inputs.