Gapfill question type

From MoodleDocs
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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.

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. The 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 an individual question 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?" 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/24/en/question/type/regexp

No Duplicates Mode

This allows a question in the form Name three examples of X. So you could ask "Name the colors of medals awarded in the Olympic Games". The syntax of the question fields would be [gold|silver|medal] four 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 occurance of the selection. The student will not be warned they have entered duplicates, they just will not get the marks.

Alternative Gapfill Questions

This question was designed to be simpler to use than the core Cloze question type. https://docs.moodle.org/24/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/22/en/question/type/ddwtos

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