Text exercise
You can also add exercises with text answers (single or multiple lines).
Recommended uses
- Writing a single line of code or command
- Identifying/finding something in an diagram or code snippet.
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>
Text of the single line answer question.
Text of the single line answer question.
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.
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>
Text of the multiple line answer question.
Text of the multiple line answer question.
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.
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>
Answer validated with a regex. Write a word that starts with the letter A.
Answer validated with a regex. Write a word that starts with the letter A.
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.
With Markdown Rendering
Some answers might benefit from Markdown input, so you can also use:
Write your Markdown here.
Write your Markdown here.
Correct answer here.