Formules: Cases de saisie

De MoodleDocs
Aller à :navigation, rechercher

Remarque : la traduction de cette page n'est pas terminée. N'hésitez pas à traduire tout ou partie de cette page ou à la compléter. Vous pouvez aussi utiliser la page de discussion pour vos recommandations et suggestions d'améliorations.


Answer box placeholders

Answer box placeholders provide a simple way to arrange the answer boxes in the part's text. It is particularly useful when the subquestion requires more than one answer. This flexibility allows you to arrange the answer boxes in the form of a matrix, coordinates, embedding into the question text or any other way you want.

There are two answer box types: the quantity box and the unit box. The placeholder names are _0 for the first quantity box, _1 for the second quantity box, etc, and _u for the unit box. The number of placeholder names that can be used is the same as the number of elements entered in the answer field, plus one if the unit is specified.

Example

A subquestion that has two elements in the answer field and a common unit:

General
  Question name !      Two quantity and one unit answer boxes
Main question
  Question text !      Using answer box placeholders
                       Given: Point A is at position x = 100 mm and y = 200 mm.
Part 1
  Part's mark*         1
  Answer type          Number
  Answer*              [100, 200]
  Grading criteria*    Absolute error == 0
  Unit                 mm
  Part's text          Question: What are the coordinates of point A? The answer must be given as follows: '(x,y) unit'.
                       A(x,y) = ({_0},{_1}) {_u}

The formulas question should look like this:

Fichier:FormulasDocumentation03a.png

Play it   Login info  (Open in new tab: Ctrl+Shift+Click)

Each answer box placeholder can only be used once in a part. For example, none of the following will be accepted:

  Part's text          {_0}{_0}             Comment: {_0} can not be used twice

  Part's text          {_0}{_1}{_1}         Comment: {_1} can not be used twice

  Part's text          {_0}{_u}{_1}{_u}     Comment: {_u} can not be used twice

  Part's text          {_3}{_3}             Comment: {_3} can not be used twice

The placeholder names do not have to appear in any particular order such as the increasing order {_0}{_1}{_2}...{_u}. The order of the quantity boxes and the unit box correspond to the order of the placeholder names in the part's text. For example, the following:

Part 1
 Answer*              [0, 100, 200, 300]
 Unit                 mm
 Part's text          {_2}{_0}{_3}{_u}{_1}

gives

Fichier:En29FormulasDocumentation04.png

Neither do the quantity answers have to be in increasing order (of course) and we would get exactly the same as above with the following:

Answer*              [200, 0, 300, 100]
Unit                 mm
Part's text          {_0}{_1}{_2}{_u}{_3}

By default, all missing placeholder are automatically appended at the end. For example, {_0}{_u} for a one answer sub-question and {_0}{_1}{_u} for a two answer sub-question.

The box {_0} corresponds to the special variable _0 in the Grading variables.

Quantity and unit boxes side by side or merged

When the quantity placeholder {_0} and the unit placeholder {_u} are directly side by side, such as {_0}{_u}, the quantity box and the unit box merge into a longer single answer box in which both quantity and unit must be entered.

When the quantity placeholder and the unit placeholder are not directly side by side, i.e. when they are separated by a space or any other string of characters, the answer boxes do not merge and hence they are displayed side by side.

Example

Answer with both quantity and unit:

Main question
  Question text*       What is 2 mm + 3 mm?
Part 1
  Part's mark*         1
  Answer type          Number
  Answer*              5
  Grading criteria*    Absolute error == 0
  Unit                 mm
  Part's text          {_0} {_u}  Separate placeholders give separate quantity and unit boxes.
Part 2
  Part's mark*         1
  Answer type          Number
  Answer*              5
  Grading criteria*    Absolute error == 0
  Unit                 mm
  Part's text          {_0}{_u}  Attached placeholders give a merged quantity and unit box.

The formulas question should look like this:

Fichier:En29FormulasDocumentation05.png

Play it   Login info  (Open in new tab: Ctrl+Shift+Click)

Width of answer boxes

The width of the quantity and unit boxes, both separate and merged, can be adjusted by modifying the width parameters in the styles.css file for the Formulas question as shown below. This change can readily be done by your Moodle site administrator.

/* Set the width of the unit box to 150px: */ input.formulas_unit {

   margin: 0.em 0 0 0;
   width : 150px;

}

/* Set the width of the quantity box to 130px: */ input.formulas_number {

   margin: 0.em 0 0 0;
   width : 130px;

}

/* Set the width of the box for merged quantity-unit to 250px: */ input.formulas_number_unit {

   margin: 0.em 0 0 0;
   width : 250px;

}


Accéder au haut de la page

← QUESTION DE TYPE FORMULES

Autres langues

English
Español