GIFT syntax reference
ulams stores every quiz question as one GIFT string. You need this page when you write questions in a spreadsheet for Import questions (column Question), or when you want to know exactly how a question is graded. The question editor in the admin panel writes valid GIFT for you.
Building blocks
Section titled “Building blocks”| Syntax | Meaning |
|---|---|
::Title:: |
Optional question title at the start. It is removed from the text learners see. |
{ ... } |
The answer block. Its contents decide the question type. |
= |
A correct answer (or, in matching, the start of a pair). |
~ |
A wrong answer (or, with a percentage, a weighted answer). |
# |
Feedback for the answer it follows, or the start of a numerical answer. |
%50% |
A percentage of the question’s score for that answer. |
-> |
Separates the two sides of a matching pair. |
// comment |
A comment line, removed before the question is shown or graded. |
\~ \= \# \{ \} \: |
A literal ~, =, #, {, } or : in question or answer text. |
Missing word. If text follows the answer block, learners see the block replaced by a blank:
The grinder sits {=before ~after} the scale. is shown as “The grinder sits _____ the scale.”
How the type is detected
Section titled “How the type is detected”The type comes from the answer block, checked in this order; the first rule that matches wins:
- No
{and}at all → Description. - Empty block
{}→ Essay. - Block starts with
#→ Numerical. - Block contains
~%→ Multiple choice with multiple right answers. - Block contains both
~and=→ Multiple choice. - Block contains
=and->→ Matching. - Block contains
=and no~→ Short answers. - Block contains
T,F,TRUEorFALSE→ True/False.
Anything else is rejected as an unknown type.
Multiple choice (one right answer)
Section titled “Multiple choice (one right answer)”::Grind size::Which grind suits a French press?{ =Coarse#Right: coarse grounds stay behind the mesh. ~Fine#Too fine: it clogs the filter and over-extracts. ~Extra fine#That is for Turkish coffee.}- Exactly one answer starts with
=; the others start with~. - Full score for the correct answer, 0 for any other. Feedback after
#is returned with the answer.
Multiple choice with multiple right answers
Section titled “Multiple choice with multiple right answers”Which of these are brewing methods?{ ~%50%Pour-over ~%50%AeroPress ~%-50%Roasting ~%-50%Grinding}- Every answer starts with
~%<percent>%. Positive percentages add up to the full score (normally 100 in total); negative ones subtract. - The learner’s score is the question score times the sum of the percentages of the answers they ticked, capped at the full score. The result is not floored at zero, so negative percentages can give a negative score.
- An answer written with
=counts as 100 %.
True/False
Section titled “True/False”Espresso is brewed under pressure.{T}Lighter roasts always contain less caffeine.{FALSE#It depends on how you measure: by weight or by volume.}- Use
TorTRUEfor true,ForFALSEfor false, in capital letters. Lowercase{true}is not recognised. - Feedback can follow
#.
Short answers
Section titled “Short answers”What is the name of the crema-forming coffee drink made under pressure?{ =espresso#Correct. =Espresso =%50%ristretto#A ristretto is a short espresso: half the points.}- One or more accepted answers, each starting with
=(no~). - The learner’s answer must match one accepted answer exactly, including capital letters. List each spelling you accept.
=%50%answergives that percentage of the score for that answer.- Do not use
->in an answer; it would make the question a matching question.
Matching
Section titled “Matching”Match each drink with its base:{ =Latte -> Espresso and steamed milk =Americano -> Espresso and hot water =Cold brew -> Coffee steeped in cold water}- Each pair starts with
=and uses->between the item and its match. - Both columns are shown shuffled.
- All-or-nothing: the full score only if every pair is right, otherwise 0.
Numerical
Section titled “Numerical”How many grams of coffee for 250 ml of water at a 1\:16 ratio?{#15.6:0.5}| Form | Accepted answers |
|---|---|
{#15} |
exactly 15 |
{#15.6:0.5} |
15.6 plus or minus 0.5 (15.1 to 16.1) |
{#14..17} |
anything from 14 to 17 |
- Full score inside the range, otherwise 0.
- Only one numerical answer per question. Moodle’s form with several weighted numerical answers
(
{# =%100%15 =%50%14}) is not supported. - The editor in the admin panel always writes the
value:marginform.
Describe how you would adjust your espresso if it tastes sour.{}- An empty answer block. The learner writes free text.
- Not graded automatically: the attempt gets 0 for it until a tutor enters a score in Quiz Reports.
Description
Section titled “Description”The next three questions are about milk texturing.- No answer block. Shown as text between questions, with no answer and no score.
Pitfalls
Section titled “Pitfalls”- Double slashes.
//starts a comment up to the end of the line, wherever it appears. A URL such ashttps://example.comfollowed by a line break loses everything afterhttps:. Keep URLs at the end of a single-line question, or avoid them. - Special characters. Escape
~ = # { } :with a backslash when they are part of the text, for exampleRatio 1\:16. The admin editor does this for you. - Formats. Moodle’s
[html],[markdown]and[plain]markers are not interpreted by the grader and may show up as text. Write plain text.