Friday, November 26, 2010

Watch Southpark Online With Ipod

multiple-choice tests edit

Optional Task (optional)!
Write a program that a data structure that can generate multiple-choice tests, created from a text file. The format of the text file is shown with an example,
 This is the introductory text, easy to read in a string called "introduction" 
. With all the characters and line breaks. This introduction
ends with two blank lines.


This is the first question. The text of this question may also extend over several lines
. Still this is a text without the line breaks are taken
(replace line braks by spaces). Further information
are indented by at least two spaces immediately after
this text. Optional may be a blank line.

Optional text to be adopted as the introduction with all the breaks so
as he is in the file, but without the indentation. All
further information comes back engaged, with an optional
removed blank line. The points for this question are in parentheses
set (at the beginning of the line with indentation). Are there any marks, so use
first
option can be specified in {} is a number> 0 and \u0026lt;= 1, which
is interpreted as a "factor". Again, only with appropriate indentation.
(specify the factor should the proportion of correct and incorrect answers
should then be used in the generation of tests, 0.5
means half).
(2) {0.75}


[X] This is a correct answer.
[] This is a wrong answer. can

[X] This is a right answer, which extend over several lines
. can
[] This is a wrong answer, which extend over several lines
.
The indentation is again essential. The
line breaks and indentation should be removed
.


This is the next question, it comes with two blank lines from the
last separated. There must be no further information be given
. In this case, it would be a 1-point question with no selection
options, thus a direct question to answer.


the third question. Now, if a 1-point question and without factor
without text.
[] false solution.
[X] right solution.
[] false solution.
At the end of file, of course, need be no more blank lines. The program should read those files and set the following variable: initial introduction to the text. ask , a list of questions. Each question is a dictionary with following keys and values:

  • "ask" with the text of the question.
  • "text" with the optional text (or not).
  • "points" with the read points or 1
  • "factor" factor with the read (or not).
  • "right" with a list of correct answers (without "[X]" ).
  • false with a list of correct answers (without "[]" ). can manage

0 comments:

Post a Comment