Quiz
The quiz resource creates interactive knowledge assessments with multiple question types. Users must answer questions correctly to complete the quiz, with configurable hints and answer visibility.
Use Cases
Section titled “Use Cases”As a lab author, you use quizzes to assess and reinforce learning:
- Knowledge Assessment: Evaluate user understanding of concepts, procedures, and technical knowledge covered in the lab
- Learning Reinforcement: Help users consolidate their learning through active recall and application of concepts
- Progress Checkpoints: Create assessment points throughout the lab to verify comprehension before moving forward
Quizzes transform passive reading into active learning experiences that improve knowledge retention and skill development.
HCL Syntax
Section titled “HCL Syntax”Basic Syntax
Section titled “Basic Syntax”resource "quiz" "name" { questions = [ resource.single_choice_question.question1, resource.multiple_choice_question.question2 ]}Full Syntax
Section titled “Full Syntax”resource "quiz" "name" { questions = [ resource.single_choice_question.basics, resource.multiple_choice_question.concepts, resource.text_answer_question.short_answer, resource.numeric_answer_question.calculation ]
show_hints = true show_answers = false}Fields
| Field | Type | Required | Description |
|---|---|---|---|
prerequisites | list(reference)chapter, task, quiz | — | Specify which tasks must be completed before learners can access this quiz |
questions | list(reference)single_choice_question, multiple_choice_question, text_answer_question, numeric_answer_question, true_false_question, match_question, sequence_question, fill_in_the_blanks_question, drag_words_question | — | Add question resources to include in this quiz assessment |
show_ | bool | — | Enable to allow learners to view hints for questions Default false |
show_ | bool | — | Enable to reveal correct answers after quiz submission Default false |
Supported Question Types
Section titled “Supported Question Types”The quiz can include any combination of these question types:
| Question Type | Reference | Description |
|---|---|---|
| Single Choice | resource.single_choice_question.name | One correct answer from multiple options |
| Multiple Choice | resource.multiple_choice_question.name | Multiple correct answers from options |
| Text Answer | resource.text_answer_question.name | Free-form text response |
| Numeric Answer | resource.numeric_answer_question.name | Numerical response with optional precision |
Examples
Section titled “Examples”Basic Knowledge Check
Section titled “Basic Knowledge Check”resource "quiz" "docker_basics" { questions = [ resource.single_choice_question.what_is_docker, resource.multiple_choice_question.docker_benefits ]}Comprehensive Assessment
Section titled “Comprehensive Assessment”resource "quiz" "final_exam" { questions = [ resource.single_choice_question.concepts, resource.multiple_choice_question.best_practices, resource.text_answer_question.explain_process, resource.numeric_answer_question.calculate_resources ]
show_hints = false show_answers = true}Practice Quiz with Hints
Section titled “Practice Quiz with Hints”resource "quiz" "practice_session" { questions = [ resource.single_choice_question.easy_question, resource.multiple_choice_question.medium_question, resource.text_answer_question.hard_question ]
show_hints = true show_answers = true}Mixed Question Types
Section titled “Mixed Question Types”resource "quiz" "comprehensive_test" { questions = [ resource.single_choice_question.theory_basics, resource.multiple_choice_question.practical_applications, resource.text_answer_question.describe_workflow, resource.numeric_answer_question.calculate_capacity, resource.single_choice_question.troubleshooting ]
show_hints = false show_answers = false}Usage in Pages
Section titled “Usage in Pages”Quizzes must be referenced in instruction pages using the activities map and <instruqt-quiz> component:
resource "page" "assessment" { title = "Knowledge Assessment" file = "instructions/chapter2/assessment.md"
activities = { final_quiz = resource.quiz.docker_basics }}Then in your markdown file:
## Test Your Knowledge
<instruqt-quiz id="final_quiz"></instruqt-quiz>Question Flow
Section titled “Question Flow”- Presentation: Questions are shown in the order specified
- Interaction: Participants select/enter answers
- Hints: Available if
show_hints = true - Submission: Answers are validated
- Results: Feedback provided based on configuration
Best Practices
Section titled “Best Practices”- Question Variety: Mix different question types for comprehensive assessment
- Logical Order: Arrange questions from basic to advanced concepts
- Hint Usage: Enable hints for learning-focused quizzes, disable for formal assessments
- Answer Visibility: Show answers for practice, hide for formal evaluations
- Question Quality: Write clear, unambiguous questions with meaningful distractors
- Content Alignment: Ensure questions align with the instructional content
