# Multiple choice

We will see the peculiarities of a Multiple choice type of question. A question of this type consists of a wording and a number of buttons in which the student selects one option (or several).

In our example, the question requests the calculation of the rank of a matrix with dimensions 3x4, and the answers proposed are always the integers 0 to 3 in a different order.

Moodle permits to determine if the student is allowed to insert several answers, or disorder or not the answers, as well as offering several types of numbers:

In this case, the options would not modify the creation of our question. To create a Multiple choice type of question, we will proceed as usual, typing the wording and referring to the matrix variable with the syntax #m.

Then, we must inform the system of all options that will be presented to the student for choosing the correct one. Logically, one of them must correspond to the correct answer and have a 100% grade.

The other answers must be informed and usually created in the WIRIS quizzes section. If we need an advanced management of grades, we can use the Override grade by field. The use of this field will force the omission of the values inserted in the Grade field, but we must have a grade with the value "100%", since, otherwise, Moodle, that is not conscious that those values are no longer useful, will consider we are not providing the student the possibility to achieve the best grade possible in this question.

In the Override grade by field we can insert a numeric value, but we usually want to insert the value of a variable, that can be of two types:

• Boolean, that is, true or false values
• a numeric value between 0 and 1, in which 1 is equivalent to true or best grade and 0 is equivalent to false or null grade

We can observe in the previous image that each question permits the introduction of student feedback. For more information on this functionality, see the corresponding section, Student feedback. The result will be as follows:

For completeness purposes, we will show and comment the calculations that are useful to complete this question:

We defined the a() function as a random value between -1 and 1, repeating the value 0 so that the proportion of zeros in the matrix is bigger and the rank is not so often 3. We use this a() function to create every element on the m matrix.

The sol variable will store the rank of the m matrix and the L list will contain the values between 0 and 3, except the correct answer. This is used to propose false answers to the student. We must observe that WIRIS working power with lists will be run in WIRIS quizzes section and cannot be extrapolated to Moodle fields: we cannot use the L elements if we do not name them before, and, as a consequence, the a, b and c variables, that simply designate the three elements in the L list.