Skip to content
Snippets Groups Projects
Commit 3a88fa0e authored by Jan Maximilian Michal's avatar Jan Maximilian Michal
Browse files

fixed minor issue, updated README and added one script

parent d0e64247
No related branches found
No related tags found
No related merge requests found
......@@ -2,8 +2,9 @@
## Usage
Invoke the script with `python3 gen.py -h` in order to see usage. Very limited
until now.
Invoke the script with `python3 grim.py -h` in order to see usage. Currently
many features are not yet implemented. Single and Multiple Chice questions
can be generated also in parametrized form.
Example scripts can be found in `scripts/`.
......@@ -14,8 +15,6 @@ implemented.
## TODO
* Add a good description / documentation.
* Add instruction to produce multiple (parametrized) instances of a single
question.
* Add more functionality (gap, alignment, etc.)
* Make parsers more robust.
* reverse ILIAS authentication mechanism for automated upload.
......
......@@ -78,7 +78,8 @@ class GapQuestion:
outcomes = et.Element('outcomes')
outcomes.append(simple_elemet('decvar'))
root.append(outcomes)
for i, (_, correct, points) in enumerate(self.questions):
is_gap = lambda t: type(t) = tuple
for i, (_, correct, points) in enumerate(filter(is_gap, self.gap_list)):
root.append(respcondition(points if correct else 0, i, True))
root.append(respcondition(points if not correct else 0, i, False))
return root
......@@ -99,7 +99,7 @@ def response_str(ident, columns):
response_str.append(render_fib)
return response_str
def response_choice(ident, answers)
def response_choice(ident, answers):
response_str = et.Element('response_str', attrib={'ident': indent, 'rcardinality': 'Single'})
render_choice = et.Element('render_choice', attrib={'shuffle': 'Yes'})
for i, answer in enumerate(answers):
......
......@@ -10,7 +10,7 @@
<qtimetadata>
<qtimetadatafield>
<fieldlabel>ILIAS_VERSION</fieldlabel>
<fieldentry>5.1.8 2016-08-03</fieldentry>
<fieldentry>5.1.8 2016-08-03</fieldentry>
</qtimetadatafield>
<qtimetadatafield>
<fieldlabel>QUESTIONTYPE</fieldlabel>
......
meta = {
'author': 'Carsten Damm',
'title': 'Vermischtes zu elementaren Daten (I1-ID: e638zfi0qtg0)',
'type': 'multiple choice',
'points': 0.5, # per correct choice
}
task = """ Markieren Sie alle zutreffenden Aussagen: """
choices = """
[ ] `int x = Integer.MAX_VALUE; x++;` verursacht eine OverflowException.
[ ] Steuerzeichen werden vom Steuerwerk interpretiert.
[X] `if (b > 0 && a/b < 2)` ... ist besser als `if (a/b < 2 && b > 0)` ...
[ ] Umlaute im Quelltext verursachen Compilezeitfehler.
[X] `"h\u00F6chstens 6 Zeichen"` ist ein Literal.
[ ] `Integer.MAX_VALUE++;` verursacht einen Ganzzahlüberlauf.
[ ] UTF-8 ordnet jedem Zeichen eine Folge von 8 Bytes zu.
[X] Ganzzahl-Arithmetik ist schneller als Gleitkomma-Arithmetik.
"""
feedback = """
Die folgenden Aussagen sind korrekt:
* `if (b > 0 && a/b < 2)` ... ist besser als `if (a/b < 2 && b > 0)` ...
* *Begründung:* `a/b < 2` ist aufwändiger zu berechnen als `b > 0`. Bei einer Prüfung des Wahrheitswerts einer Konjunktion muss der zweite Term nicht betrachtet werden, wenn der erste falsch ist.
* `"h\u00F6chstens 6 Zeichen"` ist ein Literal.
* *Begründung:* Da der String eine konstanten Wert darstellt ist er als Literal zu bezeichnen.
* Ganzzahl-Arithmetik ist schneller als Gleitkomma-Arithmetik.
* *Begründung:* Floating Point Arithmetik ist wesentlich aufwändiger als Integer Arithmetik (siehe zum Vergleich: Zweitkomplement und IEE-754)
"""
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment