Default exam files

For an exam we can specify a couple of different default files to specify global defaults for exams.

Our three exams use exactly the same navigation. We can therefore move the navigation field to a default file.

The navigation field of an exam can be specified in a file named navigation.yaml in the defaults folder.

Task

Place the value of the navigation field of the exam in this file. For example:

---
mode: sequential
start_password: none
can_regenerate: true
show_steps: false
show_title_page: false
confirm_when_leaving: false
show_names_of_question_groups: true
allow_printing: false
can_move_to_previous: true 
browsing_enabled: true
show_results_page: never
on_leave: 
  action: none

Task

You can now remove the navigation field from the 3 exam files.

Task

Try compiling the exams again. You should see that the compilation works and that the navigation is still the same within the exams.

Feedback

Our three exams use exactly the same feedback. We can therefore move the feedback field to a default file.

The feedback field of an exam can be specified in a file named feedback.yaml in the defaults folder.

Task

Place the value of the feedback field of the exam in this file. For example:

---
percentage_needed_to_pass: 50
show_name_of_student: false
show_current_marks: true
show_maximum_marks: true
show_answer_state: true
allow_reveal_answer: true
review:
  show_score: true
  show_feedback: true
  show_expected_answer: true
  show_advice: true
advice: "Please practice more"
intro: "An introductory text"
feedback_messages: []

Task

You can now remove the feedback field from the 3 exam files.

Task

Try compiling the exams again. You should see that the compilation works and that the feedback is still the same within the exams.

Timing

Our three exams use exactly the same timing. We can therefore move the timing field to a default file.

The timing field of an exam can be specified in a file named timing.yaml in the defaults folder.

Task

Place the value of the timing field of the exam in this file. For example:

---
duration_in_seconds: none # no time limit
allow_pause: true 
on_timeout: 
  action: none
timed_warning: 
  action: none

Task

You can now remove the timing field from the 3 exam files.

Task

Try compiling the exams again. You should see that the compilation works and that the timing is still the same within the exams.

Locales

Our three exams use exactly the same locales. We can therefore move the locales field to a default file.

The locales field of an exam can be specified in a file named locales.yaml in the defaults folder.

Task

Place the value of the locales field of the exam in this file. For example:

---
- name: en # custom name
  numbas_locale: en-GB # English (United Kingdom)

Task

You can now remove the locales field from the 3 exam files.

Task

Try compiling the exams again. You should see that the compilation works and that the locales are still the same within the exams.

Numbas Settings

Our three exams use exactly the same Numbas settings. We can therefore move the numbas_settings field to a default file.

The numbas_settings field of an exam can be specified in a file named numbas_settings.yaml in the defaults folder.

Task

Place the value of the numbas_settings field of the exam in this file. For example:

---
theme: default # use the default numbas theme

Task

You can now remove the numbas_settings field from the 3 exam files.

Task

Try compiling the exams again. You should see that the compilation works and that the Numbas settings are still the same within the exams.

Resulting exam files

Our exam files are now a lot smaller. Our exam with randomisation is now:

---
type: normal
name: First Exam
question_groups:
  - name: Group 1
    picking_strategy:
      type: all_ordered
    questions:
      - first_question.yaml
      - first_question_with_variables.yaml
      - first_question_with_randomisation.yaml

Overriding defaults

These defaults are useful to reduce the size of your exam files. However, sometimes you will want to override the default values. For example, you might want to change the show_current_marks field of the feedback field for a specific exam. This can easily be done without needing to specify all fields of feedback.

Task

Override the show_current_marks field of the feedback field.

---
type: normal
name: First Exam
feedback:
  show_current_marks: false # overrride this field
  # all other feedback settings are taken from the default file
question_groups:
  - name: Group 1
    picking_strategy:
      type: all_ordered
    questions:
      - first_question.yaml
      - first_question_with_variables.yaml
      - first_question_with_randomisation.yaml

Task

Try compiling this exam. You should see that the compilation works and that the current total score is not shown in the exam.

You can also find the exam in the online demo.