Single Choice Question
The single choice question resource creates multiple choice questions with one correct answer. Users select from a list of options that includes the correct answer and distractors.
Use Cases
Section titled “Use Cases”As a lab author, you use single choice questions to assess specific knowledge:
- Concept Verification: Test understanding of key concepts, definitions, and terminology with clear right/wrong answers
- Best Practice Assessment: Evaluate knowledge of industry standards, recommended approaches, or proper procedures
- Tool Recognition: Test identification of correct tools, commands, or configuration options for specific scenarios
Single choice questions are ideal for testing concrete knowledge where there is one clearly correct answer among plausible alternatives.
HCL Syntax
Section titled “HCL Syntax”Basic Syntax
Section titled “Basic Syntax”resource "single_choice_question" "name" { question = "What is the capital of France?" answer = "Paris"
distractors = [ "Berlin", "London", "Madrid" ]}
Full Syntax
Section titled “Full Syntax”resource "single_choice_question" "name" { question = "Which container orchestration platform is developed by Google?" answer = "Kubernetes"
distractors = [ "Docker Swarm", "Apache Mesos", "Nomad" ]
hints = [ "This platform was originally called Borg internally at Google", "The name comes from the Greek word for helmsman" ]
tags = ["kubernetes", "containers", "orchestration"]}
Fields
Section titled “Fields”Core Configuration
Section titled “Core Configuration”Field | Required | Type | Description |
---|---|---|---|
question | ✓ | string | The question text presented to users |
answer | ✓ | string | The correct answer option |
distractors | ✓ | list(string) | Incorrect answer options presented alongside the correct answer |
hints | list(string) | Hints shown to users when hints are enabled. Defaults to empty list. | |
tags | list(string) | Tags for categorizing and organizing questions. Defaults to empty list. |
Validation Rules
Section titled “Validation Rules”- Answer uniqueness: The correct answer must not appear in the distractors list
- Minimum options: Must have at least 2 total options (answer + distractors)
- Maximum options: Recommended maximum of 5-6 total options for usability
- Question clarity: Questions should be clear and unambiguous
Examples
Section titled “Examples”Basic Geography Question
Section titled “Basic Geography Question”resource "single_choice_question" "geography_basic" { question = "What is the capital of Japan?" answer = "Tokyo"
distractors = [ "Osaka", "Kyoto", "Hiroshima" ]}
Technical Knowledge Question
Section titled “Technical Knowledge Question”resource "single_choice_question" "docker_concepts" { question = "Which Docker command is used to create and start a new container?" answer = "docker run"
distractors = [ "docker start", "docker create", "docker exec" ]
tags = ["docker", "containers", "commands"]}
Question with Hints
Section titled “Question with Hints”resource "single_choice_question" "networking_advanced" { question = "Which HTTP status code indicates a successful request?" answer = "200"
distractors = [ "404", "500", "302" ]
hints = [ "This is a 2xx status code", "It's the most common success status code" ]
tags = ["http", "networking", "status-codes"]}
Multiple Questions for a Quiz
Section titled “Multiple Questions for a Quiz”resource "single_choice_question" "kubernetes_basic" { question = "What is the smallest deployable unit in Kubernetes?" answer = "Pod"
distractors = [ "Container", "Node", "Service" ]
tags = ["kubernetes", "concepts"]}
resource "single_choice_question" "kubernetes_storage" { question = "Which Kubernetes resource provides persistent storage?" answer = "PersistentVolume"
distractors = [ "ConfigMap", "Secret", "EmptyDir" ]
tags = ["kubernetes", "storage"]}
Design Guidelines
Section titled “Design Guidelines”Question Writing
Section titled “Question Writing”- Clear and Specific: Write questions that test specific knowledge
- Avoid Ambiguity: Ensure only one answer is clearly correct
- Appropriate Difficulty: Match question difficulty to learning objectives
- Real-world Relevance: Use practical scenarios when possible
Answer Options
Section titled “Answer Options”- Plausible Distractors: Make incorrect options believable but clearly wrong
- Consistent Format: Keep all options in the same format (length, style)
- Avoid “All of the above”: This can make questions too easy or confusing
- Random Order: Options are automatically shuffled during presentation
Hints and Explanations
Section titled “Hints and Explanations”- Progressive Hints: Order hints from general to specific
- Educational Value: Use explanations to reinforce learning
- Concise Content: Keep hints and explanations brief but informative
- Avoid Giving Away: Don’t make hints too obvious
Usage in Quizzes
Section titled “Usage in Quizzes”Single choice questions are referenced in quiz resources:
resource "quiz" "fundamentals" { questions = [ resource.single_choice_question.geography_basic, resource.single_choice_question.docker_concepts, resource.single_choice_question.networking_advanced ]
show_hints = true attempts = 2}
Best Practices
Section titled “Best Practices”- Balanced Difficulty: Mix easy, medium, and hard questions
- Logical Grouping: Use tags to organize related questions
- Quality Distractors: Include options that test common misconceptions
- Learning Reinforcement: Use explanations to strengthen understanding
- Testing Strategy: Test understanding, not memorization
- Accessibility: Ensure questions work for diverse learning styles
- Review and Iterate: Test questions with real learners and refine based on feedback