Embeddable Moodle Quiz questions!

News from the OU Quiz Development Shed — July 2018

OU Learning Systems
7 min readJul 19, 2018

Alright, we don’t actually work in a shed. We don’t even have enclosed offices (we went open plan over a decade ago). Anyway, that’s not important; what is important is that we’ve been working on a new Moodle Quiz feature: embeddable quiz questions.

Free the quiz question!

The idea to free the quiz question first came up bout a decade ago, so it’s great that we were finally able to spec it out and deliver it. Now academics and quiz authors can embed informal quiz questions wherever they wish in Moodle, no longer interrupting a student’s reading flow, at least compared to the reader having to click out to a question, answer it, and then click back to the material.

One nifty idea (although we haven’t piloted it ourselves yet) is to embed a CodeRunner question into a forum on one of our Technology modules. In CodeRunner, students code a solution to a problem which is graded by validation against test criteria — as long as the code passes the tests, it’s correct. There are ‘model’ answers, but no single ‘correct’ method. By embedding such a question directly in a forum, students could then discuss their solutions, reflect on the solutions of others, and come up with their own model answer.

So how does it work?

Unsurprisingly, it starts with a question within a category. The system needs an easy way to identify them, so we’re implementing ID fields.

As a new development, there’s still some rough edges that will need polishing. For now, we’re using the category and question names (the text fields) to store the ID until they can be moved into the category/question forms as proper fields.

Using category IDs makes it harder to accidentally embed the wrong question, but still provides flexibility with Question Bank hierarchies. Some courses might simply use an ‘Embeddable’ category for all of their questions, while others may break their course down into weekly or topic-based categories and sub-categories.

But for now, if no ID field is detected, the category/question name is checked for “[ID:abc]”, where abc = the unique identifier.

That ID is then used to ‘embed’ the question in an IFrame, although what it is really doing is displaying the question from the Question Bank within the content.

What does the embedding process look like?

In this screenshot we have an example question, with both category and question IDs clearly visible:

A Question bank, showing both category and question IDs

With the question created and identified, it can now be embedded anywhere in Moodle where there is an ATTO Text Editor bar, using the ‘Embed question’ icon.

A Moodle Page (content is filler, not OU material)

The ‘Embed question’ button opens the following dialogue, although the second and third sections are collapsed — here they are shown expanded to show the default options. Essentially, most users would just need to select the category and question needed.

The ‘Embed question’ dialogue, fully expanded and showing all default options
The categories shown are only those with an ID
The questions shown are only those within the selected category *and* have an ID

Once the question has been selected, any changes to the attempt and display options made, and the ‘Embed question’ button pressed, the question embed code is added to the editable content area.

Content area showing the embedded question code

Note that a 40-character hex string is generated as part of the embed code. This stops others from guessing it. There’s therefore no sneaky way for other users to view formal (e.g. summative) test questions through this enhancement.

What does an embedded question look like?

It should look exactly like the question does if it was viewed in Moodle Quiz.

Continuing the earlier example of a Page with some text and then an embedded question, the saved content looks like the following.

Student view of the content and question

Interaction is exactly the same as if it was a normal question within a Moodle Quiz activity (the default behaviour is Interactive with Multiple Tries).

Student view of the question with feedback

There’s a couple of important things to note, though:

  • Embedded questions appear within an IFrame, although this should be invisible to users. The frame will automatically resize to fit the question content.
  • After the student submits a response, there will be a ‘Start again’ button to restart the question.
  • If the question has variants, and the variant number is not fixed, then a different variant will be chosen when the question is restarted.
  • As the embedded quiz questions responses are for informal quizzing, if a student navigates away and back, the question will be restarted automatically.
  • Should work with most question types, except Essay.
  • Embedded questions will not work with Guests.

Doesn’t the OU use its own content publishing system as well?

Yes, it’s called Structured Content, an XML-based publishing system that offers various outputs, including web content (analogous to Moodle’s Lesson activity), PDFs, and EPUB3s.

Using exactly the same process , we can embed a question into Structured Content using <MediaContent> tags (and setting parameters just like the ATTO embed interface). The result is web content as shown in the following screenshot (which is an internal test document).

Structured Content with an embedded CodeRunner question (students don’t see the ‘Document info’ or ‘Administration’ blocks).

Using embedded questions

Designed for informal single questions

Our expected use of this functionality is for single questions to be embedded within learning materials. For this reason, we expect questions to be for informal use as part of a consolidation and/or reflection activity, and therefore there is no need for responses/scores to be recorded. Formal assessments (which may go under various names, such as ‘Tests’, ‘Computer-Marked Assessments’ etc.) would and should still happen in full Moodle Quiz activities.

It is possible to embed multiple questions in succession, although as each IFrame is independently processed by the web browser, multiple embedded questions can slow down the rendering of the webpage for the user. You could instead use a Combined question to present various sub-questions as a single question, though.

If you want to embed several questions on a single page, the system won’t stop you from doing so (although students might be annoyed by the slow page rendering) — but you would really be better off continuing to use Moodle Quiz for asking multiple questions.

A note on security and data retention

As already mentioned, the use of both category and question IDs are used to produce unique IDs for embeddable questions.

  • The question must exist in the Question Bank of the course website you are embedding the question in.
  • If you want to embed questions on a site-wide page, they need to go in the ‘Front page’ area of the Question Bank.
  • IDs are limited to under 100 characters, and should not include slashes or spaces. It is recommended that you restrict IDs to include alphanumerical (upper and lower-case letters) characters and underscores (_) or dashes (-) only.

Only users with Tutor or higher roles will see the ‘Embed question’ button in the ATTO Text Editor.

Regarding data retention, all normal question interactions are written to the database, but not permanently. If the student navigates away from the webpage and later returns, they will find that the embedded question has reset itself. The data stored in the database is automatically removed after 24 hours, although the exact period is configurable.

Future plans and directions

We’re planning the pilots at the moment, and faculty feedback will shape our future direction. However, some of the conversations following early internal demonstrations have been around fully embedding Moodle Quiz questions as self-contained assets, so that offline questions (or even quizzes) would be part of our EPUB3 files — of course that also depends on the Moodle App and how it handles offline quizzes, which we’ll be investigating soon.

We’ll announce more as we explore the options; all we can say is “Stay tuned for more News from the OU Quiz Development Shed!”

This post was written by Chris Nelson, the Product Development Manager for Digital Assessment within the Learning Systems team at The Open University (UK), with assistance from Tim Hunt, who is a Senior Lead Developer in IT, and also the Moodle Quiz maintainer.

A big thanks from Chris and Tim to the other members of the team: Mahmoud Kassaei and John Beedell, and our Scrum Master, David Wort.

--

--

OU Learning Systems

Exploring and developing learning systems at the Open University. This is an informal account where we can let you know what we're up to. Our views alone.