Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / lang / en_utf8 / help / quiz / formatgift.html
blob75ad58a01832122ec8b79183fc36ee56a2042422
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>
12 <h3>Basics</h3>
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>
24 <pre>
25 Who's buried in Grant's tomb?{~Grant ~Jefferson =no one}
26 </pre>
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>
29 <pre>
30 Grant is {~buried =entombed ~living} in Grant's tomb.
31 </pre>
32 <p>If the answers come before the closing punctuation mark, a fill-in-the-blank line will be inserted
33 for the &quot;missing word&quot; 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>
36 <pre>
37 The American holiday of Thanksgiving is celebrated on the {
38 ~second
39 ~third
40 =fourth
41 } Thursday of November.
43 Japanese characters originally came from what country? {
44 ~India
45 =China
46 ~Korea
47 ~Egypt
49 </pre>
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>
54 <pre>
55 Who's buried in Grant's tomb?{=no one =nobody}
57 Two plus two equals {=four =4}.
58 </pre>
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>
65 <pre>
66 Grant is buried in Grant's tomb.{F}
68 The sun rises in the east.{T}
69 </pre>
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>
73 <pre>
74 Matching Question. {
75 =subquestion1 -> subanswer1
76 =subquestion2 -> subanswer2
77 =subquestion3 -> subanswer3
80 Match the following countries with their corresponding capitals. {
81 =Canada -> Ottawa
82 =Italy -> Rome
83 =Japan -> Tokyo
84 =India -> New Delhi
86 </pre>
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>
95 <pre>
96 When was Ulysses S. Grant born? {#1822}
98 What is the value of pi (to 3 decimal places)? {#3.1415:0.0005}.
99 </pre>
100 <p>Optionally, numerical answers can be written as a span in the following format {#<i>MinimumValue</i>..<i>MaximumValue</i>}.</p>
101 <pre>
102 What is the value of pi (to 3 decimal places)? {#3.141..3.142}.
103 </pre>
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>
107 <pre>
108 When was Ulysses S. Grant born? {#
109 =1822:0
110 =%50%1822:2
112 </pre>
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>
121 <pre>
122 Write a short biography of Ulysses S. Grant {}
123 </pre>
125 <p><u>Description:</u><br />
126 A description "question" has no answer part at all</p>
127 <pre>
128 The next set of questions will concern arithmatic
129 </pre>
132 <h3>OPTIONS</h3>
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>
140 <pre>
141 // Subheading: Numerical questions below
142 What's 2 plus 2? {#4}
143 </pre>
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>
147 <pre>
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.
153 </pre>
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>
158 <pre>
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>
181 <pre>
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.
195 }</pre>
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>
209 <pre>
210 [markdown]The *American holiday of Thanksgiving* is celebrated on the {
211 ~second
212 ~third
213 =fourth
214 } Thursday of November.
215 </pre>
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>
222 <pre>
223 What two people are entombed in Grant's tomb? {
224 ~No one
225 ~%50%Grant
226 ~%50%Grant's wife
227 ~Grant's father
229 </pre>
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>
234 <pre>
235 What two people are entombed in Grant's tomb? {
236 ~%-50%No one
237 ~%50%Grant
238 ~%50%Grant's wife
239 ~%-50%Grant's father
241 </pre>
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.
250 For example:</p>
251 <pre>
252 Which answer equals 5? {
253 ~ \= 2 + 2
254 = \= 2 + 3
255 ~ \= 2 + 4
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.
267 }</pre>
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):
280 <pre>
281 $CATEGORY: tom/dick/harry
282 </pre>
284 or simply
286 <pre>
287 $CATEGORY: mycategory
288 </pre>
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 &quot;0&quot; to &quot;1&quot; in the following line:<br />
295 <tt>$question-&gt;usecase = 0; // Ignore case</tt></p>
296 <p></p>