In this type of exercise, you can define a number of options and a number of categories. The student needs to drag all options to the correct category. An example is the following:
The categories in this example are “linear functions” and “quadratic functions”, and the six options are listed above. The solution looks as follows:
As you see in the example, you can create options that belong to neither of the categories. It is also possible to create options that are allowed in two or more categories:
Here, the word “fall” will be marked as correct in either of the categories.
Adding options and categories
To make this exercise, we first define all options. We do this by going to the “Texts” tab on the “Edit exercise” page. Then click on “+Add” -> “New option” to add an option. The options from the first exercise above look as follows:
When a student opens the exercise, all options are displayed in a random order.
Now we need to define the categories and the correct solution to the exercise. To do this, we need to write the following code in the input area text field for every category:
#col(name of category ; options in this category)#
Where “options in this category” are the numbers of the options we just defined that are part of this category, with semicolons (;) as separators. The example exercise from above looks as follows:
Note that option 6 is missing, since “sine wave” is not part of any of the two categories.
Layout
Since the two #col(...;...)#
functions are written on the same line, they will be displayed next to each other as in the example exercise above. If we write every col function on a new line, the categories will be displayed below each other:
Feedback
It is not possible to implement tailored feedback in these exercises. The only feedback that is given is that correctly placed items are marked green and wrongly placed items are marked red, as in the example below:
Variables
It is possible to use variables to randomise options. For example, we can use variables $a -> rand(1,9)
and $b -> rand(1,9)
to randomise option 1, which would become #f(x)=$a \cdot x + $b#
instead of #f(x)=3 \cdot x + 4#
. (Note: rand(1,9) returns a random integer between 1 and 9).
It is also possible to randomise the correct options per category. Take for example option 4, which is #g(x)=x^2#
. We could make a variable $c -> rand(1,3)
and change option 4 to #g(x)=x^($c)#. If $c=1, this option should be in the category “linear functions”, if $c=2 it should be in “quadratic functions” and if $c=3 it should be in neither categories. We then need to make three new variables $d, $e and $f:
For example: $d returns 4 if $c=1 and it is empty if $c has a different value. For more information about the definitions of variables $d through $f, see the article about ternary PHP operators.
The input area should then look as follows:
To make this possible, empty strings and the number 0 are ignored in the col function. For more information on this, see the authoring manual.