From fdc531b561565345847812f409ee44af0a784e82 Mon Sep 17 00:00:00 2001 From: Prabhu Ramachandran Date: Fri, 25 Nov 2011 18:48:13 +0530 Subject: 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. --- docs/sample_questions.py | 19 ++++++++++++++++--- docs/sample_questions.xml | 8 ++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'docs') 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 fact which takes a single integer argument (say n) 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 sqr which takes a single argument and returns the square of the argument. For example:
sqr(3) -> 9.''', @@ -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 2 -python +python assert fact(0) == 1 assert fact(5) == 120 + + @@ -27,12 +29,14 @@ returns the square of the argument For example sqr(3) -> 9. 1 -python +python import math assert sqr(3) == 9 assert abs(sqr(math.sqrt(2)) - 2.0) < 1e-14 + + -- cgit