Creates a new question for a specific CAT. Questions can be:
STRUCTURED: Multiple choice questions that are auto-gradable - Must include 'options' array with answer choices - Must include 'correctAnswers' array with correct options - Will be automatically graded when students submit
UNSTRUCTURED: Open-ended questions requiring manual grading - Only need 'question' text and 'maxScore' - 'options' and 'correctAnswers' are ignored for this type - Require manual grading by lecturers
Examples: - STRUCTURED: "What is 2+2?" with options ["3", "4", "5"] and correctAnswers ["4"] - UNSTRUCTURED: "Explain the concept of inheritance in OOP" (no options needed)
Body
Required
Question data including content, type, options, and marks
-
Type of question: STRUCTURED (MCQ, auto-gradable) or UNSTRUCTURED (open-ended, essay)
Values are
STRUCTUREDorUNSTRUCTURED. -
Options for structured questions (MCQ). Required for STRUCTURED type, ignored for UNSTRUCTURED
-
Correct answers for auto-grading. Required for STRUCTURED type, ignored for UNSTRUCTURED
-
Maximum score/marks for this question
curl \
--request POST 'http://localhost:3500/api/v1/cats/123e4567-e89b-12d3-a456-426614174000/new-question' \
--header "Content-Type: application/json" \
--data '{"question":"string","type":"STRUCTURED","options":["string"],"correctAnswers":["string"],"maxScore":42.0}'
{
"question": "string",
"type": "STRUCTURED",
"options": [
"string"
],
"correctAnswers": [
"string"
],
"maxScore": 42.0
}
{
"message": "Question added successfully",
"question": {
"id": "456e7890-e89b-12d3-a456-426614174001",
"type": "MULTIPLE_CHOICE",
"marks": 2,
"options": [
"Paris",
"London",
"Berlin",
"Madrid"
],
"question": "What is the capital of France?",
"correctAnswer": "Paris"
}
}