moodle批量导入思路+实战

试验环境: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>
       
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值