How can variables (substitute characters, data sets) be used in Cloze Question?
I imagine something along these lines (see attachment).
For what you are trying to do, I recommend looking at additional question types like qtype_formulas and qtype_stack.
Hello céline,
With the Formulas question, it's very simple and you can do a lot more.
You can try this question at https://moodleformulas.org/course/view.php?id=77§ion=97 ↗.
Global variables
H = 30 ; d = 1.2 ; Qa = 2.3 ; Qb = Qa ; lambda = 0.03 ; L = (d/0.03)*(((9.81*30*pi()**2*d**4)/(8*Qa))-1); Ldisplay = sigfig(L,4);
Question text
<p> The pipe friction coefficient of the pipe is \(\lambda\). </p> <p> Inlet losses at the beginning of the pipe are neglected. </p> <p> Given: \(H={H}\ \rm m\), \(d={d}\ \rm m\), \(r=10^3\ \rm{kg/m^3}\), \(Q_a={Qa}\ \rm{m^3/s}\), \(Q_b={Qb}\ \rm{m^3/s}\), \(\lambda={lambda}\) </p> <p> (In this case, the shut-off device is fully open and contributes nothing to the loss.) </p> <p> The pipe length \(\ell\) is \({=Ldisplay}\). </p> <br> <ol type="a" style="margin-left:-20px !important;"> <li> What is the pipe length \(\ell\) at the volume flow \(Q_a\)? </li> </ol> <hr> <p> Die Rohrreibungszahl des Rohres ist \(\lambda\). </p> <p> Einlaufverluste am Rohranfang werden vernachlässigt. </p> <p> Gegeben: \(H={H}\ \rm m\), \(d={d}\ \rm m\), \(r=10^3\ \rm{kg/m^3}\), \(Q_a={Qa}\ \rm{m^3/s}\), \(Q_b={Qb}\ \rm{m^3/s}\), \(\lambda={lambda}\) </p> <p> (Hierbei ist das Absperrorgan ganz geöffnet und trägt nichts zum Verlust bei.) </p> <p> Die Rohrlänge \(\ell\) ist \({=Ldisplay}\). </p> <br> <ol type="a" style="margin-left:-20px !important;"> <li> Wie gross ist die Rohrlänge \(\ell\) biem Volumenstrom \(Q_a\)? </li> </ol> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script> $(document).ready(function() { // FORMAT TEXT $("input.formulas_number ").css("width","120px"); }); </script>
Answer
L
Thank you very much for your quick reply.
Do I understand correctly that I have to install a plugin so that I can use the question type 'formulas'?
As Tim says, CLOZE questions can't be done with "variables", if you do it directly from Moodle. But with FastTest PlugIn, using Excel formulas, you can create many of the same questions, with variable data, with a single click. You save them all in a "subcategory" and in the test you put a random question out of that subcategory.
I send you the XML that I have made with your problem, with "random values" and 50 differents questions.
P.S.: In the plugin I have included a script that Dominique developed, in which the box with the width of the answer is the "minimum", and as the answer is written, the size of the box increases. Thus, the student is not given clues about the answer.
Hello Milagros,
... a script that Dominique developed...
For the record, Marc Bernat Martínez had the original idea and developed a first version of the script. I modified it to take into account the exact width of the input, whatever its length, font size and family used. See MoodleDocs - Can I resize the answer boxes while the user is typing? ↗.
Thank you very much for your help.
Is it also possible to generate only one question (with variables) and an attached record? I have attached an example of an xml file as I imagine it, but for a calculated question.
If you mean FastTest PlugIn, it's not a single question (but you can have them all in one file and import them at once). The trick I use is to import all those questions into the same subcategory and, when generating the test, prepare it so that a random question comes out of the subcategory where all the generated questions are with the same statement, but different data.
At the end of the following video I explain how it can be done.
It would be much better to be able to use the plugins developed for this, but those of us who are not lucky enough to have them installed in our university's Moodle can "get by" with this "trick". This is how I did it when in online exams (during COVID) and my students had different data in their problems.
Although I don't think it is necessary to have all the possible combinations (11*6*6 = 396), I have generated an XML with all of them. I have generated the name of the question (automatically) with the data that varies, so you can check that none is repeated.
Regards
Hope this can help you.
Regards
Thank you very much for your help!!
I forgot to tell you that if you want to enter formulas on the same line you should put /( FORMULA /) instead of $$ FORMULA $$. If you use the latter, each formula puts it on a new line and centered in the text.
Regards
Hello céline,
Yes, you need to install the Formulas question type plugin, available at https://moodle.org/plugins/qtype_formulas ↗. The Formulas question type is a third-party question type.
Moodle comes with 16 standard question types for which you don't need to install anything else (see MoodleDocs - Question types ↗). You can also install third-party question types (see MoodleDocs - Third-party question types ↗). In total, about 80 third-party question types are available at Moodle - Plugins ↗ (click 'Show more' at the bottom of that page). Some are very useful and widely used.
Don't hesitate to ask your system administrator to install the Formulas question type plugin. This type of question is easy to learn, has many other powerful features and is very useful in many problems in science, technology, engineering and mathematics (STEM), as well as in other areas where you need to perform calculations, for example in accounting, etc.
In my university's Moodle, the only one we have "extra" is STACK. Although we ask them to install the others, they ignore us. That is why I have been implementing new functions to FastTest PlugIn, to be able to ask questions with formulas (in addition to the fact that it is faster than writing the questions one by one in Moodle, because in a single interface you have all the data that you have to fill in for the questions "standard"), and not having to depend on an external plugin to be installed to ask certain types of questions...
Although it is true that FastTest PlugIn has the drawback of being in Excel, in Spain almost all universities have a Microsoft license. But VBA is the programming language I know...
Your FastTest plugin is definitely a useful option in many situations, for many users that are certainly grateful to you. The number of downloads surely confirms that this is a great contribution.
Having created such a plugin and making it known is a very commendable job. ¡olé!
Thank you very much, Dominique, for your words!!
I love to help and, since I'm very good with Excel and VBA, it didn't cost me much to do it... well, a little time yes, but it's not difficult.
Also, I have implemented (and intend to continue implementing) several of your scripts... 🙂
Thank you very much for your help!!
Hello céline,
To randomize the data, just define random variables, e.g. as follows:
Random variables
H = {25:36} ; d = {1.0:1.6:0.1} ; Qa = {2.0:2.6:0.1} ;
Global variables
Qb = Qa ; lambda = 0.03 ; L = (d/0.03)*(((9.81*30*pi()**2*d**4)/(8*Qa))-1); Ldisplay = sigfig(L,4);
H = {25:36} means that \(H\) will be chosen randomly in the interval from 25 to 35 (the last value, here 36, is not counted), ie \(H\) will be chosen among 11 different values. \(d\) and \(Q_a\) will each be chosen from 6 different values. So there is a total of 11 x 6 x 6 = 396 possible permutations of the same question. All of these permutations are generated automatically with only three short statements in a single question. Any of the 396 permutations will be submitted to each student.
I recommend using the Formulas question for this kind of problem because it is easy to learn, designed for computational problems in STEM, and has many great features which may not be available in other question types.