YAML Format (input)

Each question is provided in yaml format. The format is somewhat unforgiving as spacings and alignments need to be correct for the file to be readable. Below is an example of a question using this format. Each line will be described in details.

Question example

 1   - Type: MC
 2     Text: >-
 3      In the screencast we derived an expression for the Fermi-Dirac distribution
 4      using the grand canonical ensemble. What is the grand canonical ensemble?
 5     Size: Auto
 6     Points: 2
 7     Answers:
 8      - Choice:  >-
 9          The ensemble of systems with fixed energy and entropy.
10        Validity: incorrect
11      - Choice: >-
12          The ensemble of systems with fixed energy and chemical potential.
13        Validity: incorrect
14      - Choice: 'The ensemble of systems with fixed temperature and chemical potential.'
15        Validity: correct
16      Skip: 'no'
17      Note: question regarding lecture 29

Anatomy of a question

We will now review each line. Basically, all names that are followed by “:” is a key in a dictionary. If you wish to use a “:” in your questions or answers, you need to use quotation marks (or the >- sign – it is usually used for text with multiple lines).

  1. New question starts with the type.

- Type: MC

Each new question starts with a - Type: keyword. The options are: MC (Multiple Choice), MA (Multiple Answers),…

  1. Description of the question itself.

- Text: 'This is my question'

or

- Text: >-
   This is a multiline question with various parts in it.
   Try it if you want to.

Tip

The advantage of this approach is that you can use LaTeX commands in both text and math modes in all the text used in the yaml file.

  1. For multiple-choice questions, you then have the list of possible answers:

Answers:
     - Choice:  >-
         The ensemble of systems with fixed energy and entropy.
       Validity: incorrect

Each Choice can be entered in a single-line or multiline format. There is a second keyword called Validity (case sensitive) to assign an incorrect or correct attribute to the choice. Note that you only need to provide the information for a correct asnwer as the script will assign an incorrect attribute by default.

  • Note 1: You can list as many Choice lines as you need.

  • Note 2: For some types of questions, only one answer can have the Validity: correct attribute.

  1. You can skip the question from the file without deleting it by using: Skip: 'no' (this is an optional keyword)

  2. To keep things tidy, you can add a note for each question, using the Note: keyword.

Note

The easiest way to create a question is to use an existing one as a template!

Hint

A good habit is to check your yaml file using a free online tool such as those provided by onlineyamltools.com (see, here: https://onlineyamltools.com/validate-yaml). After a while you won’t make a mistake anymore but early on, this could be frustrating.