Note: You are currently viewing documentation for Moodle 2.5. Up-to-date documentation for the latest stable version of Moodle may be available here: Gapfill question type.

Gapfill question type

From MoodleDocs
Revision as of 11:30, 19 May 2014 by Helen Foster (talk | contribs) (Tsala moved page question/type/gapfill to Gapfill question type: nicer title)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


The Gapfill Question Type

The gapfill question type allows the creation of questions with multiple answers by using special characters. For example The [cat] sat on the [mat] will create a question with two gaps where the answers are cat and mat. This type of question can be useful for teaching languages. Gapfill Edit

By default the student will see the questions in dragdrop mode where they can use the mouse to drag the answers from a displayed list into the matching field. When a student is answering one of these questions javascript only updates the text contents of the field, so even in this mode it is possible to type the answers into the field.

At Runtine

Gapfill runtime


There is a drop down list of alternative delimiting characters ## {} and @@ which will allow a question in the form The {cat} sat on the {mat}. It is possible to select dropdown or gapfill mode. Dropdown shows a list of all possible answers in each field and gapfill shows only an empty field with no list of options to select.

By default marking is not case sensitive. So if the student enters CAT in a field of the form [cat] it will be considered correct. The editing form has an option to make the marking process case sensitive.

Each (correct) field is worth exactly 1 mark, so The [cat] sat on the [mat] has a maximum possible score of 2 marks. There is no concept of negative marking. The question supports the standard behaviours, hinting and combined feedback options.

Gapfill complete


The editing form offers a field for adding wrong or distractor options. These only make sense in dragdrop or dropdown mode. Wrong answers must be entered as a comma delimited list and a shuffled list of correct and incorrect answers will be displayed with the question.

Regular Expressions

It is possible to use regular expressions in answers, for example if you wanted both the use and UK spelling of colour as an answer you could add a field with the broken bar operator to act as an OR as in "What [color|colour] is the sky?". You can search for any string that starts with c and ends with r as "What [c.*r] is the sky". More complex regular expressions should also work.

You could use regular expressions to mitigate common spelling errors, e.g. {cal[e|a]ndar} (note the selection of alternative delimiters to get around the use of the square brackets in the operator. This question type makes no attempt to check the validity of your regular expressions. You can read more about using regular expressions in the documentation for the PReg type see https://docs.moodle.org/24/en/Preg_question_type and also https://docs.moodle.org/25/en/Regular_Expression_Short-Answer_question_type

Show Correct Responses

In interactive mode (set in the question behaviour of the quiz) it is possible to have a question indicate the number of questions that are correct and for this to be displayed for each field. This takes the form of red/green background colour and a tick or cross. To make this happen check the "show number of correct responses option" in the hint field under the multiple tries option.

hints r


No Duplicates Mode

This allows a question in the form Name three examples of X. So you could ask "Name the colours of medals awarded in the Olympic Games". The syntax of the question fields would be [gold|silver|bronze] three times. Note the separator is the broken bar character which acts as an OR operator. Make sure you select gapfill mode for this type of question.

By checking the No duplicates box in the question editing form, when it comes to marking any duplicates will be discarded. Correct answers will still be displayed with a green check/tick (as they are actually correct), but marks will only be awarded for the first occurrence of the selection. As of version 1.1, when this happens the background of the duplicated values will be displayed in yellow and a message added to the feedback will say "Credit is partial because you have duplicate answers".


Duplicate answers

Alternative Gapfill Questions

This question was designed to be simpler to use than the core Cloze question type. https://docs.moodle.org/25/en/Embedded_Answers_(Cloze)_question_type however the gapfill type has fewer features than the Cloze type.

The OU (UK Open University) has two Moodle Question Types that covers similar ground. https://docs.moodle.org/25/en/question/type/ddwtos and

https://docs.moodle.org/25/en/question/type/gapselect