Examples of Mathematics E-assessment in Moodle

advertisement
Examples of Mathematics E-Assessment
using Moodle Quizzes
Contents
1.
Quizzes in Moodle ........................................................................................................................... 1
2.
Creating Questions in Moodle ........................................................................................................ 2
a.
Simple Maths Questions ............................................................................................................. 2
b.
Using PHP to Create Multiple Variations of Simple Maths Questions ........................................ 3
c.
Embedded Answer (Cloze) Type Questions ................................................................................ 5
d.
Using PHP to Create Questions Using the Embedded Answer (Cloze) Format .......................... 7
EXAMPLE: Complex Addition .......................................................................................................... 7
EXAMPLE: Complex Subtraction ................................................................................................... 10
EXAMPLE: Complex Division ......................................................................................................... 13
e.
More Advanced Maths Questions ............................................................................................ 14
EXAMPLE: Matrix Multiplication ................................................................................................... 15
f.
3.
Using PHP to Create Multiple Variations of More Advanced Maths Questions ....................... 15
Adding Questions to a Quiz........................................................................................................... 17
1. Quizzes in Moodle
We aim to create quizzes on mathematics content in various CEMPS modules using the Quiz function
on Moodle. Official Moodle documentation on how to create quizzes and questions can be found via
http://docs.moodle.org/22/en/Quiz_module and http://docs.moodle.org/22/en/Question_bank
respectively. For ease of reference, the main steps are outlined in this (unofficial) document.
Figure 1
Figure 2
Quizzes can be added to a course by using the “Turn editiing on” option in a Moodle course (Figure
1) followed by selecting “Quiz” from the “Add an activity” drop down menu in an empty module
(Figure 2). Before you can add questions to your quiz, you need to create or import them first.
2. Creating Questions in Moodle
Questions can be created in Moodle by selecting “Questions” from the Administration section of a
course, shown in Figure 3.
You can then select a type of question from the drop-down selection next to “Create a question”.
The type of question will depend on the content of your question – for example, a simple question
such as “2+2=4” can use the “numerical” type, whilst an answer requiring a word or phrase would be
better suited to a “shortanswer” type. An “embedded answers (Cloze)” type question is particularly
useful, as it allows you to use multiple types of answers within a question.
Figure 3
a. Simple Maths Questions
Simple maths questions can be answered in Moodle using the “numerical” answer format, e.g.
2+2=4. Some examples of accepted and unaccepted answers using the “numerical” answer format
are shown in Figure .
Figure 4
However, other fairly simple answers, like those involving basic algebraic formulae or complex
numbers cannot be recognised directly by the “numerical” format, e.g “2a + b” is not recognised as a
valid answer.
“Shortanswer” questions can match a string of characters – e.g. “4i+3” – however, an answer of “4i +
3” (with spaces) would not be recognised as correct.
As part of the project, we are looking at ways to ensure that equivalent answers are all recognised as
correct by Moodle. Until this can be achieved, answer boxes must be structured to minimise the
chances of alternative equivalent answers being input.
Moodle has the capability to assign multiple answers full marks – e.g. marking “5/3” and “1+2/3” as
equivalent. However, currently this has to be done manually and can be very time consuming.
b. Using PHP to Create Multiple Variations of Simple Maths Questions
Simple PHP scripts have been written to generate multiple versions of simple questions with
alternative variables. To achieve this, the answer to the question must be fairly simple to calculate
using PHP code. An example PHP script for a “numerical” type question is shown in Figure 7, where
500 versions of the same question are to be generated.
The grey text in Figure 7 is the text that will be written to the Moodle XML file. To upload an XML file
to Moodle, it must have a specific format. This can be found by simply exporting a dummy question
of the required type (e.g. numerical, shortanswer, Cloze) to an XML file (use the “Export” tab on the
questions page), and including the relevant sections in your PHP script.
Figure 5
For those unfamiliar with PHP, here is a quick explanation of a few parts of the code (comprehensive
information on the PHP language is available online at http://php.net/manual/en/index.php):








$ before a string of characters indicates a variable, which could be one of 9 types:
Boolean, integer, float, string, array, object, resource, NULL and callable. The
programmer does not usually need to set the type, PHP will interpret the type as it runs.
fopen means “open the following file”, and the “w” after the filename means “write to
this file”. To read a file instead, use “r”.
fputs means “write this content to the file”.
Extra backslashes are there as escape characters – in PHP and XML characters such as “
or & can be interpreted differently, so need to be escaped using \.
Operators PHP uses the usual operators for mathematical calculations: + for addition, for subtraction, * for multiplication and / for division. However, = is an assignment
operator, e.g. for $i = 3, i will take on the value of 3. To equate two values, use ==
instead. != means “not equal to”.
Comments Text next to // or between /* and */ are comments, simply there to clarify
the code, and are not interpreted by PHP.
echo means “print this to screen as the program runs” – useful for error checking etc.
This does not print anything to your specified file.
fclose closes the open file.
PHP can be written in an editor such as Notepad++, where if you save the file as a PHP type, it will
automatically colour your code appropriately. You can find more information and download this at:
http://notepad-plus-plus.org/.
To run PHP scripts (i.e. to create the XML file) you could use a programme such as XAMPP (free to
download and use) to run a local development server. Information on how to use this can be found
at http://www.apachefriends.org/en/xampp-windows.html
c. Embedded Answer (Cloze) Type Questions
A Cloze-type format means that you can embed multiple types of sub-questions within a larger
question. An example of creating a Cloze-type question, featuring two numerical type answer boxes,
Figure 6
Figure 7
can be seen in figure 6. A preview of this question can be seen in figure 7.
The question text is written in normal moodle format, but the answer boxes for each question are
embedded after the text. The format of each answer box is the same: it starts with a bracket “{“,
followed by a number representing the marks awarded for a correct answer. A colon follows and
separates the grade from the next element: the type of answer. The “codes” to specify the different
types of answer boxes are as follows:






short answers (SHORTANSWER or SA or MW), case is unimportant,
short answers (SHORTANSWER_C or SAC or MWC), case must match,
numerical answers (NUMERICAL or NM),
multiple choice (MULTICHOICE or MC), represented as a dropdown menu in-line in the text
multiple choice (MULTICHOICE_V or MCV), represented a vertical column of radio buttons, or
multiple choice (MULTICHOICE_H or MCH), represented as a horizontal row of radio-buttons.
This “code” is then followed by another colon, separating the type of answer from the answer itself. An equals
sign before an answer marks it as correct (i.e. the full mark will be given for a correct answer.). Partially correct
(or common incorrect) answers can be marked using a percentage score, e.g. “%50%” would indicate that 50%
of the marks would be given for the following answer, “%0%” would mark the answer as incorrect. Each
answer must be separated by a tilde: “~”. Feedback can be given on individual answers using “#”, followed by
the feedback.
Examples:


Simple shortanswer (case insensitive): “What is missing from this trio? Sine, Cosine and....?
{1:SA:=Tangent}”
The correct answer, “Tangent”, will get one mark, as will “TANGENT” or “tangent”. All other
answers will be marked incorrect.
Shortanswer (case sensitive), with feedback: “What is missing from this trio? Sine, Cosine and....?
{1:SAC:=Tangent#Well Done! ~%50%tangent#Check the case!}”
The correct answer, “Tangent” will get one mark and the feedback “Well Done!” once submitted.
The answer “tangent” will only get 0.5 marks and the feedback “Check the case!” once
submitted.

Multiple choice: “Whose theory states that ‘a square on the hypotenuse is equal to the sum of the squares
on the other two sides’? {2:MC:=Pythagoras~%0%Euler ~%0%Lagrange ~%0%Newton}”
The possible answers will be displayed in a drop-down menu. The correct answer, Pythagoras,
will get two marks, whereas selecting one of the other options will gain 0 marks.
There are more examples and information available at:
http://docs.moodle.org/22/en/Embedded_Answers_%28Cloze%29_question_type
d. Using PHP to Create Questions Using the Embedded Answer (Cloze)
Format
EXAMPLE: Complex Addition
A complex addition question may take the form: (a+bi) + (c+di) = x+iy, where i is an imaginary
number; a,b,c,d are variables; x represents the real part of the addition and y represents the
imaginary part of the addition.
To create multiple versions of complex addition questions, the code had to include:





A “for” loop to create each individual question and write them to an XML file (the format
used to upload questions to Moodle).
A calculation to add the real and imaginary parts of the question.
A check on the operators to ensure that “+” will occur in place of “- -“, and “-“ will take the
place of “+ -“.
Equivalent answers marked as correct as long as they are in an accepted form.
Feedback for common mistakes, e.g. adding all terms together regardless of whether they
are a complex or real part.
Figure 8
Figure 9 shows the first question created by the PHP script. There are currently 49 alternative
versions of this question, with the variables and answers changing respectively in each version.
Figure 9
However, it is very easy to create virtually limitless new versions of this question, simply by changing
the number of iterations of the “for” loop in the PHP script.
EXAMPLE: Complex Subtraction
A complex subtraction question may take the form: (a+bi) - (c+di) = x+iy, where i is an imaginary
number; a,b,c,d are variables; x represents the real part of the subtraction and y represents the
imaginary part of the subtraction.
Creating a PHP script to perform complex subtraction is structurally almost identical to creating a
PHP script for complex addition. The only changes that need to be made are those affecting
operators and variable names (variable names simply to aid readability and prevent confusion).
The factors that need to be taken into account are also the same as for complex addition:
anticipating common mistakes and providing feedback for these, checking that the correct operators
appear in the question etc.
The PHP script can be seen in figure 10, where differences to the complex addition script have been
highlighted.
Figure 11 shows a preview of the question once generated and imported into Moodle’s question
bank.
Figure 10
Figure 11
EXAMPLE: Complex Division
A complex division question may take the form: “for the complex numbers w = a+bi and z = c+di, find
z/w”.
Random variables (e.g. a,b,c,d) can be defined in much the same way as in complex addition and
subtraction. However, the calculation here is a little more complicated, as shown in figure 12, which
features a section of the PHP script. This section shows the calculation of the answer, simplifying the
answer to its lowest form, and calculating common incorrect answers for feedback purposes.
Figure 13 shows a preview of the complex division question once it has been imported into Moodle’s
question bank.
Figure 12
Figure 13
e. More Advanced Maths Questions
More advanced maths questions are likely to require specialised mathematical notation for the best
readability. An example of this could be wanting to display a square root as "√𝑎 + 𝑏 + 𝑐” rather
than “(a + b + c)^(1/2)”.
Moodle uses TeX notation to render mathematical symbols, formulae etc., displaying the
expressions as GIF images. More information on how Moodle uses TeX can be found here:
http://docs.moodle.org/22/en/TeX_notation_filter
Unfortunately, answer boxes cannot be placed within TeX notation – an example of where this may
be desirable could be where an answer is a matrix, and it makes sense to have the answer boxes
𝐴𝑛𝑠𝑤𝑒𝑟 𝑏𝑜𝑥 ⋯ 𝐴𝑛𝑠𝑤𝑒𝑟 𝑏𝑜𝑥
placed as elements within a matrix, e.g. “ (
)”. The project so far
⋮
⋱
⋮
𝐴𝑛𝑠𝑤𝑒𝑟 𝑏𝑜𝑥 ⋯ 𝐴𝑛𝑠𝑤𝑒𝑟 𝑏𝑜𝑥
has been unable to find a perfect solution for this difficultly, but has utilised a workaround, using
transparent tables to structure the answer boxes sensibly, and inserting images of brackets where
appropriate.
An example of the outcome of this workaround is shown in figure 14.
Figure 14
f. Using PHP to Create Multiple Variations of More Advanced Maths
Questions
EXAMPLE: Matrix Multiplication
Matrix multiplication is more complicated than the examples we have previously looked at, in terms
Figure 15
of the calculation required and the display difficulties discussed above.
The project used a function capable of multiplying together any two compatible matrices, as shown
in figure 15. This function could then be called later in the PHP script.
Two arrays were used as the matrices, filled with random numbers between -10 and 10, so that each
new question created would be a variation. Numbers between -10 and 10 were chosen to ensure
that each question was of similar difficulty level (e.g. multiplying 4 and 3 is a lot easier than
multiplying 83 and 107), and that the test was focused more on their understanding of the process
used in matrix multiplication, rather than mental arithmetic.
The code to display the answer boxes in a table (shown in figure 16) looks off-putting, but can be
easily obtained by creating a dummy question in Moodle with the desired table and exporting the
question to XML. (Note: specific characters need to be ‘escaped’ in PHP code, or they will be
interpreted wrongly. More information on escaping characters can be found at
http://php.net/manual/en/regexp.reference.escape.php)
Figure 16
3. Adding Questions to a Quiz
Once you have created your questions, you can them to a quiz from the question bank, either by
selecting specific individual questions, or choosing to randomly select a number of questions from
various categories. An example of adding questions randomly from certain categories is shown in
Figure 17.
Figure 17
This ability to randomly select questions from categories is one of the features we hope to exploit
when creating quizzes for mathematics content. If we are able to generate multiple versions of each
question, differing only in the variables used in the question, but retaining the original format, then
each student can test their knowledge with a new challenge each time they attempt the quiz.
Figure 18 shows a preview of the example quiz being created in figure 17. Figure 19 shows a preview
of the same quiz, but note that the variables have changed due to the random nature of question
selection chosen.
Figure 18
Figure 19
Download