Creating Exercises
Here are instructions for creating exercises
OPENTA XML Generation Rules
This section describes the rules for generating OPENTA-compatible XML exercises. You can copy the entire section and use it as an instruction in ChatGPT. Or you can get the textfile here which you can paste in as an instruction in chatgpt query. It is very incomplete but it might help.
When generating an exercise, the XML must follow the structure below:
<exercise>
<exercisename>EXERCISE_NAME</exercisename>
<global>var1 = value1; var2 = value2; ...</global>
<text>TEXT EXPLAINING THE EXERCISE</text>
<question key="RANDOMKEY1">
<text>TEXT EXPLAINING THE QUESTION</text>
<expression>A MATHEMATICAL EXPRESSION THAT IS THE CORRECT ANSWER TO THE QUESTION</expression>
</question>
</exercise>
The values value1, value2 etc. may include units when relevant.
Units must be written out in full, for example: meter, second, kg.
Example:
g = 9.800 meter / second^2
Since units are already included in the global variable definitions, student answers must not contain units.
Expressions inside <expression> must refer only to variables.
Use at least four significant figures when assigning numerical values.
Avoid whole numbers and simple fractions.
Angles must always be expressed in radians.
The word
radianmust never be used in an expression.Avoid special angles unless specifically requested.
Mathematical expressions inside <text> tags must be wrapped in dollar signs to ensure MathJax rendering.
Example:
<text>The vector has length $ \sqrt{x^2 + y^2} $.</text>
All variables appearing inside:
<expression> ... </expression>
must:
Be defined inside the
<global>tag.Have reasonable numerical values.
Include units when appropriate.
Hints may be added to enforce restrictions or requirements on student answers.
A hint block has the form:
<hint>
<regex present="ATTRIBUTE">REGEX</regex>
<comment>COMMENT</comment>
</hint>
The ATTRIBUTE can be one of:
requiredforbiddennecessaryallowedencourageddiscouraged
Hints may be placed inside the <global> tag or inside an individual <question> tag.
Use cases include:
forbidden– prohibit certain answer formsrequired– demand that a specific structure appearsnecessary– enforce a mandatory componentallowed– whitelist formsencouraged/discouraged– guide style without strict enforcement
When including a regex, the system should remind the user that the above attributes are available.
If an exercise requires solving for multiple different variables:
Create one
<question>element per variable.Each question must have a unique
keyattribute.Each question must include its own
<text>and<expression>.
The <expression> tag contains only the target expression and must not contain an equal sign.
The <text> tag inside the question explains which variable the student is expected to compute.
XML SCHEMA
You can validate all the exercises in OpenTA by pressing “Validate Exercises” in the toolbar