OLI Dynamic Questions

OLI Dynamic Questions

  • Docs
  • API
  • Examples
  • Help

›Creating Questions

Getting Started

  • Overview
  • Requirements

Creating Questions

  • Workflow
  • Referencing Variables

Writing Scripts

  • Script Basics
  • Built-In Functions
  • Third-Party Libraries

Workflow

The following set of steps describe the workflow for creating, authoring, and testing dynamic questions.

1. Create a question

Inside of a question pool, create a new instance of any type of question (e.g. multiple-choice, ordering, drag and drop, etc.).

Create a question

2. Author the question content

After creating the base question, customize it by entering in the static and dynamic content. The places in the content that need to vary must reference a variable. Variable references need to be delimited with a @@ at the beginning and the end. For instance, the following screen shot shows a simple dynamic question with a few pieces of dynamic content:

Add dynamic content

3. Define the variables

Now that variables have been referenced by portions of the question, the variables need a definition. To access the variable definition editor, click the Create Variables button:

Create variables

Then author the script to define the variables that were referenced in step 2. The only required part of a script is the module.exports section that exposes the defined variables to OLI.

Variable editor example

4. Test the variable definitions

Clicking Run will execute the script to test the variable definitions.

Run button

Because of the probabilistic nature of most dynamic questions, the Run feature evaluates variable definitions multiple times behind the scenes and reports back if even one of those evaluations fails.

Error example

5. Preview the question

The course editor does not yet support previewing of dynamic questions. It is on the development team's radar and will be supported soon.

← RequirementsReferencing Variables →
  • 1. Create a question
  • 2. Author the question content
  • 3. Define the variables
  • 4. Test the variable definitions
  • 5. Preview the question
OLI Dynamic Questions
Docs
Getting StartedWriting Scripts
Community
Course Showcase (Coming soon)OLI Slack
More
OLIOLI Course EditorGitHubStar
Copyright © 2025 Carnegie Mellon University