Text exercise

You can also add exercises with text answers (single or multiple lines).

Tip

Examples of these are “Where does X occur?” or “In what section Y is located?”. In this case we do not want to direct the students’ gaze into specific parts of the code/image/etc. Instead, students should look at the whole and identify where they are supposed to look for what’s asked.

Syntax

Try answering the question bellow. Answers persist page refreshes, so students won’t loose their progress after the end of a session.

Single line answer

<TextExercise slug="single-text-exercise">
Text of the single line answer question.

  <Answer>
    Correct answer here. Take into account that students will phrase their answers differently and try to include elements that will let them evaluate their own answers.
  </Answer>
</TextExercise>
Exercise

Text of the single line answer question.

Multiline answer

<TextExercise multiline slug="multiline-text-exercise">
  Text of the multiple line answer question.

  <Answer>
    Correct answer here. Take into account that students will phrase their answers differently and try to include elements that will let them evaluate their own answers.
  </Answer>
</TextExercise>
Exercise

Text of the multiple line answer question.

With validation

You can use regular expressions to validate student input. If you provide a validation attribute, the exercise will evaluate it as a regex and try to match to the student’s answer.

<TextExercise slug="with-regex" validation="^[aA].+">
Answer validated with a regex. Write a word that starts with the letter A.

  <Answer>
    Correct answer here. Take into account that students will phrase their answers differently and try to include elements that will let them evaluate their own answers.
  </Answer>
</TextExercise>
Exercise

Answer validated with a regex. Write a word that starts with the letter A.

With Markdown Rendering

Some answers might benefit from Markdown input, so you can also use:

Exercise

Write your Markdown here.