mercredi 6 juillet 2016

Programming techniques for evaluating multiple choice questions

I need to design a module (in C++) for evaluation of student sheets containing question with more than one option correct (with partial marking);

My inputs are :-

  • Correct answer : vector of options (e.g. 'A','C','D');
  • Student answer : vector of options (e.g. 'A','B','C');

The rules for evaluation of above question types are :-

  • Full Marks : (+4) If only the options corresponding to correct options are marked
  • Partial Mark : (+1) For marking every correct option provided there are NO incorrect options marked
  • No Marks : (0) If no option marked
  • Negative Marks : (-2) In all other cases

For example, if (A), (C) and (D) are the correct options for a question, marking all these three will result in +4 marks; marking only (A) and (D) will result in +2 marks; and marking (A) and (B) will result in -2 marks, as a wrong option is also marked.

NOTE: The above rules may change later and get complicated as well.

I have thought of following approaches :-

  1. Hard-coding the rules. This is not flexible as rules may change e.g. a new sub clause could be : an incorrect option filled results in partial negative mark etc;
  2. Using regex to get some flexibility with respect to rules. A regex may be constructed for each of the above sub-rules and matching can be performed to find which of the sub-rules the student response match to and assign marks accordingly. Thus, by changing only the regex we may change the rule.
  3. Using strategy pattern.

Please provide your suggestions if you think there are flaws in above approaches or there are better solutions.

Aucun commentaire:

Enregistrer un commentaire