试验环境:moodle网站(管理员角色账户)
目的:批量导入CodeRunner类型题目
思路:
1、通过已存在题目导出分析导入文件格式
2、通过导入文件格式将现有题目文件转换为需求格式
3、生成导入文件
网站上手工自己网上添加了两个题,之后在题库当中选择用xml类型导出。得到了两个题的XML格式文件。(不用看,直接往下拉)
<quiz>
<question type="category">
<category>
<text>$course$/默认 程序设计竞赛</text>
</category>
</question>
<question type="coderunner">
<name>
<text>Fibonacci数列</text>
</name>
<questiontext format="html">
<text>
<![CDATA[
<p><div>
问题描述</div>
<div>
<p>Fibonacci数列的递推公式为:F<sub>n</sub>=F<sub>n-1</sub>+F<sub>n-2</sub>,其中F<sub>1</sub>=F<sub>2</sub>=1。</p>
<p>当n比较大时,F<sub>n</sub>也非常大,现在我们想知道,F<sub>n</sub>除以10007的余数是多少。</p>
</div></p>
]]>
</text>
</questiontext>
<generalfeedback format="html">
<text/>
</generalfeedback>
<defaultgrade>1.0000000</defaultgrade>
<penalty>0.0000000</penalty>
<hidden>0</hidden>
<coderunnertype>java_program</coderunnertype>
<prototypetype>0</prototypetype>
<allornothing>0</allornothing>
<penaltyregime>10, 20, ...</penaltyregime>
<precheck>0</precheck>
<showsource>0</showsource>
<answerboxlines>18</answerboxlines>
<answerboxcolumns>100</answerboxcolumns>
<answerpreload/>
<useace>1</useace>
<resultcolumns/>
<template/>
<iscombinatortemplate/>
<answer/>
<validateonsave>0</validateonsave>
<testsplitterre/>
<language/>
<acelang/>
<sandbox/>
<grader/>
<cputimelimitsecs/>
<memlimitmb/>
<sandboxparams/>
<templateparams/>
<testcases>
<testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
<testcode>
<text>1</text>
</testcode>
<stdin>
<text>5 1 3 -2 4 5</text>
</stdin>
<expected>
<text>5 -2 11</text>
</expected>
<extra><text/></extra>
<display><text>SHOW</text></display>
</testcase>
</testcases>
<testcases>
<testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
<testcode>
<text>1</text>
</testcode>
<stdin>
<text>5 1 3 -2 4 5</text>
</stdin>
<expected>
<text>5 -2 11</text>
</expected>
<extra><text/></extra>
<display><text>SHOW</text></display>
</testcase>
</testcases>
</question>
<question type="coderunner">
<name>
<text>Fibonacci数列</text>
</name>
<questiontext format="html">
<text>
<![CDATA[
<p><div>
问题描述</div>
<div>
<p>Fibonacci数列的递推公式为:F<sub>n</sub>=F<sub>n-1</sub>+F<sub>n-2</sub>,其中F<sub>1</sub>=F<sub>2</sub>=1。</p>
<p>当n比较大时,F<sub>n</sub>也非常大,现在我们想知道,F<sub>n</sub>除以10007的余数是多少。</p>
</div></p>
]]>
</text>
</questiontext>
<generalfeedback format="html">
<text/>
</generalfeedback>
<defaultgrade>1.0000000</defaultgrade>
<penalty>0.0000000</penalty>
<hidden>0</hidden>
<coderunnertype>java_program</coderunnertype>
<prototypetype>0</prototypetype>
<allornothing>0</allornothing>
<penaltyregime>10, 20, ...</penaltyregime>
<precheck>0</precheck>
<showsource>0</showsource>
<answerboxlines>18</answerboxlines>
<answerboxcolumns>100</answerboxcolumns>
<answerpreload/>
<useace>1</useace>
<resultcolumns/>
<template/>
<iscombinatortemplate/>
<answer/>
<validateonsave>0</validateonsave>
<testsplitterre/>
<language/>
<acelang/>
<sandbox/>
<grader/>
<cputimelimitsecs/>
<memlimitmb/>
<sandboxparams/>
<templateparams/>
<testcases>
<testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
<testcode>
<text>1</text>
</testcode>
<stdin>
<text>5 1 3 -2 4 5</text>
</stdin>
<expected>
<text>5 -2 11</text>
</expected>
<extra><text/></extra>
<display><text>SHOW</text></display>
</testcase>
</testcases>
<testcases>
<testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
<testcode>
<text>1</text>
</testcode>
<stdin>
<text>5 1 3 -2 4 5</text>
</stdin>
<expected>
<text>5 -2 11</text>
</expected>
<extra><text/></extra>
<display><text>SHOW</text></display>
</testcase>
</testcases>
</question>
<question type="category">
<category>
<text>$course$/默认 程序设计竞赛</text>
</category>
</question>
<question type="coderunner">
<name>
<text>Fibonacci数列</text>
</name>
<questiontext format="html">
<text>
<![CDATA[
<p><div>
问题描述</div>
<div>
<p>Fibonacci数列的递推公式为:F<sub>n</sub>=F<sub>n-1</sub>+F<sub>n-2</sub>,其中F<sub>1</sub>=F<sub>2</sub>=1。</p>