summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorPrabhu Ramachandran2011-11-25 18:48:13 +0530
committerPrabhu Ramachandran2011-11-25 18:48:13 +0530
commitfdc531b561565345847812f409ee44af0a784e82 (patch)
tree447b297d28dccb700dcd244404e6cd748191890d /docs
parentb4023e17d6f97e51ffde740c17d19630b5a9c2d1 (diff)
downloadonline_test-fdc531b561565345847812f409ee44af0a784e82.tar.gz
online_test-fdc531b561565345847812f409ee44af0a784e82.tar.bz2
online_test-fdc531b561565345847812f409ee44af0a784e82.zip
ENH: Adding support for Multiple Choice Questions
Adds simple support for multiple choice questions that are also auto-checked. Many fixes to the templates and useful feature additions. This changes the database.
Diffstat (limited to 'docs')
-rw-r--r--docs/sample_questions.py19
-rw-r--r--docs/sample_questions.xml8
2 files changed, 22 insertions, 5 deletions
diff --git a/docs/sample_questions.py b/docs/sample_questions.py
index eac9479..5af9c4b 100644
--- a/docs/sample_questions.py
+++ b/docs/sample_questions.py
@@ -4,7 +4,7 @@ questions = [
Question(
summary='Factorial',
points=2,
- language="python",
+ type="python",
description='''
Write a function called <code>fact</code> which takes a single integer argument
(say <code>n</code>) and returns the factorial of the number.
@@ -19,7 +19,7 @@ assert fact(5) == 120
Question(
summary='Simple function',
points=1,
- language="python",
+ type="python",
description='''Create a simple function called <code>sqr</code> which takes a single
argument and returns the square of the argument. For example: <br/>
<code>sqr(3) -> 9</code>.''',
@@ -31,7 +31,7 @@ assert abs(sqr(math.sqrt(2)) - 2.0) < 1e-14
Question(
summary='Bash addition',
points=2,
- language="bash",
+ type="bash",
description='''Write a shell script which takes two arguments on the
command line and prints the sum of the two on the output.''',
test='''\
@@ -41,6 +41,19 @@ Question(
1 2
2 1
'''),
+Question(
+ summary='Size of integer in Python',
+ points=0.5,
+ type="mcq",
+ description='''What is the largest integer value that can be represented
+in Python?''',
+ options='''No Limit
+2**32
+2**32 - 1
+None of the above
+''',
+ test = "No Limit"
+ ),
]
quiz = Quiz(start_date=date.today(),
diff --git a/docs/sample_questions.xml b/docs/sample_questions.xml
index cad205b..53c76f8 100644
--- a/docs/sample_questions.xml
+++ b/docs/sample_questions.xml
@@ -10,11 +10,13 @@ and returns the factorial of the number.
For example fact(3) -> 6
</description>
<points>2</points>
-<language>python</language>
+<type>python</type>
<test>
assert fact(0) == 1
assert fact(5) == 120
</test>
+<options>
+</options>
</question>
<question>
@@ -27,12 +29,14 @@ returns the square of the argument
For example sqr(3) -> 9.
</description>
<points>1</points>
-<language>python</language>
+<type>python</type>
<test>
import math
assert sqr(3) == 9
assert abs(sqr(math.sqrt(2)) - 2.0) &lt; 1e-14
</test>
+<options>
+</options>
</question>