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: Formulas: Multiple choice.

Formulas: Multiple choice: Difference between revisions

From MoodleDocs
(9 intermediate revisions by the same user not shown)
Line 7: Line 7:
* Radio buttons placeholder
* Radio buttons placeholder


FQT multiple choice questions allows you to use all the power of the '''Formulas''' calculation engine to build the list of choices.
The Formulas multiple choice question allows you to use all the power of the '''Formulas''' calculation engine to build the list of choices.


==Dropdown menu placeholder==
==Dropdown menu placeholder==
Line 40: Line 40:
The Formulas question should look like this (the choices are highlighted by moving up and down in the menu):
The Formulas question should look like this (the choices are highlighted by moving up and down in the menu):


[[File:CapitalCanada.png|700px]]
[[File:CapitalCanada.png|695px]]


<div style="margin:20px 0 20px;">
<div style="margin:20px 0 20px;">
[http://35.193.77.29/mod/quiz/view.php?id=116 <span style="background-color:#f98012;box-shadow: 0 5px 10px #cbcbcb;border: none;color:white;padding: 8px 16px;text-align:center;text-decoration: none;cursor:pointer;">Play it</span>]   [[Formulas_question_type#Examples|Login info]]  ''(Open in new tab: Ctrl+Shift+Click)''
<span style="background-color:#f98012;box-shadow: 0 5px 10px #cbcbcb;border: none;color:white;padding: 8px 16px;text-align:center;text-decoration: none;cursor:pointer;">[http://35.193.77.29/mod/quiz/view.php?id=116 <span style="color:white;">Play it </span>]</span>   [[Formulas_question_type#Examples|Login info ↗]]  ''(Open in new tab: Ctrl+Shift+Click)''
</div>
</div>


Line 81: Line 81:


<div style="margin:20px 0 20px;">
<div style="margin:20px 0 20px;">
[http://35.193.77.29/mod/quiz/view.php?id=118 <span style="background-color:#f98012;box-shadow: 0 5px 10px #cbcbcb;border: none;color:white;padding: 8px 16px;text-align:center;text-decoration: none;cursor:pointer;">Play it</span>]   [[Formulas_question_type#Examples|Login info]]  ''(Open in new tab: Ctrl+Shift+Click)''
<span style="background-color:#f98012;box-shadow: 0 5px 10px #cbcbcb;border: none;color:white;padding: 8px 16px;text-align:center;text-decoration: none;cursor:pointer;">[http://35.193.77.29/mod/quiz/view.php?id=118 <span style="color:white;">Play it </span>]</span>   [[Formulas_question_type#Examples|Login info ↗]]  ''(Open in new tab: Ctrl+Shift+Click)''
</div>
</div>


Line 93: Line 93:


Make a '''Formulas''' multiple choice question with shuffled choices.
Make a '''Formulas''' multiple choice question with shuffled choices.
''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%;">
General
General
   Question name*       ShuffledMultipleChoice
   Question name!       Spectral colors wavelengths
Variables
Variables
   Random variables    c=shuffle([0,1,2,3,4,5]);
   Random variables    # THE SIZE OF c MUST MATCH THE NUMBER OF CHOICES
   Global variables    mc=[" Red"," Orange"," Yellow"," Green"," Blue"," Violet"];
                      c=shuffle([0,1,2,3,4,5]);
                       a=3;  # The third answer (counting from 0), i.e. Green, is the correct answer.
   Global variables    # MULTIPLE CHOICE ANSWERS
                      mc=[" Red"," Orange"," Yellow"," Green"," Blue"," Violet"];
                       # POSITION OF THE CORRECT ANSWER (counting from 0)
                      a=3; # i.e. Green is the correct answer
                      # Define the global array c as being equal to the random array c. (The names could be different, but they don't need to be different).
                       c=c;
                       c=c;
                       t=c;
                      # Initialize t to any array of the right size. c does the work.
                       t=c;  
                      # Record the position of the correct answer. ADJUST THE END VALUE OF i.
                       for (i:[0:6]) {
                       for (i:[0:6]) {
                        t[i]=a==c[i]?i:0;
                          t[i]=a==c[i]?i:0;
                      }
                          }
                       tt=0;
                       tt=0;
                       for (i:[0:6]) {
                       for (i:[0:6]) {
                        tt=tt+t[i];
                          tt=tt+t[i];
                      }
                          }
                       colors=[mc[c[0]],mc[c[1]],mc[c[2]],mc[c[3]],mc[c[4]],mc[c[5]]];
                       colors=[mc[c[0]],mc[c[1]],mc[c[2]],mc[c[3]],mc[c[4]],mc[c[5]]];Main question
Main question
   Question text*      Physics
   Question text*      Physics
                       {#1}
                       {#1}
Line 126: Line 129:
</pre>
</pre>


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


[[File:ShuffledMultipleChoice.png|695px]]
[[File:ShuffledMultipleChoice.png|695px]]


<div style="margin:20px 0 20px;">
<div style="margin:20px 0 20px;">
[http://35.193.77.29/mod/quiz/view.php?id=122 <span style="background-color:#f98012;box-shadow: 0 5px 10px #cbcbcb;border: none;color:white;padding: 8px 16px;text-align:center;text-decoration: none;cursor:pointer;">Play it</span>]   [[Formulas_question_type#Examples|Login info]]  ''(Open in new tab: Ctrl+Shift+Click)''
<span style="background-color:#f98012;box-shadow: 0 5px 10px #cbcbcb;border: none;color:white;padding: 8px 16px;text-align:center;text-decoration: none;cursor:pointer;">[http://35.193.77.29/mod/quiz/view.php?id=122 <span style="color:white;">Play it </span>]</span>   [[Formulas_question_type#Examples|Login info ↗]]  ''(Open in new tab: Ctrl+Shift+Click)''
</div>
</div>
</div>
</div>


Line 152: Line 156:
===In other languages===
===In other languages===
[https://docs.moodle.org/all/es/F%C3%B3rmulas:_Opci%C3%B3n_m%C3%BAltiple Español]<br>
[https://docs.moodle.org/all/es/F%C3%B3rmulas:_Opci%C3%B3n_m%C3%BAltiple Español]<br>
[https://docs.moodle.org/3x/fr/Formules:_Choix_multiple Français]
[https://docs.moodle.org/3x/fr/Formules:_Choix_multiples Français]

Revision as of 05:23, 17 January 2018


Why make a Formulas multiple choice question?

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

The Formulas multiple choice question allows you to 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.

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

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

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.

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

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

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 Formulas multiple choice question with shuffled choices.

General
  Question name!       Spectral colors wavelengths
Variables
  Random variables     # THE SIZE OF c MUST MATCH THE NUMBER OF CHOICES
                       c=shuffle([0,1,2,3,4,5]);
  Global variables     # MULTIPLE CHOICE ANSWERS
                       mc=[" Red"," Orange"," Yellow"," Green"," Blue"," Violet"];
                       # POSITION OF THE CORRECT ANSWER (counting from 0)
                       a=3; # i.e. Green is the correct answer
                       # Define the global array c as being equal to the random array c. (The names could be different, but they don't need to be different).
                       c=c;
                       # Initialize t to any array of the right size. c does the work.
                       t=c; 
                       # Record the position of the correct answer. ADJUST THE END VALUE OF i.
                       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 as shown below. The choices are shuffled hence in a different order for each student.

ShuffledMultipleChoice.png

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

When shuffled choices are required, it is probably easier to use Moodle's core Multiple choice question. The point here is that with the Formulas question, multiple choice questions can be programmed.


Back to top of page

← FORMULAS QUESTION TYPE

In other languages

Español
Français