1 <h1>Importing
"GIFT" format files
</h1>
2 <p>GIFT is the most comprehensive import format available for importing
3 Moodle quiz questions from a text file. It supports Multiple-Choice,
4 True-False, Short Answer, Matching and Numerical questions, as well as insertion
5 of a _____ for the Missing Word format. Various question-types can be
6 mixed in a single text file, and the format also supports line comments,
7 question names, feedback and percentage-weight grades.
</p>
9 <p>The text encoding of your text file must be utf-
8 (unless you only use ascii characters).
10 An example questions text file can be found here:
<a href=
"<?php echo $CFG->wwwroot; ?>/question/format/gift/examples.txt">gift
/examples
.txt
</a
>.</p
>
14 <p
>Each individual question in the GIFT file must not contain any blank lines
. Each question is delimited by
15 at least one blank line
. If you need to represent a blank line in your question you can
use
16 the entity
<b
>\n</b
>. You can
use comments wherever you wish but they must start with two forward
17 slashes (<b
>//</b>) at the start of the line.</p>
19 <h3
>QUESTION TYPES
</h3
>
21 <p
><u
>Multiple Choice
:</u
><br
/>
22 For multiple choice questions
, wrong answers are prefixed with a
tilde (~
)
23 and the correct answer is prefixed with an equal
sign (=).</p
>
25 Who
's buried in Grant's tomb?
{~Grant ~Jefferson
=no one
}
27 <p
>The
<b
>Missing Word
</b
> format automatically inserts a fill
-in
-the
-blank
line (like this _____
) in the middle of the sentence
.
28 To
use the Missing Word format
, place the answers where you want the line to appear in the sentence
.</p
>
30 Grant is
{~buried
=entombed ~living
} in Grant
's tomb.
32 <p>If the answers come before the closing punctuation mark, a fill-in-the-blank line will be inserted
33 for the "missing word" format. All question types can be written in the Missing Word format.</p>
34 <p>There must be a blank line (double carriage return) separating questions.
35 For clarity, the answers can be written on separate lines and even indented. For example:</p>
37 The American holiday of Thanksgiving is celebrated on the {
41 } Thursday of November.
43 Japanese characters originally came from what country? {
51 <p><u>Short Answer:</u><br />
52 Answers in Short Answer question-type are all prefixed by an equal sign (=),
53 indicating that they are all correct answers. The answers must not contain a tilde.</p>
55 Who's buried in Grant
's tomb?{=no one =nobody}
57 Two plus two equals {=four =4}.
59 <p>If there is only <u>one</u> correct Short Answer, it may be written without the equal sign prefix,
60 as long as it cannot be confused as True-False.</p>
62 <p><u>True-False:</u><br />
63 In this question-type the answer indicates whether the statement is true or false.
64 The answer should be written as {TRUE} or {FALSE}, or abbreviated to {T} or {F}.</p>
66 Grant is buried in Grant's tomb
.{F
}
68 The sun rises in the east
.{T
}
71 <p
><u
>Matching
:</u
><br
/>
72 Matching pairs begin with an equal
sign (=) and are separated by this symbol
"->". There must be at least three matching pairs
.</p
>
75 =subquestion1
-> subanswer1
76 =subquestion2
-> subanswer2
77 =subquestion3
-> subanswer3
80 Match the following countries with their corresponding capitals
. {
87 <p
>Matching questions
do not support feedback
or percentage answer weights
.</p
>
89 <p
><u
>Numerical
:</u
><br
/>
90 The answer section
for Numerical questions must start with a number
sign (#).
91 Numerical answers can
include an error margin
, which is written following the correct answer
, separated by a colon
.
92 So
for example
, if the correct answer is anything between
1.5 and 2.5, then it would be written
as follows
<u
>{#2:0.5}</u>.
93 This indicates that
2 with an error margin of
0.5 is
correct (i
.e
., the span from
1.5 to
2.5).
94 If no error margin is specified
, it will be assumed to be zero
.</p
>
96 When was Ulysses S
. Grant born?
{#1822}
98 What is the value of
pi (to
3 decimal places
)?
{#3.1415:0.0005}.
100 <p
>Optionally
, numerical answers can be written
as a span in the following format
{#<i>MinimumValue</i>..<i>MaximumValue</i>}.</p>
102 What is the value of
pi (to
3 decimal places
)?
{#3.141..3.142}.
104 <p
>Moodle
's browser interface does not support multiple numerical answers, but Moodle's code can
and so does GIFT
.
105 This can be used to specify numerical multiple spans
, and can be particularly usefully when combined with percentage weight grades
.
106 If multiple answers are used
, they must be separated by an equal sign
, like short answer questions
.</p
>
108 When was Ulysses S
. Grant born?
{#
113 <p
>Note that since Moodle
's browser GUI doesn't support multiple answers
for Numerical questions
,
114 there
's no way to see them or edit them through Moodle.
115 The only way to change a numerical answer beyond the first, is to delete the question
116 and re-import it (or use something like phpMyAdmin).</p>
118 <p><u>Essay:</u><br />
119 An essay question is simply a question with an empty answer field. Nothing is permitted
120 between the curly braces at all.</p>
122 Write a short biography of Ulysses S. Grant {}
125 <p><u>Description:</u><br />
126 A description "question" has no answer part at all</p>
128 The next set of questions will concern arithmatic
133 <p>In addition to these basic question types, this filter offers the following options:
134 line comments, question name, feedback and percentage answer weight.</p>
136 <p><u>Line Comments:</u><br />
137 Comments that will not be imported into Moodle can be included in the text file.
138 This can be used to provide headers or more information about questions.
139 All lines that start with a double backslash (not counting tabs or spaces) will be ignored by the filter.</p>
141 // Subheading: Numerical questions below
142 What's
2 plus
2?
{#4}
145 <p
><u
>Question Name
:</u
><br
/>
146 A question name can be specified by placing it first
and enclosing it within
double colons
.</p
>
148 ::Kanji Origins
::Japanese characters originally
149 came from what country?
{=China
}
151 ::Thanksgiving Date
::The American holiday of Thanksgiving is
152 celebrated on the
{~second ~third
=fourth
} Thursday of November
.
154 <p
>If no question name is specified
, the entire question will be used
as the name by
default.</p
>
156 <p
><u
>Feedback
:</u
><br
/>
157 Feedback can be included
for each answer by following the answer with a number
sign (# also known as a hash mark) and the feedback.</p>
159 What
's the answer to this multiple-choice question? {
160 ~wrong answer#feedback comment on the wrong answer
161 ~another wrong answer#feedback comment on this wrong answer
162 =right answer#Very good!
165 Who's buried in Grant
's tomb? {
166 =no one#excellent answer!
167 =nobody#excellent answer!
170 Grant is buried in Grant's tomb
.{FALSE#Wrong, No one is buried in Grant's tomb.#Right, well done.}</pre>
171 <p
>For Multiple Choice questions
, feedback is displayed only
for the answer the student selected
.
172 For short answer
, feedback is shown only when students input the corresponding correct answer
.
173 For true-false questions
, there can be one
or two feedback strings
. The first is shown
if the
174 student gives the wrong answer
. The second
if the student gives the right answer
.</p
>
176 <p
><u
>Percentage Answer Weights
:</u
><br
/>
177 Percentage answer weights are available
for both Multiple Choice
and Short Answer questions
.
178 Percentage answer weights can be included by following the
tilde (for Multiple Choice
) or
179 equal
sign (for Short Answer
) with the desired percent enclosed within percent
signs (e
.g
., %50%
).
180 This option can be combined with feedback comments
.</p
>
182 Difficult question
.{~wrong answer ~%50%half credit answer
=full credit answer
}
184 ::Jesus
' hometown::Jesus Christ was from {
185 ~Jerusalem#This was an important city, but the wrong answer.
186 ~%25%Bethlehem#He was born here, but not raised here.
187 ~%50%Galilee#You need to be more specific.
188 =Nazareth#Yes! That's right
!
191 ::Jesus
' hometown:: Jesus Christ was from {
192 =Nazareth#Yes! That's right
!
193 =%75%Nazereth
#Right, but misspelled.
194 =%25%Bethlehem
#He was born here, but not raised here.
196 <p
>Note that the last two examples are essentially the same question
, first
as multiple choice
and then
as short answer
.</p
>
198 <p
><font size
="-1">Note that it is possible to specify percentage answer weights that are NOT
199 available through the browser
interface. The
<b
>Match Grades
</b
> drop
-down on the import
200 page determines how these are handled
. You can either request that an error be reported
201 or that the answer weight be adjusted to the nearest valid answer weight
.</font
></p
>
203 <p
><u
>Specify text
-formatting
for the question
</u
><br
/>
204 The question
text (only
) may have an optional text format specified
. Currently the available formats are
205 <b
>moodle
</b
> (Moodle Auto
-Format
), <b
>html
</b
> (HTML format
), <b
>plain
</b
> (Plain text format
) and
206 <b
>markdown
</b
> (Markdown format
). The format is specified in square brackets immediately before the
207 question text
. <a href
="help.php?file=textformat.html">More information on text formats in Moodle
.</a
></p
>
210 [markdown
]The
*American holiday of Thanksgiving
* is celebrated on the
{
214 } Thursday of November
.
218 <p
><u
>Multiple Answers
:</u
><br
/>
219 The Multiple Answers option is used
for multiple choice questions when two
or more answers must
220 be selected in order to obtain full credit
. The multiple answers option is enabled by assigning
221 partial answer weight to multiple answers
, while allowing no single answer to receive full credit
.</p
>
223 What two people are entombed in Grant
's tomb? {
230 <p>Note that there is no equal sign (=) in any answer and the answers should total no more than 100%,
231 otherwise Moodle will return an error.
232 To avoid the problem of students automatically getting 100% by simply checking all of the answers,
233 it is best to include negative answer weights for wrong answers.</p>
235 What two people are entombed in Grant's tomb?
{
243 <p
><u
>Special Characters ~
= # { } :</u><br />
244 These symbols
<b
> ~
= # { } : </b> control the operation of this filter and cannot be used as normal text within questions.
245 Since these symbols have a special role in determining the operation of this filter
, they are called
"control characters."
246 But sometimes you may want to
use one of these characters
, for example to show a mathematical formula in a question
.
247 The way to get around this problem is
"escaping" the control characters
.
248 This means simply putting a
backslash (\
) before a control character so the filter will know that you want to
use
249 it
as a literal character instead of
as a control character
.
252 Which answer equals
5?
{
258 ::GIFT Control Characters
::
259 Which of the following is NOT a control character
for the GIFT import format?
{
260 ~ \~
# \~ is a control character.
261 ~ \
= # \= is a control character.
262 ~ \
# # \# is a control character.
263 ~ \
{ # \{ is a control character.
264 ~ \
} # \} is a control character.
265 = \
# Correct! \ (backslash) is not a control character. BUT,
266 it is used to escape the control characters
.
268 <p
>When the question is processed
, the backslash is removed
and is not saved in Moodle
.</p
>
270 <h3
>Specifying Categories
</h3
>
272 <p
>It is possible to change the category into which the questions are added within the GIFT file
.
273 You can change the category
as many times
as you wish within the file
. All questions after the modifier
274 up to the next modifier
or the end of the file will be added to the specified category
. Up to the first
275 category modifier the category specified on the import screen will be used
. Note that
for this to work
276 the
<b
>from file
:</b
> box must be ticked on the import screen
.</p
>
278 <p
>To
include a category modifier
include a line like
this (with a blank line before
and after
):
281 $CATEGORY: tom
/dick
/harry
287 $CATEGORY: mycategory
290 ...the first example specifies a path of nested categories
. In this cae the questions will go into
<i
>harry
</i
>. The
291 categories are created
if they
do not exist
.</p
>
293 <p
><u
>Other Options
:</u
><br
/>
294 Short Answer questions can be made
case sensitive by changing
"
;0"
; to
"
;1"
; in the following line
:<br
/>
295 <tt
>$question->
;usecase
= 0; // Ignore case</tt></p>