Step 2: Create a question

Task

Create a file named first_question.yaml within the folder questions.

This file will contain the yaml code for the question. To know which fields we can set for a question, you can look at the Reference for question page. For now we will show the fields that can be set for a question:

Reference

QuestionFileType

Internal tag named type.

One of the following items:

tag-valuedatatype of valuedescription
templateTemplateFileA question that uses a template
normalQuestionA normal question

For now we will just look at the 'normal' question type.

Task

Read the reference below and try to understand what each field means.

Reference

Question

fieldtypedescription
statementTranslationThe statement is a content area which appears at the top of the question, before any input boxes. Use the statement to set up the question and provide any information the student needs to answer it.
adviceTranslationAdvice is a content area which is shown when the student presses the Reveal button to reveal the question’s answers, or at the end of the exam. The advice area is normally used to present a worked solution to the question.
partsArray of QuestionPartA question consists of one or more parts. Each part can have a different type to create elaborate questions.
builtin_constantsBuiltinConstantsSpecifies which constants are enabled. You might want to disable the constant e so it can be used as a variable in the questions.
custom_constantsArray of CustomConstantCustom constants that are used in your question.
variablesMap from String to VariableRepresentationThe (ungrouped) variables that are used in this question.
grouped_variables"none" or Map from String to Map from String to VariableRepresentationThe (grouped) variables that are used in this question. This is a map from a group name to a map of variables. Should mainly be used to make it easier to template multiple variables at once.
variables_testVariablesTestThe test to which your variables should comply. Sometimes it’s hard to define randomised question variables so they’re guaranteed to produce a usable set of values. In these cases, it’s easier to state the condition you want the variables to satisfy, Variable values are generated until this condition passes.
While this tool allows you to pick sets of variables that would be hard to generate constructively, it’s a random process so you must be aware that there’s a chance no suitable set of values will ever be found.
functionsMap from String to FunctionThe functions that are used in this question
preamblePreambleSpecify custom javascript and css code that should be loaded.
navigationQuestionNavigationSpecify some navigation options for the question.
extensionsExtensionsUse this to enable the extensions that are used in the question
diagnostic_topic_namesArray of TranslationThe names of the topics used in diagnostic exams that this question belongs to
resourcesArray of ResourcePathThe paths to the resources
custom_part_typesArray of CustomPartTypeDefinitionPathThe custom part types used in this exam
rulesetsMap from String to JMERulesetItemThe rulesets defined in this question. A “ruleset” defines a list of named simplification rules used to manipulate mathematical expressions. https://numbas-editor.readthedocs.io/en/latest/question/reference.html#rulesets

We can set a value for each of these fields.

---
type: normal # set the type to normal
# type has to be set as an 'internal tag' so all fields of 'Question' are set on the samen level
statement: How much is 9 * 3?
advice: You could calculate 10 * 3 and then subtract 3. This yields 3 * 10 - 3 = 30 - 3 = 27
# Add one part
parts:
  - type: number_entry
    prompt: Enter your answer in the inputbox
    marks: 5 # Give 5 points for a correct answer
    answer: 27 # Set the correct answer
    show_correct_answer: true
    show_feedback_icon: true
    display_correct_as_fraction: false
    allow_fractions: false
    fractions_must_be_reduced: false
    fractions_must_be_reduced_hint: false
    partial_credit_if_fraction_not_reduced: 0
    display_correct_in_style: &style english-plain
    allowed_notation_styles:
      - *style
    custom_marking: none
    steps: []
    steps_penalty: 0
    adaptive_marking: none
    part_name: none
# All fields below are not imporant yet, but need to be specified. Rumbas doesn't use any internal default values.
builtin_constants: # all constants will be disabled
  e: false
  pi: false
  i: false
custom_constants: []
variables: {}
grouped_variables: none
variables_test:
  condition: ""
  max_runs: 1
functions: {}
preamble:
  css: ""
  js: ""
navigation:
  can_regenerate: false
  show_title_page: false
  confirm_when_leaving: false
extensions:
  jsx_graph: false
  stats: false
  geogebra: false
  eukleides: false
  chemistry: false
  download_text_file: false
  graphs: false
  linear_algebra: false
  linear_codes: false
  optimisation: false
  permutations: false
  polynomials: false
  quantities: false
  random_person: false
  written_number: false
  sqlite: false
  text: false
diagnostic_topic_names: []
resources: []
custom_part_types: []
rulesets: {}

Task

Place this yaml in the first_question.yaml.