201819102009张鼎成

**

201819102009张鼎成

**

编写一个简单的考试系统。要求由两个页面组成,第一个页面显示试题,第二个页面获取考生提交的选择,并显示提交的结果,正确的使用绿色显示,错误的使用红色显示(若未选对,正确的选项使用蓝色显示),最后统计考生得分并显示。题型要求具有判断题、单选题、多选题,每种类型的题目至少5个以上。

代码一

<form action="结果.jsp" method="post" name="form1">

    单选题<br>

    1.“各民族共同团结奋斗、共同繁荣发展”是新时期新阶段民族工作的(      )(5)<br>

    <input type="radio" name="l1" value="A">A.主题<br>

    <input type="radio" name="l1" value="B">B.主线<br>

    <input type="radio" name="l1" value="C">C.任务<br>

    <input type="radio" name="l1" value="D">D.目的<br>

    2.加快我国少数民族和民族地区经济发展是(    )可持续发展的根本要求。(5)<br>

    <input type="radio" name="l2" value="A">A、国民经济<br>

    <input type="radio" name="l2" value="B">B、人类社会<br>

    <input type="radio" name="l2" value="C">C、民族<br>

    <input type="radio" name="l2" value="D">D、国家<br>

    3.我国2.2万公里陆地边境线,其中有(    )万公里在民族地区。(5)<br>

    <input type="radio" name="l3" value="A">A、1.7<br>

    <input type="radio" name="l3" value="B">B、1.3<br>

    <input type="radio" name="l3" value="C">C、2<br>

    <input type="radio" name="l3" value="D">D、1.9<br>

    4.文化作为人类物质成果和(  )的总和,是各民族的人们长期生产、生活的产物,是该民族智慧的结晶。(5)<br>

    <input type="radio" name="l4" value="A">A、精神成果<br>

    <input type="radio" name="l4" value="B">B、文化成果<br>

    <input type="radio" name="l4" value="C">C、制度成果<br>

    <input type="radio" name="l4" value="D">D、社会成果<br>

    5.元代松江人黄道婆在海南岛学习了(  )的纺织技术并加以改革,使海南的棉织技术得以向内地传播。(5)<br>

    <input type="radio" name="l5" value="A">A、黎族<br>

    <input type="radio" name="l5" value="B">B、京族<br>

    <input type="radio" name="l5" value="C">C、畲族<br>

    <input type="radio" name="l5" value="D">D、瑶族<br>

    多选题<br>

    6.国家60年代,开展“三线建设”,包括省区有(    )。(10)<br>

    <input type="checkbox" name="l6" value="A">A、贵州<br>

    <input type="checkbox" name="l6" value="B">B、四川<br>

    <input type="checkbox" name="l6" value="C">C、青海<br>

    <input type="checkbox" name="l6" value="D">D、云南<br>

    7.解决现实民族问题的根本在于(    )(10)<br>

    <input type="checkbox" name="l7" value="A">A、发展繁荣经济<br>

    <input type="checkbox" name="l7" value="B">B、提高生活质量<br>

    <input type="checkbox" name="l7" value="C">C、促进民族和谐<br>

    <input type="checkbox" name="l7" value="D">D、协调民族关系<br>

    8.民族文化具有重要的人文价值,这种人文价值包括(  )(10)<br>

    <input type="checkbox" name="l8" value="A">A、历史价值<br>

    <input type="checkbox" name="l8" value="B">B、学术价值<br>

    <input type="checkbox" name="l8" value="C">C、艺术价值<br>

    <input type="checkbox" name="l8" value="D">D、使用价值<br>

    <input type="checkbox" name="l8" value="E">E、物质价值<br>

    9.汉藏语系又可分为(  )语族(10)<br>

    <input type="checkbox" name="l9" value="A">A、汉语<br>

    <input type="checkbox" name="l9" value="B">B、藏缅<br>

    <input type="checkbox" name="l9" value="C">C、苗瑶<br>

    <input type="checkbox" name="l9" value="D">D、壮侗<br>

    <input type="checkbox" name="l9" value="E">E、满-通古斯<br>

    10.少数民族风俗习惯的特点有(  )(10)<br>

    <input type="checkbox" name="l10" value="A">A、民族性<br>

    <input type="checkbox" name="l10" value="B">B、群众性<br>

    <input type="checkbox" name="l10" value="C">C、历史性<br>

    <input type="checkbox" name="l10" value="D">D、地域性<br>

    <input type="checkbox" name="l10" value="E">E、变异性<br>

    判断题<br>
    11. 国家在中西部地区开展的三线建设时间段是1962年到1980年。(10)<br>

    <input type="radio" name="l11" value="true"><br>

    <input type="radio" name="l11" value="false"><br>

    12. 1954年到1958年是我国的第一个国民经济五年发展规划。(10)<br>

    <input type="radio" name="l12" value="true"><br>

    <input type="radio"  name="l12" value="false"><br>

    13. 1980年中共中央制定通过了《西藏工作座谈会纪要》。(10)<br>

    <input type="radio" name="l13" value="true"><br>

    <input type="radio"  name="l13" value="false"><br>

    14. 民族地区经济增速快于全国平均水平,但与发达地区的差距仍在拉大。(10)<br>

    <input type="radio" name="l14" value="true"><br>

    <input type="radio"  name="l14" value="false"><br>

    15. 我国面临加快经济发展与保护生态环境的突出矛盾。(10)<br>

    <input type="radio" name="l15" value="true"><br>

    <input type="radio"  name="l15" value="false"><br>


    <input type="submit" value="提交" name="submit">
    <input type="reset" value="重置">

</form>

在这里插入图片描述
在这里插入图片描述

代码二

<%!
    int sum = 0;//总分
%>
<%
    String l1 = request.getParameter("l1");
    String l2 = request.getParameter("l2");
    String l3 = request.getParameter("l3");
    String l4 = request.getParameter("l4");
    String l5 = request.getParameter("l5");
    String l6[] = request.getParameterValues("l6");
    String l7[] = request.getParameterValues("l7");
    String l8[] = request.getParameterValues("l8");
    String l9[] = request.getParameterValues("l9");
    String l10[] = request.getParameterValues("l10");
    String l11 = request.getParameter("l11");
    String l12 = request.getParameter("l12");
    String l13 = request.getParameter("l13");
    String l14 = request.getParameter("l14");
    String l15 = request.getParameter("l15");

//单选1
    if (l1 == null) {

        out.println("<p style='color:red'>1.回答错误不得分</p>");
        out.print("<p style='color:blue'> 正确答案为A</p>");
    } else if (l1.equals("A")) {

        sum = sum + 5;

        out.print("<p style='color:green'>1.正确</p>");

    } else {
        out.print("<p style='color:red'>1.选项错误</p>" );
        out.print("<p style='color:blue'>正确答案为A</p>");

    }
%>
<%
    //单选2
    if (l2 == null) {

        out.println("<p style='color:red'>2.回答错误不得分</p>");
        out.print("<p style='color:blue'> 正确答案为A</p>");

    } else if (l2.equals("A")) {

        sum = sum + 5;

        out.print("<p style='color:green'>2.正确</p>");

    } else {

        out.print("<p style='color:red'>2.选项错误</p>" );
        out.print("<p style='color:blue'>正确答案为A</p>");

    }
%>
<%
    //单选3
    if (l3 == null) {

        out.println("<p style='color:red'>3.回答错误不得分</p>");
        out.print("<p style='color:blue'> 正确答案为D</p>");

    } else if (l3.equals("D")) {

        sum = sum + 5;

        out.print("<p style='color:green'>3.正确</p>");

    } else {

        out.print("<p style='color:red'>3.选项错误</p>" );
        out.print("<p style='color:blue'>正确答案为D</p>");

    }
%>
<%
    //单选4
    if (l4 == null) {

        out.println("<p style='color:red'>4.回答错误不得分</p>");
        out.print("<p style='color:blue'> 正确答案为A</p>");

    } else if (l4.equals("A")) {

        sum = sum + 5;

        out.print("<p style='color:green'>4.正确</p>");

    } else {

        out.print("<p style='color:red'>4.选项错误</p>" );
        out.print("<p style='color:blue'>正确答案为A</p>");

    }
%>
<%
    //单选5
    if (l5 == null) {

        out.println("<p style='color:red'>5.回答错误不得分</p>");
        out.print("<p style='color:blue'> 正确答案为A</p>");

    } else if (l5.equals("A")) {

        sum = sum + 5;

        out.print("<p style='color:green'>5.正确</p>");

    } else {

        out.print("<p style='color:red'>5.选项错误</p>" );
        out.print("<p style='color:blue'>正确答案为A</p>");

    }
%>
<%
    //多选6
    if (l6 == null) {

        out.println("<p style='color:red'>6.回答错误不得分</p>");
        out.print("<p style='color:blue'> 正确答案为ABCD</p>");

    }else {

        for (String s : l6) {

            out.print(s);

        }

        if (l6.length == 4) {

            if (l6[0].equals("A") && l6[1].equals("B") && l6[2].equals("C") && l6[3].equals("D")) {

                sum = sum + 10;

                out.print("<p style='color:green'>6.正确</p>");

            } else {

                out.print("<p style='color:red'>6.选项错误</p>" );
                out.print("<p style='color:blue'>正确答案为ABCD</p>");

            }

        } else {

            out.print("<p style='color:red'>6.选项错误</p>" );
            out.print("<p style='color:blue'>正确答案为ABCD</p>");

        }

    }
%>
<%
    //多选7
    if (l7 == null) {

        out.println("<p style='color:red'>7.回答错误不得分</p>");
        out.print("<p style='color:blue'> 正确答案为AB</p>");

    }else {

        for (String s : l7) {

            out.print(s);

        }

        if (l7.length == 1 || l7.length == 3 || l7.length == 4) {

            out.print("<p style='color:red'>7.选项错误</p>" );
            out.print("<p style='color:blue'>正确答案为AB</p>");

        } else if (l7.length == 2) {

            if (l7[0].equals("A") && l7[1].equals("B")) {

                sum = sum + 10;

                out.print("<p style='color:green'>7.正确</p>");

            } else {

                out.print("<p style='color:red'>7.选项错误</p>" );
                out.print("<p style='color:blue'>正确答案为AB</p>");

            }

        }

    }
%>
<%
    //多选8
    if (l8 == null) {

        out.println("<p style='color:red'>8.回答错误不得分</p>");
        out.print("<p style='color:blue'> 正确答案为ABCD</p>");

    }else {

        for (String s : l8) {

            out.print(s);

        }

        if (l8.length == 1 || l8.length == 2 || l8.length == 3 || l8.length == 5) {

            out.print("<p style='color:red'>8.选项错误</p>" );
            out.print("<p style='color:blue'>正确答案为ABCD</p>");

        } else if (l8.length == 4) {

            if (l8[0].equals("A") && l8[1].equals("B") && l8[2].equals("C") && l8[3].equals("D")) {

                sum = sum + 10;

                out.print("<p style='color:green'>8.正确</p>");

            } else {

                out.print("<p style='color:red'>8.选项错误</p>" );
                out.print("<p style='color:blue'>正确答案为ABCD</p>");

            }

        }

    }
%>
<%
    //多选9
    if (l9 == null) {

        out.println("<p style='color:red'>9.回答错误不得分</p>");
        out.print("<p style='color:blue'> 正确答案为ABCD</p>");

    }else {

        for (String s : l9) {

            out.print(s);

        }

        if (l9.length == 1 || l9.length == 2 || l9.length == 3 || l9.length == 5) {

            out.print("<p style='color:red'>9.选项错误</p>" );
            out.print("<p style='color:blue'>正确答案为ABCD</p>");

      

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值