Gapfill question type
|Gapfill question type|
- Managing questions
- Question behaviours
- Question types
- Simple Calculated
- Drag and drop into text
- Drag and drop markers
- Drag and drop onto image
- Calculated Multichoice
- Embedded Answers (Cloze)
- Multiple Choice
- Random Short Answer Matching
- Select missing words
- Third-party question types
- Questions FAQ
- 1 Installing this question type
- 2 The Gapfill Question Type
- 3 At Runtine
- 4 In the Mobile App
- 5 Regular Expressions
- 6 Show Correct Responses
- 7 No Duplicates Mode
- 8 Tables with category columns
- 9 Tables with images
- 10 Gapfill crossword
- 11 Disable Regex
- 12 Fixed Gapsize
- 13 Double Not
- 14 Extended Characters
- 15 Use in modules other than quiz
- 16 Alternative Gapfill Questions
Installing this question type
Follow the generic Installing plugins documentation.
The Gapfill Question Type
Put square braces around the missing words
The [cat] sat on the [mat]
Which will create a question with two gaps where the answers are cat and mat. Although it was designed with the idea of single missing words it will accept a sequence of words with spaces between them in the gaps. This type of question can be particularly useful for teaching languages. The question type ships with a file called sample_questions.xml which illustrates the various ways it can be used. You can get the text of this file from this link https://raw.githubusercontent.com/marcusgreen/moodle-qtype_gapfill/master/sample_questions.xml and you can find instructions on how to import questions from this type of file here https://docs.moodle.org/32/en/Import_questions#Importing_questions_from_an_existing_file
It does not work with the Moodle mobile app and there are no current plans to make it work with it.
This is how the same question will appear with dropdown lists.
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. If an incorrect answer is entered and if display right answer has been selected in the quiz review options the correct answer will be shown next to the gap within braces as in the following screen shot.
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. If you need commas to appear in your distractors they can be escaped with a backslash \,
In the Mobile App
Code is under development to allow this question type to run within the Mobile App. This will follow the pattern set by the core Drag and drop into text question type. Instead of dragging answers into gaps, the answer will be clicked to select and then a gap will be clicked to drop into. Clicking away from an answer and into a gap will allow a gap to be cleared. In the screen shot the word New has been selected ready to drop into the second gap.
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. Note, that if you have given an incorrect answer it will not show what the correct answer is. You can of course put in the text of the whole including all correct answer into the "For any partially correct response" text area in the combined feedback section.
No Duplicates Mode
Tables with category columns
This screen shot shows how the question text appears in the editor. Note that the shading for the heading row is done by including <th> tags for the first row instead of <td> tags and by setting the class table tag as <table class=gapfilltable>, The gapfilltable class is supplied in the css for the question type. If you are using the HTML editor, switch to HTML mode and paste in the following code as an example.
Tables with images
It is a bit of a fiddle but it is not wildly difficult. You might also be able to do this with the core Cloze question type, but the source text would probably be a bit ugly.
In order to make the above crossword you would need to:
- Write in paper (preferably using a lined or graph paper) the completed crossword.
- Make a new Gapfill question instance
- Type the relevant instructions (if necessary)
- Type the Across and Down definitions of the words that the user must guess.
- Build a table with the proper number of rows and columns.
- Leave the empty table cells empty.
- Populate the interesting parts of the table with either
- a fixed character (if you will be helping the reader, as most crosswords do)
- or each character to be guessed enclosed within square brackets.
- Save your question and preview
- Fix mistakes (if present)
- Try as a student
Here is the HTML code that was used to create that example. Note that the gapfillcol class ships with the question type and sets the light grey background among other things. It is probably easiest to create the table/grid using the Moodle built in Atto editor and then tweak the HTML code afterwards.
<table class="text-center gapfillcol" border="1"> <tbody> <tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>1</td></tr> <tr><td></td><td></td><td></td><td>2</td><td></td><td></td><td></td><td>[T]</td></tr> <tr><td></td><td></td><td></td><td>[M]</td><td></td><td></td><td></td><td>[U]</td></tr> <tr><td> </td><td>3</td><td>[L]</td><td>[O]</td><td>[N]</td><td>[D]</td><td>[O]</td><td>[N]</td></tr> <tr><td></td><td></td><td></td><td>[O]</td><td></td><td></td><td></td><td>[E]</td></tr><tr><td> 4 </td><td>[W]</td><td>[I]</td><td>[N]</td><td>[E]</td><td></td><td></td><td></td></tr> </tbody> </table>
When this is checked all gaps will be set to the size of the largest gap. If the gap includes the or operator | the size will be set to the widest of the words used.
The use of !! indicates that a gap can be left empty and considered a correct response.
This is of particular use with the | or operator where one or more answers or a blank will be considered correct e.g. [cat|dog|!!].
Gapfill will only work with characters that will display in a standard HTML form. This means it will not render any HTML or LaTeX. It should be possible to display unicode characters such as these examples of "powers".
What is ten to the power 3?[10³]
What is ten to the power 4?[10⁴]
What is ten to the power 5?[10⁵]
What is ten to the power 6?[10⁶]
What is ten to the power 7?[10⁷]
What is ten to the power 8?[10⁸ ]
What is ten to the power 9?[10⁹]
Note: You can use some HTML codes inside gapfill questions, but you must first click on the <> button to show HTML code. Please note that you could actually type most of these codes directly. The following HTML codes are available:
- non-breaking space i.e. a space but there will never be a line-break inserted instead of this space at the end of a line
&- ampersand sign (&)
&apos- apostrophe sign (')
©- copyright sign (©)
±- "plus or minus" sign (±)
×- multiply sign (*)
÷- divide sign (/)
>- "greater than" sign ( > )
<- "less than" sign (<)
«- quotation mark (‘)
&lsquo- left single quotation sign (‘)
&rsquo- right single quotation sign (’)
Use in modules other than quiz
Alternative Gapfill Questions
The OU (UK Open University) has two Moodle Question Types that covers similar ground. Since Moodle 3.0 these have been in core Moodle: