By the use of some HTML-code, the range of question types that can take advantage of parameterisation can be extended.
How to parameterise a multiple-choice question
Within a multiple-choice question, Python code can be used to use variables in the answer options.
Below, is a simple script to generate a right and a wrong answer. You could, for example, modify this so that the keyed response is the correct calculation of a parameterised variable and the detractors are based on the incorrect application of a formula to that variable. Each student could see a different combination of keyed responses and detractors.
Step 1. Add the following code to the code editor
- Click New exercise and fill in a title.
- Click more_horiz-icon and select Script editor. A modal will open.
- You can write your code in the black input field. Fill in the answer as the Keyed_Response variable and fill in the wrong answer options in the All_Detractors list.
- Click Run and the code will be tested.
- Click Save.
Step 2. Add the answer options
- Click New question and select Multiple choice.
- Fill in the question and click Add choice.
- Click the create-icon at the right and a text-field will pop-up.
- Click the <>-icon and you can write some code.
- Click Save and a blue box with the name of the variable will be added.
Inserting parameters can be done with the following question types
|Question type||Question field||Answer field|
|Open question||Yes||Not applicable|
|Numerical question||Yes||Yes (as insert variable)|
|Mathematical question||Yes||Not applicable|
|Code editor||Yes||Not applicable|
|Fill-in question||Yes||Yes (as insert variable, but can’t parametrise the answers)|
|File upload||Yes||Not applicable|
|Hotspot match||Yes||Not applicable|