Summary
- Each lesson has exercises that are of these five types, namely multiple-choice, code input, drag-and-drop, fill-in-the-blank, and true or false questions.
- Each exercise type has a different data schema that matches its features and grading criteria.
CSEducation
📝 Exercise
Exercise
Data Schema
Ref: Sheet: Python Implementation
{
"_id": INT,
"level": ENUM,
"difficulty": INT,
"number": INT,
"language": "python",
"topic": VARCHAR,
"questionNumber": INT,
"questions": [
{
"inputLines": {
"minLines": INT,
"maxLines": INT
},
"type": ENUM,
"content": [
{
"type": ENUM,
"payload": [],
"payloadType": ENUM
}
],
"hasSecondColumn": BOOLEAN,
"textInputSize": INT,
/* additional fields */
}
],
}Key definitions
🔑 _id: see Lesson ID🔑 level: (G|H|I)🔑 difficulty:
- For level
G: 0 - 8- For level
H: 0 - 5- For level
I: 0 - 5- 🔑
number: story (last 3 digits). See Lesson ID🔑 topic: see About the curriculum- 🔑
questions.type: see Exercise types- 🔑
questions.inputLines.minLines/maxLines: minimum/maximum number of lines for code input area. (currently not implemented in the codebase)- 🔑
questions.textInputSize: size of text input (currently not implemented in the codebase)🔑 questions.content.type:ENUM
instructions: renders markdown payload only using<p>tagslistExplanation: renders list itemscodeLine: renders one code linecodeAreaTitle: renders code snippet with title: “Code:”codeArea: renders code snippetoutputAreaTitle: renders output snippet with title: “Output:”expectedOutput: renders expected output blockstory-blue: renders context/background content (blue text)hint: renders ‘hint’ blockexplanation: renders ‘explanation’ blockimage: renders image from link🔑 questions.content.payloadType:ENUM
markdown(default renderer)html- 🔑
questions.hasSecondColumn: use two-column layout
Exercise types
- Multiple choice: e.g.
G0000 - Code Input: e.g.
G0004 - Drag-and-Drop: e.g.
G1020 - Fill-in-the-blank: e.g.
G1026 - True/False: e.g.
G2195
Multiple choice

Question Data
_id: G0000number: 0questionNumber: 0choiceFormat: htmlpayloadType: markdowntype: instructionspayload: Python is a programming language?choices: Yes ~ No
"questions": [
{
"dragDrop": {
"cards": []
},
"type": "multi-choice",
"content": [
{
"type": "instructions",
"payload": [
"Python is a programming language?"
],
"payloadType": "markdown"
}
],
"hasSecondColumn": false,
"textInput": []
}
],"questions": [
{
"choices": [
"Yes",
"No"
],
"choiceFormat": "html",
}
]Code Input

Question Data
_id: G0004number: 4questionNumber: 4type: instructions
payloadType: markdownpayload: Write the Python code to display “A computer program is a list of instructions.”hasSecondFalse: falseinitialCode: nullnoOutput: nulltype: expectedOutput
payloadType: markdownpayload: A computer program is a list of instructions.hasSecondFalse: nullinitialCode: nullnoOutput: null
"questions": [
{
"dragDrop": {
"cards": []
},
"type": "code-input",
"content": [
{
"type": "instructions",
"payload": [
"Write the Python code to display \"A computer program is a list of instructions.\""
],
"payloadType": "markdown"
},
{
"type": "expectedOutput",
"payload": {
"code": "A computer program is a list of instructions.",
"mode": "python"
},
"payloadType": "markdown"
}
],
"hasSecondColumn": false,
"choiceFormat": "html",
"textInput": []
}
]"questions": [
{
"secondColumnContent": [],
}
]Drag-and-Drop

Question Data
_id: G1020
number: 20
questionNumber: 0
type: instructions
payloadType: markdownpayload: I want to get 60 from these ints, which operator do I use? Drag and drop the correct operator into the equation.
cards: +~-~*~/~**~%
textType: text,textValue: 12
textType: input,textValue: null
textType: text,textValue: 5 = 60
"questions": [
{
"type": "drag-drop-text",
"content": [
{
"type": "instructions",
"payload": [
"I want to get 60 from these ints, which operator do I use? Drag and drop the correct operator into the equation."
],
"payloadType": "markdown"
}
],
"hasSecondColumn": false,
"choices": [],
"choiceFormat": "html",
"textInputSize": 20,
}
],"questions": [
"dragDrop": {
"cards": [
{
"id": 0,
"value": "+"
},
{
"id": 1,
"value": "-"
},
{
"id": 2,
"value": "*"
},
{
"id": 3,
"value": "/"
},
{
"id": 4,
"value": "**"
},
{
"id": 5,
"value": "%"
}
]
},
"textInput": [
[
{
"type": "text",
"value": "12"
},
{
"type": "input"
},
{
"type": "text",
"value": "5 = 60"
}
]
]
]Fill-in-the-blank

Question Data
_id: G1026number: 26questionNumber: 0type: story-blue
payloadType: markdownpayload: A farmer has traded his vegetables to many customers. In return, the customers must give him seeds to complete the trade. The farmer has used equations to keep track of who owes how many seeds. He wants you to match the equations to the correct customer.type: instructions
payloadType: markdownpayload: Write equations for the following people in the list below.type: listExplanation
payloadType: markdownpayload: Timmy owes two plus sixtype: listExplanation
payloadType: markdownpayload: Jim owes the remainder of eight divided by fivetype: instructions
payloadType: markdownpayload: Write your equations in the space provided.textArayIndex: 0
textType: texttextValue: timmy =textType: inputtextValue: nulltextArayIndex: 1
textType: texttextValue: jim =textType: inputtextValue: null
"questions": [
{
"dragDrop": {
"cards": []
},
"type": "text-boxes",
"content": [
{
"type": "story-blue",
"payload": [
"A farmer has traded his vegetables to many customers. In return, the customers must give him seeds to complete the trade. The farmer has used equations to keep track of who owes how many seeds. He wants you to match the equations to the correct customer."
],
"payloadType": "markdown"
},
{
"type": "instructions",
"payload": [
"Write equations for the following people in the list below."
],
"payloadType": "markdown"
},
{
"type": "listExplanation",
"payload": [
"Timmy owes two plus six",
"Jim owes the remainder of eight divided by five"
],
"payloadType": "markdown"
},
{
"type": "instructions",
"payload": [
"Write your equations in the space provided."
],
"payloadType": "markdown"
}
],
"hasSecondColumn": false,
"choices": [],
"choiceFormat": "html",
"textInputSize": 20,
}
],"questions": [
{
"textInput": [
[
{
"type": "text",
"value": "timmy = "
},
{
"type": "input"
}
],
[
{
"type": "text",
"value": "jim = "
},
{
"type": "input"
}
]
]
}
]True/False

Question Data
_id: G2195number: 195questionNumber: 0type: codeAreaTitle
payloadType: markdownpayload: product = “Soap “\nprice = 10type: instructions
payloadType: markdownpayload: The value of **product + price** is **“Soap 10”**type: explanation
payloadType: markdownpayload: Note: product is a string and price is an int, combining the two will give TypeError.
"questions": [
{
"dragDrop": {
"cards": []
},
"type": "true-false",
"content": [
{
"payloadType": "markdown",
"type": "codeAreaTitle",
"payload": {
"code": "product = \"Soap \"\nprice = 10\r\n",
"mode": "python"
}
},
{
"payloadType": "markdown",
"type": "instructions",
"payload": [
"The value of **product + price** is **\"Soap 10\"**"
]
},
{
"payloadType": "markdown",
"type": "explanation",
"payload": [
"Note: product is a string and price is an int, combining the two will give TypeError."
]
}
],
"hasSecondColumn": false,
"choiceFormat": "html",
"textInputSize": 20,
"textInput": []
}
]nullAPIs
Check Exercise
CSEducation
⚙️ API /
- Response:
{exercise}
Post Exercise
CSEducation
⚙️ API /
- Request Body:
{exercise} - Response:
{exercise}
Delete exercise
CSEducation
⚙️ API /
- Request Body:
{
"_id": "exercise_id"
}- Response:
{exercise}