Moodle 1.9 Math Quizzes: Part 1

Ian Wild

November 2009

As good as the Moodle quiz module is at recognizing the correctness of our students' answers, we quickly run into problems when we need Moodle to recognize, for example, that 3a+2b is exactly the same as 2b+3a . To accomplish this, we're going to need a Computer Algebra System (CAS). The Maxima system (more on this later) has been successfully integrated into Moodle, thanks to the work carried out by Chris Sangwin and Alex Billingsley at the University of Birmingham in the UK. In this article, we will also learn how to perform these tasks:

  • Install and integrate STACK into Moodle
  • Create questions that can be automatically marked using STACK

Let's start by adding numeric questions into the course question bank.

Creating quizzes

Creating a quiz in Moodle is a two-stage process. First, we add our questions to the question bank (each course has its own question bank). Once we've added questions to the question bank, we can add a quiz activity to the course and then choose questions to add to it from the question bank. What are the advantages of having a two-stage process? I worked in much the same way creating quizzes before I started with Moodle. My bookshelf of math books was my question bank, and I would take questions from there to add into my quizzes. Here are just a few of the advantages:

  • If there is a particular point you want to reinforce, then it's easy to include the same question in different quizzes throughout your course.
  • It's easy to share your questions with other Moodle courses. For example, questions on the Pythagorean Theorem are relevant to pure math, mechanics, engineering, and physics.
  • Questions can be exported from and imported into the question bank. This means converting questions over to Moodle is a job that can be shared between colleagues.

Here's a basic Pythagorean Theorem question I converted over to Moodle:

Moodle 1.9 Math

Question types

However, I don't want to convert just this single question over to Moodle; I also want to have questions similar to this one but with different numbers. I want those numbers chosen randomly by Moodle, so I don't have to keep thinking up different numbers each time I set the quiz.

The question type I need is Calculated, which we'll learn about in the next section.

Calculated question type

Let's learn how to add a calculated question to the course question bank now:

  1. Return to your course's front page, and click on Questions in the course Administration block:

    Moodle 1.9 Math

  2. The course Question bank is displayed. From the Create new question drop-down menu, choose Calculated:

    Moodle 1.9 Math

  3. Give the question a name. Make sure it's a name that you (and, potentially, your colleagues) can recognize when it's in the question bank. Don't call it '1', 'i', or 'a)' because you don't know where it will appear in the quiz. Now, supply the question text:

    Moodle 1.9 Math

  4. Notice that I have used placeholders in the text, {a} and {b}. We will be configuring Moodle to replace those with numbers shortly.
  5. Scroll down to the Answer box. We need to enter the correct calculation into the Correct Answer Formula edit box (don't include a '=' in your answer):

    Moodle 1.9 Math

  6. The students need to give the correct answer (exactly), but don't worry about the Tolerance setting: leave it set to 0.01. Set the Grade to 100%.
  7. I want the students to give their answers to three significant figures, and to that end I needed to click on the Correct answer shows drop-down menu, set that to 3, and change the Format to significant figures:

    Moodle 1.9 Math

  8. Scroll down to the bottom of the page, and click on the Next Page button. You are now taken to the Choose dataset properties page.
  9. The numbers for the variables {a} and {b} will be chosen from a dataset. I want to use my own datasets for each variable. Select will use a new shared dataset for both drop-downs:

    Moodle 1.9 Math

  10. Click on the Next Page button. You are taken to the Edit the datasets page. Now, we can specify the range of values for {a} and {b}:

    Moodle 1.9 Math

  11. We need to add numbers to this dataset. I want to add 20 possible pairs of numbers for {a} and {b}. Scroll down to the Add box, select 20 items from the item(s) drop-down menu and click on the Add button:

    Moodle 1.9 Math

  12. Twenty pairs of numbers are now added to the dataset. Moodle will choose pairs of numbers in this dataset when the student is presented with the question. If you want to alter any of the numbers Moodle has automatically generated for us, you can do so in the second-half of the page. Scroll down to the very bottom of the page, and click on the Save changes button.
  13. Our new calculated question is now added to the question bank:

    Moodle 1.9 Math

To recap, we have seen that creating a calculated question is a two-step process. First, we need to specify the question text. The question text contains variables that Moodle will then replace with random values when the quiz is taken. Then, we need to specify datasets for each of the variables, from which Moodle will choose the values when the quiz is taken. We can have Moodle choose the numbers for us, or we can select our own.

Including an image in the question text

Make your questions more engaging by including an image in the question text. Use the Insert Image button:

Moodle 1.9 Math

You can also include the image by using the Image to display drop-down menu:

Moodle 1.9 Math

Calculated question type: Frequently asked questions

The calculated question type is extremely powerful, which means some settings can seem a little confusing. Below you'll find answers to just a few of the common queries regarding calculated questions:

  • What math functions does the correct answer formula support? Notice that in my Pythagoras example, I squared the base and altitude using the pow() function, and I found the square root using the sqrt() function. For a full list of supported functions, check out
  • How do I specify alternative units? Imagine you have a question that accepts the answer in either centimeters or meters. The calculated question type allows us to accept answers in either unit:

    Moodle 1.9 Math

  • What does it mean if a variable is listed under "Possible wild cards present only in the question text"? If your question contained text, which looked like a variable, or if you included a variable that isn't used in the correct answer formula, then these are listed on the Choose dataset properties page:

    Moodle 1.9 Math

Numerical question type

Simpler to configure than a calculated question, but slightly less powerful, the numerical question type allows us to specify a correct answer along with a tolerance (or accepted error), so that answers within an accepted range are allowed. Let's take a look at another Pythagorean Theorem question I'm creating:

Moodle 1.9 Math

You can see that I've mixed units: the distance from the bottom of the ladder to the foot of the wall is measured in centimeters, and the length of the ladder is given in meters. The question specifies that you must give your answer in meters. However, I'm going to give half marks to students who give their answer in centimeters:

Moodle 1.9 Math

You can also catch the wrong answers:

Moodle 1.9 Math

Additionally, you can keep track of any other possible wrong answer using "*":

Moodle 1.9 Math

As with the calculated question type, scroll down to the bottom of the page and specify unit multipliers, if you wish.

Note that I've started providing some feedback. There's more on feedback later on in this article.

Other question types

In the previous section, we investigated two question types specifically designed to support numeric/mathematical questions. You must have also seen that there is a full range of selection and supply-type questions we can add into the question bank:

  • Multiple Choice: Students select their answer from the available options. There are, in fact, two types of multiple choice questions: single answer and multiple answers (
  • Short-Answer: Students respond with a word or phrase. You will need to specify the correct answers using wild cards, so that Moodle can pick the correct answers out of the responses students have typed. Take a look at Moodle docs for more information (
  • Description: This is not actually a question but a way of breaking up questions—perhaps providing some text/graphics or maybe a video presentation before a student attempts a set of questions.
  • Essay: The student's answer is in essay format. If you are setting your students an assignment, then Moodle already has an 'assignment' activity specifically designed for this purpose. See
  • Matching: The student is presented with questions, each of which has a drop-down list of possible answers. The student must match the correct answer to each question. For more details, see
  • Random Short-Answer Matching: You can choose how many 'sub-questions' are chosen (randomly) from the short-answer questions that are available. See for details.
  • Embedded Answers (Cloze): This is a fill-the-gaps exercise greatly enhanced by virtue of being "computerized". Moodle presents the user with a passage of text that has questions embedded in it. The correct answers complete the text (see
  • Random: This is a completely random question chosen by Moodle.

Import your questions: Hot Potatoes quiz

Are you a Hot Potatoes user? If so, then you can import your Hot Potatoes quiz into your course question bank. With the question bank page open, click on the Import tab. Follow the instructions to import a Hot Potatoes quiz:

Moodle 1.9 Math

Note that you can't import all Hot Potatoes question types (there is no equivalent to the Hot Potatoes crossword question in Moodle, for instance). Also, it's the Hot Potatoes project file you need to import, rather than creating a web page.

Now that we've added questions to the question bank, let's see how to get those questions included in a quiz.

>> Continue Reading Moodle 1.9 Math Quizzes: Part 2


[ 1 | 2 | 3]

You've been reading an excerpt of:

Moodle 1.9 Math

Explore Title