exams2moodle单选题负分设置异常问题咨询
问题描述
使用R的exams包生成Moodle考试时,单选题(含判断题)的扣分规则不符合预期:需要实现答错任意错误选项固定扣0.25分(无论错误选项数量多少),但当前生成的XML中错误选项的fraction属性为-50(预期为-25)。
示例需求:
问题:1+1等于多少?
a) 2(正确)
b) 3(错误)
c) 4(错误)
选b或c均扣0.25分;新增更多错误选项(如d)5、e)6)时规则保持一致
使用的代码:
library("exams") elearn_exam <- c("11_sc_MCAB.Rnw") eSChoice <- exams_eval(negative = 0.25) exams2moodle(elearn_exam, schoice = list(eval = eSChoice))
注:11_sc_MCAB.Rnw为含3个选项的单选题
生成的XML片段(错误选项fraction异常):
<question type="multichoice"> <name> <text> Q1 : 11_sc_MCAB </text> </name> <questiontext format="html"> <text><![CDATA[ <p> <p>EN: Question - here is the question?</p> </p>]]></text> </questiontext> <penalty>0</penalty> <defaultgrade>1</defaultgrade> <shuffleanswers>false</shuffleanswers> <single>true</single> <answernumbering>abc</answernumbering> <answer fraction="-50" format="html"> <text><![CDATA[<p> ANSWER A </p>]]></text> </answer> <answer fraction="100" format="html"> <text><![CDATA[<p> ANSWER B</p>]]></text> </answer> <answer fraction="-50" format="html"> <text><![CDATA[<p> ANSWER C </p>]]></text> </answer> </question>
解决方案
问题根源
exams_eval(negative = 0.25)采用默认的平均扣分规则:将设定的总扣分上限平均分配到所有错误选项,导致错误选项的扣分会随错误选项数量变化,无法满足固定扣分的需求。
修正代码
library("exams") elearn_exam <- c("11_sc_MCAB.Rnw") # 设置每个错误选项固定扣0.25分(相对于满分1分) eSChoice <- exams_eval(negative = list(rule = "false", penalty = 0.25)) exams2moodle(elearn_exam, schoice = list(eval = eSChoice))
参数说明
rule = "false":指定对所有错误选项应用固定扣分规则,不受错误选项数量影响penalty = 0.25:设置每个错误选项的扣分值(相对于满分1分)
修改后生成的XML中,错误选项的fraction属性会变为-25,正确选项保持100,完全符合“答错任意错误选项扣0.25分”的需求。
内容的提问来源于stack exchange,提问作者userfb
相关产品推荐
相关产品推荐

