Note: You are currently viewing documentation for Moodle 3.3. Up-to-date documentation for the latest stable version of Moodle is probably available here: FQT Multiple choice placeholders.

FQT Multiple choice placeholders: Difference between revisions

From MoodleDocs
No edit summary
No edit summary
Line 5: Line 5:
* Radio buttons placeholder
* Radio buttons placeholder


===Why make a FQT multiple choice question?===
==Why make a FQT multiple choice question?==


Because you can use all the power of the Formulas calculation engine to build the list of choices.
Because you can use all the power of the Formulas calculation engine to build the list of choices.


===Dropdown menu placeholder===
==Dropdown menu placeholder==


The syntax for this placeholder is <span style="font-family:monospace;font-size:113%;">{_n:choices:MCE}</span> where
The syntax for this placeholder is <span style="font-family:monospace;font-size:113%;">{_n:choices:MCE}</span> where
Line 46: Line 46:
</div>
</div>


===Radio buttons placeholder===
==Radio buttons placeholder==


The syntax for this placeholder is <span style="font-family:monospace;font-size:113%;">{_n:choices}</span> where
The syntax for this placeholder is <span style="font-family:monospace;font-size:113%;">{_n:choices}</span> where
Line 81: Line 81:
</div>
</div>


===Shuffled choices===
==Shuffled choices==
With '''Formulas''' multiple choice questions, the shuffling of choices is not a built-in option but it can be easily programmed.
With '''Formulas''' multiple choice questions, the shuffling of choices is not a built-in option but it can be easily programmed.


Line 89: Line 89:
Make a multiple choice '''Formulas question''' with shuffled choices.
Make a multiple choice '''Formulas question''' with shuffled choices.


''Downloadable question file:'' [https://drive.google.com/open?id=1_Mxdj9ESblarGu7XVbc5pR1z3csU_Jrw PlanetClosestSun.xml] Programming comments are given in this file.
''Downloadable question file:'' [https://drive.google.com/open?id=1hEpUcb2eu8cw-VVTmdDp4Cd1jWn3n421 ShuffledMultipleChoice.xml]Programming comments are given in this file.


<pre style="font-size:113%;width: 98%;">
<pre style="font-size:113%;width: 98%;">

Revision as of 07:54, 6 December 2017

< Formulas question type

In addition to the answer box placeholders, the Formulas question type provides for two other types of placeholder which are used for multiple choice questions:

  • Dropdown menu placeholder
  • Radio buttons placeholder

Why make a FQT multiple choice question?

Because you can use all the power of the Formulas calculation engine to build the list of choices.

Dropdown menu placeholder

The syntax for this placeholder is {_n:choices:MCE} where _n is the placeholder name (_0, _1, _2, etc.) as for the answer box placeholders, choices is a list of strings to appear as the menu choices and MCE must appear as is.

Example

Use a dropdown menu placeholder to make a multiple choice question.

Downloadable question file: CapitalCanada.xml

General
  Question name*       A formulas question with a dropdown menu multiple choice question
Variables
  Global variables     cities=["Calgary","Halifax","Montréal","Ottawa","Toronto","Vancouver"];
Main question
  Question text*       Geography
                       {#1}
Part 1
  Part's mark*         1
  Answer type          Number
  Answer*              3
  Grading criteria*    Absolute error == 0
  Placeholder name     #1
  Part's text          What is the capital city of Canada?
                       {_0:cities:MCE}

The formulas question should look like this (the choices are highlighted by moving up and down in the menu):

CapitalCanada.png

Radio buttons placeholder

The syntax for this placeholder is {_n:choices} where _n is the placeholder name (_0, _1, _2, etc.) as for the answer box placeholders and choices is a list of strings to appear as the menu choices. The list of buttons is only vertical.

Example

Use a radio buttons placeholder to make a multiple choice question.

Downloadable question file: PlanetClosestSun.xml

General
  Question name*       A formulas question with a radio buttons multiple choice question
Variables
  Global variables     planets=["Earth","Jupiter","Mars","Mercury","Neptune","Saturn","Uranus","Venus"];
Main question
  Question text*       Astronomy
                       {#1}
Part 1
  Part's mark*         1
  Answer type          Number
  Answer*              3
  Grading criteria*    Absolute error == 0
  Placeholder name     #1
  Part's text          What is the closest planet to the sun?
                       {_0:planets}

The formulas question should look like this (the student must click a choice from the list):

PlanetClosestSun.png

Shuffled choices

With Formulas multiple choice questions, the shuffling of choices is not a built-in option but it can be easily programmed.

Example

Make a multiple choice Formulas question with shuffled choices.

Downloadable question file: ShuffledMultipleChoice.xml. Programming comments are given in this file.

General
  Question name*       ShuffledMultipleChoice
Variables
  Random variables     c=shuffle([0,1,2,3,4,5]);
  Global variables     mc=[" Red"," Orange"," Yellow"," Green"," Blue"," Violet"];
                       a=3;  # The third answer (counting from 0), i.e. Green, is the correct answer.
                       c=c;
                       t=c;
                       for (i:[0:6]) {
                         t[i]=a==c[i]?i:0;
                       }
                       tt=0;
                       for (i:[0:6]) {
                         tt=tt+t[i];
                       }
                       colors=[mc[c[0]],mc[c[1]],mc[c[2]],mc[c[3]],mc[c[4]],mc[c[5]]];
Main question
  Question text*       Physics
                       {#1}
Part 1
  Part's mark*         1
  Answer type          Number
  Answer*              tt
  Grading criteria*    Absolute error == 0
  Placeholder name     #1
  Part's text          What pure spectral color has an approximate wavelength of 530 nm (measured in air or vacuum)?
                       {_0:colors}

The formulas question should look like as shown below. The choices are shuffled hence in a different order for each student (there are 6! = 720 permutations):

ShuffledMultipleChoice.png


< Formulas question type