Title: Gapfill sample questions
Course: Gapfill Question Type Examples

Q: This question is designed to demonstrate that the gaps can be delimited by characters other than the default square braces. This is useful for questions about programming languages for example where the questions are about arrays in a language that uses square braces. Enter 1 into the gap for the first try to see the hints.

Make the following php code print out the string "cat"

$ar= array('cat','mat');
print $ar[{0}];
- 0
A: 0
If wrong: [Image]Your answer is incorrect.
  Hint: Hint:What number do array places count from?
  Hint: Hint:Remember that php arrays count from zero not one (like most programming languages)

Q: The question uses the no duplicates option. This means a field may accept a range of words but if the same word is entered into more than one field it will only gain one mark for that word. The question syntax uses using the broken bar | operator to indicate the or operation, i.e. the answer can be this or that. So here it has been entered as [gold|silver|bronze] . Here is the question.

What are the medals that can be won in the olympic games?

Enter the same value twice or, e.g. gold, gold, silver. It will mark all answers correct with a tick, but if you notice the score will be 2 rather than three.

{gold|silver|bronze} {gold|silver|bronze} {gold|silver|bronze}
- gold|silver|bronze
- gold|silver|bronze
- gold|silver|bronze
- brown
- pink
- green
A: gold|silver|bronze / gold|silver|bronze / gold|silver|bronze
If partly right: Your answer is partially correct. Note how the actual mark matches the number of unique correct answers whatever the number of ticks is.
  Hint: Have another go
  Hint: Try again

Q: The question uses the no duplicates option. This means a field may accept a range of words but if the same word is entered into more than one field it will only gain one mark for that word. The question syntax uses using the broken bar | operator to indicate the or operation, i.e. the answer can be this or that. So here it has been entered as [gold|silver|bronze] . Here is the question.

What are the medals that can be won in the olympic games?

Enter the same value twice or, e.g. gold, gold, silver. It will mark all answers correct with a tick, but if you notice the score will be 2 rather than three.

{gold|silver|bronze} {gold|silver|bronze} {gold|silver|bronze}
- gold|silver|bronze
- gold|silver|bronze
- gold|silver|bronze
A: gold|silver|bronze / gold|silver|bronze / gold|silver|bronze
If partly right: Your answer is partially correct. Note how the actual mark matches the number of unique correct answers whatever the number of ticks is.
  Hint: Have another go
  Hint: Try again

Q: The complete phrase is "The cat sat on the mat", This version case the case sensitivity option checked so the words cat and mat must be entered as Cat and Mat.

The [Cat] sat on the [Mat]
- Cat
- Mat
A: Cat / Mat

Q: Use of the double !! indicates that a gap must be left blank be considered correct. The !! fields get a mark if left blank and can be thought of as distractors.

Canine | [dog]
Feline | [cat]
Bovine | [!!]
- dog
- cat
- !!
- mouse
A: dog / cat / !!

Q: Accross:

3:Capital city of the UK

4 Grape based alcololic drink

Down

2.Celestial body visitied by Apollo 11

1. Melody part of song (rhymes with 2 down)

 |  |  |  |  |  |  | 1
 |  |  | 2 |  |  |  | [T]
 |  |  | [M] |  |  |  | [U]
 | 3 | [L] | [O] | [N] | [D] | [O] | [N]
 |  |  | [O] |  |  |  | [E]
4 | [W] | [I] | [N] | [E] |  |  |
- T
- M
- U
- L
- O
- N
- D
- O
- N
- O
- E
- W
- I
- N
- E
A: T / M / U / L / O / N / D / O / N / O / E / W / I / N / E

Q: This question has disabled regular expressions. This means that special characters used in regular expressions such as < / * . etc will have no meaning which can be useful when creating questions for maths and programming or HTML (which of course uses the < and > characters extensively).

2[+]2=4
4[/]2=2

The option for disable regex can be found in the More Options in the question editing form.

Complete the syntax for this for loop in PHP

for($i=0;$i[<]10;$++){

print($i);

}
- +
- /
- <
A: + / / / <
  Hint: Have another go
  Hint: One more try

Q: [Image] | The complete phrase is "The cat sat on the mat". This question has been created simply by surrounding the "missing" words with square braces like this

The [cat] sat on the [mat]

Although this is a "drag and drop" version, you can simply type into the fields, which may be useful when using a mobile browser. Note the draggable clues are shuffled each time a new quiz session starts. The Options after text option has been checked so the draggable option answers appear after the text.

Drag the correct words into the gaps.

The {cat} sat on the {mat}
- cat
- mat
- rat
- bat
- rug
- hat
A: cat / mat
If wrong: Your answer is incorrect. You need to brush up on your knowledge of feelines in the domestic sphere. [Image]
Feedback: This text is from the general feedback section of the question editing form.
  Hint: Hint1: The answer refers to a feline and a floor covering. Note how the incorrect answers are cleared after you press the try again button. This hint DOES show the number of correct answers and so each field has an indicator of correctness or incorrectness via tick/cross colour
  Hint: Hint2: The answer refers to a domestic feline and a floor covering that rhymes with bat. The show number of correct responses option is not ticked for this.

Q: This demonstrates comparing basic maths symbols and depends on DisableRegex (regular expressions) being checked.

What is the greater than symbol [>]

What is the less than symbol [<]

What is the addition symbol [+]

What is the minus symbol [-]

What is the multiply symbol [*]
- >
- <
- +
- -
- *
- !
- ?
A: > / < / + / -

Q: [Image] | The complete phrase is "The cat sat on the mat", but this time the word options are in dropdowns.

The [cat] sat on the [mat]
- cat
- mat
- bat
- rug
A: cat / mat
  Hint: Have another go. There is no indication of what answers are correct or incorrect because the show the number of correct responses box is not checked in hint 1.
  Hint: One last time. The Show the number of correct responses box was checked and so you have the background colour and symbols (tick/cross) to indicate which answers were correct.

Q: This question has the fixedgapsize setting checked so that all gaps are the size of the biggest gap. This means that the size of the gap does not give a clue to the correct answer.

The [kangaroo] is a native of Australia, the Kiwi is a native of [New] Zealand
- kangaroo
- New
- old
- Panda
A: kangaroo / New

Q: The complete phrase is "The cat sat on the mat", This version has no prompts (i.e. no dragdrop or dropdowns displayed).

A question can be converted from showing prompts to no prompts by a simple selection in the question edit screen. This can be used to create an easy (with prompts version) and then copying it, making that change and you will then have a harder (no prompts) version.

The [cat] sat on the [mat]
- cat
- mat
A: cat / mat
  Hint: Have another go
  Hint: One last try

Q: This question has Fixed Gap Size and No Duplicates set. The Canine row values include a !! to allow for one field to be left blank in order to get all 4 marks.

Feline | [tiger|lion] | [tiger|lion]
Canine | [dog|!!] | [dog|!!]
- tiger|lion
- tiger|lion
- dog|!!
- dog|!!
- cow
- mouse
A: tiger|lion / tiger|lion / dog|!! / dog|!!

Q: You can offer groups of answer fields to be dragged in its appropriate category or group. For example a language teacher might offer words that are dragged into the gender categories or biologists could offer options to be dragged into the categories of animals, e.g. canine, feline and . The key to this is using the | (or) operator. The second canine column contains the double not !! as follows [dog|!!] to allow a blank as a correct option.

Feline | Canine
{tiger|lion} | {dog|!!}
{tiger|lion} | {dog|!!}
- tiger|lion
- dog|!!
- tiger|lion
- dog|!!
- rat
- swallow
- kangaroo
A: tiger|lion / dog|!! / tiger|lion / dog|!!
  Hint: Try again
  Hint: Have another go

Q: [Image] | [apple]
[Image] | [pear]
- apple
- pear
- orange
- pineapple
A: apple / pear

Q: This question is designed to test the way draggable options are displayed when there are large numbers, i.e. how they are displayed and wrapped.

The cat [sat] on the mat. The cow [jumped] over the moon. The town of [Lancaster] is a town in the north of the UK. The city of [Edinburgh] is in Scotland. The [water] is wide, I can't swim over. Can [anyone] suggest a better collection of [long] words?
- sat
- jumped
- Lancaster
- Edinburgh
- water
- anyone
- long
- twelve
- thirteen
- fourteen
- fifteen
- sixteen
- hat
- bat
- rat
- lumped
- banked
- tried
- elephant
- moodle
- causation
- mathematics
- coffee
- triumph
A: sat / jumped / Lancaster / Edinburgh / water / anyone / long

Q: What is the greater than sign [>]

What is the less than sign [<]

What is the addition symbol [+]

What is the subtraction symbol [-]

What is the multiplication symbol? [*]

[10² ]=100
Note that the raising to powers and backslash were entered using the HTML unicode strings.
For example the squared string is &#178; However these must be entered into the editor with HTML mode turned off otherwise it will "interpret" the strings, i.e. put in &amp instead of plain & and it will not display correctly at runtime.
- >
- <
- +
- -
- *
- 10²
- ?
- !
- /
- 10³
A: > / < / + / - / 10²

Q: This illustrates answers containing more than one word

The answer is "the black cat sat on the soft mat"

The [black cat] sat on the [soft mat]
- black cat
- soft mat
A: black cat / soft mat

Q: The gapfill question type can be used with non ASCII characters. For example the Cyrillic alphabet.

Moscow is the capital of [Россия]

The french word garçon has an accent on the letter c [garçon]
- Россия
- garçon
- France
- garcon
A: Россия / garçon

Q: This question illustrates that following a letter with a question mark ? will make it optional. The following gap will accept colours, colour, colors and colors as correct answers, so allowing both US and UK spelling of the word. If you look at the source of this question this gap contains colou?rs?

Red, Green and Blue are examples of {colou?rs?}

This gap illustrates how you can "escape" the special characters used in regular expressions such as the dollar sign by preceeding them with a backslash i.e. \$. The correct answer for this gap is the $ symbol.

The special character that indicates the start of a variable in PHP is the {\$} sign. (enter the $ sign)

The HTML tag to start a paragraph is {\<p\>} (enter <p>)

Note there is an option under more options to switch off regular expression for the whole question, but escaping is useful where you need some regex processing.

You can ensure any spare spaces between words are ignored with \s

The correct answer here is black and white but it will accept the words with one or more spaces between them {black\s+and\s+white}.

Moodle has two short answer question types that support regular expressions

Preg

http://docs.moodle.org/25/en/question/type/preg

and

Regular Expression Short Answer

https://moodle.org/plugins/view.php?plugin=qtype_regexp
- colou?rs?
- \$
- \<p\>
- black\s+and\s+white
A: colou?rs? / \$ / \<p\> / black\s+and\s+white

Q: You can troubleshoot a question by clicking the "fill in correct responses" button in preview mode.

This question does not [work] because there are hidden html tags within the field, you can view (and delete) the hidden div tags by clicking the HTML button on the editor bar.
- work
A: work

Q: Answers may contain commas and commas can be used in distractors by escaping them with the backslash like this \,

What are the colors of the French flag? | [Image]

It's [ blue, white, red ]
- blue, white, red
- orange\, white\, red
- green\, white\, black
A: blue, white, red

Q: This is an example of the core question type Drag Drop Words Into Text question type. It is included here to make it easy to compare with the Gapfill as it has similar functionality. The question to be answered is to add verbs to the gaps.

The cat [...] on the mat. The cow [...] over the moon.
Also offered: brown; sky; horse; mouse
A: sat; jumped