-
Notifications
You must be signed in to change notification settings - Fork 0
Question types
There are several question types you can use in your quizzes, and contributing new question types is also easy.
The examples on this page don't utilize any of the advanced formatting options (Markdown, LaTeX, etc), but they are nevertheless supported by each question type.
There is a question and the user must answer it (in their head). Once the user is done, they can reveal the answer and decide whether the answer they thought of in their head is the same as the revealed (correct) answer.
{
"type": "flash-card",
"question": "The question",
"answer": "The correct answer"
}
The user is presented with a question and a list of possible answers. The user must select all of the correct and none of the incorrect answers.
There must be at least one answer, but there is no upper limit. There are also no restrictions on how many correct answers there can be. A multiple choice question is valid even if all or none of the answers are correct.
{
"type": "multiple-choice",
"question": "The question",
"choices": [
{
"content": "A correct choice",
"correct": true
},
{
"content": "An incorrect choice",
"correct": false
},
{
"content": "Another correct choice",
"correct": true
}
]
}
The user is presented with a question and a list of possible answers. The user must select the correct answer.
There must be exactly one correct answer, but there is no limit on the number of incorrect answers. A single choice question is valid even if there is just a single (correct) answer and no incorrect answers.
{
"type": "single-choice",
"question": "The question",
"choices": [
{
"content": "A correct choice",
"correct": true
},
{
"content": "An incorrect choice",
"correct": false
},
{
"content": "Another incorrect choice",
"correct": false
}
]
}
- First, you have to implement the new question type within
src/logic-impl/types
.- The various classes within
src/logic-impl/types/common
may help you. - Create the necessary data holder classes in a
your-type.ts
file.- The text visible by users should be wrapped in the
DisplayableContent
class to allow for formatting.
- The text visible by users should be wrapped in the
- Create a parser (extending
TypeParser
) in theyour-type.ts
file.- Please utilize the type assertion methods defined in the
TypeParser
base class.
- Please utilize the type assertion methods defined in the
- Create a Vue component responsible for rendering the question type in the
YourType.vue
file.- For rendering
DisplayableContent
instances please use theContentDisplayer
component.
- For rendering
- The various classes within
- Then you have to register the newly created question type: call the
registerQuestionType
function in thesrc/globals/types.ts
source file.