Skip to content
Snippets Groups Projects
user avatar
GD authored
c3c84a3c
History
Name Last commit Last update
template
README.md
moodle.pdf

Moodle test template

Automatic student assessment

Generation of multiple choice questions and automatic grading via the Moodle platform for continuous assessment

Procedure:

  1. Generate a set of questions and corresponding possible answers with the moodle LaTeX package , c.f. dedicated section for details.

If you have issues installing the moodle LaTeX package, you can just copy the file moodle.sty in the same directory as your question/answer LaTeX sources.

  1. Import the set of generated questions/answers into moodle and generate a multiple choice questionnaire in the Moodle interface, c.f. dedicated section for details.

Moodle LaTeX

Reference: see the official documentation (local pdf or online pdf) regarding the moodle LaTeX package.

See the template sub-directory for an example of question/answer generation.

  1. Write your questions/answers using the syntax of the moodle LaTeX package (c.f. next section).

  2. Compile your LaTeX document containing the questions/answers (ideally with lualatex, c.f. "Tips and tricks"). A suffixed -moodle.xml file will be generated in addition to the .pdf file (than can be read for spell-checking and verifications).

  3. Import the .xml file in the moodle interface, c.f. dedicated section.

Writing a test

Writing a quiz/test is as simple as the following example (from the moodle documentation):

\documentclass[12pt]{article}
\usepackage[section]{moodle}

% new commands
\moodleregisternewcommands
\newcommand\monomial[1]{x^{#1}}
\newcommand\sillyanswer{What!?}

\begin{document}

% define a set of questions called a quiz
\begin{quiz}{My first quiz}

% a numerical question
\begin{numerical}[points=2]{Basic addition}
What is $8+3$?
\item 11
\end{numerical}

% open question expecting a given answer
\begin{shortanswer}[usecase]{Newton's name}
What was Newton's first name?
\item Isaac
\item[fraction=0, feedback={\sillyanswer}] Fig
\item[fraction=0] Sir
\end{shortanswer}

% multiple choice question
% the correct answer is identified by a `*` or a `fraction` option higher than 0
\begin{multi}[points=3]{A first derivative}
What is the first derivative of $\monomial{3}$?
\item $\frac{1}{4}\monomial{4}+C$
\item[feedback={yes!}]* $3\monomial{2}$
\item[feedback={\sillyanswer}] $51$
\end{multi}

\end{quiz}
\end{document}
  • All questions should be defined inside a quiz environment (corresponding to a set of questions, one per source file): \begin{quiz}{<quiz_title>} ... \end{quiz} where <quiz_title> is the title of the quiz.

  • To write a question, you just need to use the corresponding environment: \begin{<question_type>}[<question_options>] .... \end{<question_type>} where:

    • <question_type> is the type of the question among truefalse, multi (for multiple choice question), numerical (the student is expected to type a number as an answer), shortanswer (the student is expected to type a text as an answer), that will all be automatically graded by moodle, and essay (open question) that will require to be manually graded.
    • optional <question_options> parametrize the specific behavior of the questions (c.f. moodle LaTeX package documentation).
  • Question options can be globally defined when beginning the quiz environment with \begin{quiz}[<global_options>]{<quiz_title>} ... \end{quiz}, or locally to a TeX group with \moodleset{<options>}, or locally to a question (c.f. previous point).

  • The option points allows to define the number of points given to the corresponding question. The default is 1.

Note: when using a test with random questions in the moodle interface, all questions will be worth the same number of points despite what is defined when writing the quiz.

  • The penalty options concerns multiple attempts for the quiz (that we will not allow).

  • You can use the cloze environment to define a "super-question" containing multiple sub-questions. In this case, the sub-question will follow the syntax \begin{<question_type>} ... \end{<question_type>} without any title.

Multiple choice questions

  • Multiple choice questions with a single answer:
    • By default, multi multiple choice questions expect a single answer (and it will not be possible for the student to select multiple answers in the moodle interface), e.g.:
\begin{multi}{A question}
What is the answer?
\item* correct answer 1
\item wrong answer 2
\item wrong answer 3
\end{multi}
  • In this case, you can write \item* <text of the correct answer> (note the *) or \item[fraction=100] <text of the correct answer> to identify the correct answer. All wrong answers are written \item <text of the wrong answer>.
  • You can use \item[fraction=<fraction_value>] <text of the partially correct answer> with the <fraction_value> higher than 0 and lower than 100 to identify partially correct answer that will give the corresponding fraction of the points associated to the correct answer (e.g. for a 2-point question, selecting the answer \item[fraction=50] <text of the answer> will get 50% of the points, i.e. 1 points here).
  • Regarding the possible values for the fraction option, please refer to the table 1 in the moodle LaTeX package documentation (local pdf or online pdf).

  • Multiple choice questions with one or multiple answers:

    • If you want to add uncertainty regarding the number of expected answer(s) or expect multiple answers to get all the points awarded to the question, you need to add the option multiple or single=false to the corresponding question, e.g.:
\begin{multi}[multiple]{A question}
What is the answer?
\item[fraction=50] correct answer 1
\item[fraction=50] correct answer 2
\item[fraction=-50] wrong answer 4
\item[fraction=-50] wrong answer 5
\end{multi}
  • The number of points awarded to the selected answers is the sum of the fraction for each selected answer times the total of points for the question, bounded by 0 and the total of points for the question (e.g. in the previous example, if I select answers 1, 2, 3 and 4, assuming the question is worth 2 point, I will get min(max(0, 0.5*2 + 0.5*2 - 0.5*2 - 0.5*2), 2) = 0).
  • \item <text of the wrong answer> for wrong answers is equivalent to \item[fraction=0] <text of the wrong answer>), thus selecting all the answers (even the wrong ones) will give all the points (because the wrong answers are worth 0% of the points awarded to the question). To avoid this, it is possible to set negative percentage (between 0 and -100) to wrong answers with the fraction option (c.f. previous example).

Note on fractions:

  • Be cautious when assigning positive or negative fraction to (resp.) expected correct answers and wrong answers.
  • It is not possible to get a negative grade for a question, or a grade higher than the number of points awarded to the question.
  • It is recommended to assign a positive fraction value to each expected answers so that the sum of the positive fractions is 100% (50+50 in the previous example). If the total fraction is less than 100%, it will be impossible to get all the points. If the fraction is higher than 100%, the maximal grade will be the number of of points awarded to the question anyway, meaning that it will be possible to get all the points (or almost all points) without selecting all the expected correct answers.
  • Regarding the negative fractions for wrong answers, two policies are possible:
    • either use use a negative fraction for each wrong answer so that the sum of negative fractions will be -100% (selecting a wrong answers will be penalizing but will not cost all the points if all expected correct answers are selected)
    • either use fraction=-100 for all wrong answers so that selecting one wrong answers will give 0 points for the questions (despite selecting all expected good answers)

Additional tips and tricks

  • Accents are not well rendered in the generated .xml file (and then in the moodle interface when taking a test). To avoid character encoding issues, one solution is too use TeX macros to write accent, i.e. \'e for é. Another less cumbersome is to compile the document with lualatex.

  • Math formula can be added in the question/answer. They will be rendered in the .xml files (and then in the moodle interface when taking a test). However, it is best to avoid using exotic math symbole.

  • Images can be added in the question/answer. They will be hard-coded in the .xml file, and then rendered in the moodle interface when taking a test without needing to separately upload the image on moodle.


Moodle interface

References:

  1. Import your quiz: "Administration" -> "Banque de questions" -> "Importer" -> choose "Format XML moodle" -> "Déposer un fichier"

  2. Create a test: "Activer le mode edition" -> "Ajouter une activité ou ressources" -> choose "Test" then configure it (hide it, from the course index page, during the configuration)

  3. Test configuration

  • "Temps":
    • set up an opening and closing date/time, and a time to complete the test
    • choose "la tentative en cours est envoyée automatiquement"
  • "Note": set to only one attempt (if not, student can start again after completing the test, thus potentially improve their grade)
  • then "Enregistrer et afficher"
  1. Add questions: in the "Administration" left panel -> "Modifier le test" -> "Ajouter" -> "Question aléatoire"
  • "Catégorie": choose the name of the quiz in the banque de questions from which the questions will be drawn
  • "Nombre de questions aléatoires": choose the number of questions that will be randomly drawn
  1. "Préviualiser le test" to verify that every thing is ok, then make the test visible for the students (from the course index page)