WeBWorK Moodle Question Type

From WeBWorK_wiki
Revision as of 20:04, 15 May 2014 by Gage (talk | contribs) (→‎Credit)
Jump to navigation Jump to search

This application is a question type within Moodle. It allows WeBWorK questions to be used in various modules in Moodle. Most notably you can assign WeBWorK questions within a Moodle quiz. This allows a teacher to assign timed quizzes for homework, weekly problem sets, and/or practice exercises. From the perspective of a user who is new to WeBWorK or already comfortable with Moodle this is the recommended application for integration with WeBWorK.


A sample of what this application does is available at http://question2.webwork.rochester.edu/moodle. A test course has been set up and you can log in as either a teacher or a student.

The teacher:

   User: testteacher
   Pass: testteacher

The student:

   User: teststudent
   Pass: teststudent

Please do not use the importer with more than a couple questions. Also, this is on the server I use for development so the webserver might go down every now and then.


  • Question Importer & Set Definition Importer.
  • Ability to ask WeBWorK questions in Moodle Quizzes.
  • Supports a very large majority of preexisting WeBWorK questions.
  • Ability to mimic a WeBWorK problem set by setting Moodle Quiz options correctly.
  • WeBWorK system installation is not needed.
  • Debugger for the creation of WeBWorK questions.
  • Simple to install and configure.
  • Designed in a distributed fashion to allow for load balancing on large sites.


These are current limitations of this Moodle question type over the original WeBWorK system. They are being corrected slowly.

  • No way to select individual seeds in the preview pane.
  • No Adobe PDF print option for a question.
  • Questions using radio buttons are not supported.
  • Questions using external files are not supported.


More detailed procedure: WeBWorK Moodle Question Type Installation.


This section will go over basic use of the question type. Some knowledge of how Moodle works is presumed. If you have never used Moodle before the following resources are helpful.

In particular the WeBWorK Question Type uses the Quiz Module. If you aren't familiar with this module a good resource is chapter 5 of the Moodle Book. At first things can be a bit overwhelming, but I find the best way to learn is to just install the software and explore!

Loading a WeBWorK Question

This procedure explains how to load a WeBWorK question into your Moodle question bank.

  1. Click on the 'Questions' link under 'Administration' on the main course page.
  2. Click on the 'Create New Question' drop down and navigate to 'WeBWorK'. The editing page will now load.
  3. Enter a name for your new question in 'Question name' field.
  4. Paste in the PG code for the question into the 'Code' text area.
  5. Submit.

Assuming all goes well you will be back on the page for the question bank. If there were errors you will be taken back to the edit question page. Moodle will box the field in red that is causing problems. PG code errors and warnings are displayed above the 'Code' text area.

Importing WeBWorK Questions

With SVN revision 18, importer support was added. For information on how to import multiple questions into the Moodle question bank go to: WeBWorKMoodleQuestionTypeImporter

Importing WeBWorK Set Files

With SVN revision 20, support for importing 'def' files was added. For more information on importing set files go to: WeBWorKMoodleQuestionTypeImporter

Previewing a WeBWorK Question

You can preview a WeBWorK Question by clicking the magnifying glass icon next to the question name. A small window will open with the rendered question. Here you can test if the question is mathematically correct. If you click the 'Start Again' button or reopen the preview window a different seed with different numbers will be rendered.

Using a WeBWorK Question in a Quiz

A WeBWorK question inside a Moodle quiz. You utilize WeBWorK questions in quizzes in the same way as you add any other question type into a quiz. There are a few points to be aware of.

  • Do not delete questions that are in Moodle quizzes.
  • If you need to modify a question that is being used by a Moodle quiz do not reduce the 'trials' value.

Making a Moodle Quiz act like a WeBWorK Problem Set

The Moodle Quiz module has many more features than WeBWorK. By switching some options we can make the Quiz deliver the exact same user experience as a default WeBWorK problem set. The default WeBWorK problem set is defined by the following features:

  • No penalties for wrong answers.
  • Students can attempt problems unlimited times.
  • Problems always carry the same seeds.
  • Sets have open and closing dates.

To make a Quiz act like a problem set flip the following options in the Quiz settings page.

  • Enable the 'Open Quiz' and 'Close Quiz' fields.
  • The 'Open Quiz' date is equivalent to the set open date in WeBWorK.
  • The 'Close Quiz' date is equivalent to the set due date in WeBWorK.
  • Setting 'Questions per Page' to 1 will simulate WeBWorK's policy of having only one question per page.
  • Change 'Each Attempt Builds on the last' to Yes.

After you switch these fields to the above values the Moodle quiz will act like a WeBWorK problem set. The one difference is that students must click the 'submit all and finish' button when they are done with the quiz. They can still modify their answers afterwards since answers will persist between attempts. Still, the last action a student should take is to submit the quiz.


Designed by Matthew Leventi at the University of Rochester. Kudos to Mike Gage, Arnold Pizer, University of Rochester ITS, Jean-Marc Roy, Andrew Sveikauskas, Andrew Ziobro, Spyro Roubos, Matthew Conomos and others.