Overview
Dynamic questions are a feature of OLI that allow a question to vary its content each time a student views the question.
Any portion of the question, including the body, choices, correct answer, feedback, and even hints can vary in a dynamic question.
Core concepts
To create a dynamic question a course author defines a set of variables and then references these variables in the question.
Variables are defined in a script associated with a question.
When the OLI system goes to present a dynamic question to a student, the system first runs the script associated with the question in order to generate the contents of the variables. OLI then substitutes the actual values of the variables in the locations in the question where they are referenced, and then the question is presented to the student.
A simple example
While dynamic questions can be used in any type of course material they are particularly effective in courses that have a computational aspect (e.g. mathematics, sciences). In these types of courses dynamic questions can be used to vary the numbers, or inputs, present in questions that ask a student to perform some type of calculation.
Consider the following two choice, multiple-choice question that attempts to assess a student's understanding of basic addition.
What does 1 + 2 equal?
A) 3
B) 4
This question could be made to be dynamic by substituting the hard-coded numbers with variables, and by supplying a script to populate those variables.
For instance:
What does @@A@@ + @@B@@ equal?
A) @@correct@@
B) @@distractor@@
The above snippet replaces all four hard-coded values with variable references (the @@ delimited text).
Finally, take a look at the corresponding script to see how the variables referenced above are defined:
const A = OLI.random(1, 101); // Random number between 1 (inclusive) and 101 (exclusive)
const B = OLI.random(1, 101);
const correct = A + B;
const distractor = (A + B) + 1;
module.exports = {
A,
B,
correct,
distractor
};
Don't pay too much attention to the details in the above script, the rest of this
documentation will cover scripts more deeply, but rather
just try to get a sense of what it accomplishes. The script defines four variables,
A
, B
, correct
, and distractor
. Both A
and B
are defined to be random numbers
between 1 and 100. The variable correct
is defined to be the sum of A
and B
, and
the variable distractor
is defined to be an off by one error value.
Even this simple example question illustrates the power of dynamic questions. By defining one dynamic question we have allowed the system the ability to display 10,000 different question combinations (10,000 = 100 * 100).