c++ - Programming techniques for evaluating multiple choice questions -


i need design module (in c++) evaluation of student sheets containing question more 1 option correct (with partial marking);

my inputs :-

  • correct answer : vector of options (e.g. 'a','c','d');
  • student answer : vector of options (e.g. 'a','b','c');

the rules evaluation of above question types :-

  • full marks : (+4) if options corresponding correct options marked
  • partial mark : (+1) marking every correct option provided there no incorrect options marked
  • no marks : (0) if no option marked
  • negative marks : (-2) in other cases

for example, if (a), (c) , (d) correct options question, marking these 3 result in +4 marks; marking (a) , (d) result in +2 marks; , marking (a) , (b) result in -2 marks, wrong option marked.

note: above rules may change later , complicated well.

i have thought of following approaches :-

  1. hard-coding rules. not flexible rules may change e.g. new sub clause : incorrect option filled results in partial negative mark etc;
  2. using regex flexibility respect rules. regex may constructed each of above sub-rules , matching can performed find of sub-rules student response match , assign marks accordingly. thus, changing regex may change rule.
  3. using strategy pattern.

please provide suggestions if think there flaws in above approaches or there better solutions.

use std::set_symmetric_difference. make sure both input std::vectors sorted. give elements not have in common. so, if result empty set, student answer same correct answer. else, check whether resulting elements either in answer or not.

i following (tl;dr: hard coded):

std::vector<char> answer_student, answer_correct, answer_diff;  int mark = -2;  if (answer_student.empty()) {     mark = 0; }  std::sort(answer_student.begin(), answer_student.end()); std::sort(answer_correct.begin(), answer_correct.end());  std::set_symmetric_difference(     answer_student.begin(), answer_student.end(),     answer_correct.begin(), answer_correct.end(),     std::back_inserter(answer_diff) );  if (answer_diff.empty()) {     mark = 4; } else {     // ... } 

disclaimer: not tested. @ , use example started.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -