Multiple Choice Question
The multiple choice question resource creates questions where multiple answers can be correct. Participants can select multiple options from the provided choices, and all correct answers must be selected to get the question right.
HCL Syntax
Section titled “HCL Syntax”Basic Syntax
Section titled “Basic Syntax”resource "multiple_choice_question" "name" { question = "Which of the following are container orchestration platforms?"
answer = [ "Kubernetes", "Docker Swarm" ]
distractors = [ "Apache Kafka", "Redis" ]}
Full Syntax
Section titled “Full Syntax”resource "multiple_choice_question" "name" { question = "Which of the following are benefits of using Docker containers?"
answer = [ "Consistent environments across development and production", "Efficient resource utilization", "Easy application deployment" ]
distractors = [ "Automatic code optimization", "Built-in database management" ]
hints = [ "Think about portability and resource usage", "Consider deployment and environment consistency" ]
tags = ["docker", "containers", "benefits"]}
Fields
Section titled “Fields”Core Configuration
Section titled “Core Configuration”Field | Required | Type | Description |
---|---|---|---|
question | ✓ | string | The question text presented to participants |
answer | ✓ | list(string) | The correct answer options (participants must select all) |
distractors | ✓ | list(string) | Incorrect answer options presented alongside correct answers |
hints | list(string) | Hints shown to participants 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: Correct answers must not appear in the distractors list
- Minimum answers: Must have at least 1 correct answer
- Multiple correct answers: At least 2 correct answers recommended for true multiple choice
- Minimum options: Must have at least 3 total options (answers + distractors)
- Maximum options: Recommended maximum of 6-8 total options for usability
Examples
Section titled “Examples”Technology Selection Question
Section titled “Technology Selection Question”resource "multiple_choice_question" "cloud_services" { question = "Which of the following are Amazon Web Services (AWS) compute services?"
answer = [ "EC2", "Lambda", "ECS" ]
distractors = [ "BigQuery", "Cloud Functions", "App Engine" ]
tags = ["aws", "cloud", "compute"]}
Best Practices Question
Section titled “Best Practices Question”resource "multiple_choice_question" "security_practices" { question = "Which of the following are recommended security practices for containers?"
answer = [ "Use minimal base images", "Scan images for vulnerabilities", "Run containers as non-root users", "Keep container images updated" ]
distractors = [ "Store secrets in image files", "Use the latest tag for production" ]
hints = [ "Think about reducing attack surface", "Consider secrets management and image versioning" ]
tags = ["security", "containers", "best-practices"]}
Knowledge Assessment Question
Section titled “Knowledge Assessment Question”resource "multiple_choice_question" "kubernetes_components" { question = "Which of the following are core Kubernetes control plane components?"
answer = [ "kube-apiserver", "etcd", "kube-scheduler" ]
distractors = [ "kubelet", "kube-proxy", "container runtime" ]
tags = ["kubernetes", "architecture", "components"]}
Practical Application Question
Section titled “Practical Application Question”resource "multiple_choice_question" "docker_commands" { question = "Which Docker commands can be used to view running containers?"
answer = [ "docker ps", "docker container ls" ]
distractors = [ "docker images", "docker logs", "docker exec" ]
hints = [ "These commands list active containers", "One is the newer syntax, one is the classic syntax" ]
tags = ["docker", "commands", "containers"]}
Design Guidelines
Section titled “Design Guidelines”Question Writing
Section titled “Question Writing”- Clear Instructions: Make it clear that multiple answers may be correct
- Logical Grouping: Ensure correct answers belong to the same category
- Balanced Options: Include 2-4 correct answers typically
- Avoid Overlap: Ensure answers don’t contradict each other
Answer Options
Section titled “Answer Options”- Thematic Consistency: All options should relate to the same topic
- Plausible Distractors: Make incorrect options believable
- Equal Weighting: All correct answers should be equally important
- Comprehensive Coverage: Test breadth of knowledge in the topic area
Hints and Explanations
Section titled “Hints and Explanations”- Category Hints: Provide hints about what type of answers to look for
- Process Guidance: Help participants think through the selection process
- Comprehensive Explanations: Explain why each option is correct or incorrect
- Learning Reinforcement: Use explanations to strengthen understanding
Scoring
Section titled “Scoring”Multiple choice questions use all-or-nothing scoring:
- Participants must select all correct answers and no incorrect answers
- Partial credit is not awarded for selecting only some correct answers
- The question is marked incorrect if any wrong options are selected
Usage in Quizzes
Section titled “Usage in Quizzes”Multiple choice questions are referenced in quiz resources:
resource "quiz" "comprehensive_assessment" { questions = [ resource.multiple_choice_question.cloud_services, resource.multiple_choice_question.security_practices, resource.multiple_choice_question.kubernetes_components ]
show_hints = true attempts = 2}
Best Practices
Section titled “Best Practices”- Clear Question Stem: Make the question clear about expecting multiple answers
- Balanced Difficulty: Include a mix of obvious and subtle correct answers
- Logical Distractors: Use common misconceptions as incorrect options
- Appropriate Scope: Don’t make questions too broad or too narrow
- Consistent Format: Keep all options in similar format and length
- Educational Value: Use questions that reinforce important concepts
- Real-world Relevance: Focus on practical knowledge and application
- Review Carefully: Test questions to ensure all correct answers are truly correct