考试系统9.20

编写考试系统

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

%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>201819102007都悦彤</title>
</head>
<body>
<form action="DYT.jsp" name="example" method="post">
  <p>考试开始,总分为15</p>

  <p>第一题:判断正误</p>
  <p>小说红楼梦的作者是曹雪芹吗:<br>
    <input type="checkbox" name="c1" value="A"><input type="checkbox" name="c1" value="B"></p><br>
  <p>第二题:判断正误</p>
  <p>小说红楼梦是出现在唐朝吗:<br>
    <input type="checkbox" name="c2" value="A"><input type="checkbox" name="c2" value="B"></p><br>
  <p>第三题:判断正误</p>
  <p>小说水浒传的作者是六小龄童吗:<br>
    <input type="checkbox" name="c3" value="A"><input type="checkbox" name="c3" value="B"></p><br>
  <p>第四题:判断正误</p>
  <p>水浒传中的及时雨是宋江吗:<br>
    <input type="checkbox" name="c4" value="A"><input type="checkbox" name="c4" value="B"></p><br>
  <p>第五题:判断正误</p>
  <p>小说红楼梦是出现在唐朝吗:<br>
    <input type="checkbox" name="c5" value="A"><input type="checkbox" name="c5" value="B"></p><br>
  <p>第六题:单选</p>
  <p>李世民是中国历史上哪个朝代的人:<br>
    <input type="checkbox" name="r1" value="A">宋朝
    <input type="checkbox" name="r1" value="B">唐朝
    <input type="checkbox" name="r1" value="C">明朝
    <input type="checkbox" name="r1" value="D">元朝
  </p><br>
  <p>第七题:单选</p>
  <p>刘秀是哪个朝代的人:<br>
    <input type="checkbox" name="r2" value="A">宋朝
    <input type="checkbox" name="r2" value="B">唐朝
    <input type="checkbox" name="r2" value="C">明朝
    <input type="checkbox" name="r2" value="D">汉朝
  </p><br>
  <p>第八题:单选</p>
  <p>苏轼是中国历史上哪个朝代的人:<br>
    <input type="checkbox" name="r3" value="A">宋朝
    <input type="checkbox" name="r3" value="B">唐朝
    <input type="checkbox" name="r3" value="C">明朝
    <input type="checkbox" name="r3" value="D">元朝
  </p><br>
  <p>第九题:单选</p>
  <p>杜甫是中国历史上哪个朝代的人:<br>
    <input type="checkbox" name="r4" value="A">宋朝
    <input type="checkbox" name="r4" value="B">唐朝
    <input type="checkbox" name="r4" value="C">明朝
    <input type="checkbox" name="r4" value="D">元朝
  </p><br>
  <p>第十题:单选</p>
  <p>王安石是中国历史上哪个朝代的人:<br>
    <input type="checkbox" name="r5" value="A">宋朝
    <input type="checkbox" name="r5" value="B">唐朝
    <input type="checkbox" name="r5" value="C">明朝
    <input type="checkbox" name="r5" value="D">元朝
  </p><br>
  <p>第十一题:多选</p>
  <p>下列各项中属于民族基本特征的有:<br>
    <input type="checkbox" name="d1" value="A">普遍性
    <input type="checkbox" name="d1" value="B">国际性
    <input type="checkbox" name="d1" value="C">不定性
    <input type="checkbox" name="d1" value="E">敏感性
  </p><br>
  <p>第十二题:多选</p>
  <p>属于民族异态发展的表现是:<br>
    <input type="checkbox" name="d2" value="A">民族发展极度缓慢
    <input type="checkbox" name="d2" value="B">民族发展停滞
    <input type="checkbox" name="d2" value="C">民族出现暂时倒退
    <input type="checkbox" name="d2" value="D">民族协调快速发展
      </p><br>
  <p>第十三题:多选</p>
  <p>民族同化和民族融合的区别是:<br>
    <input type="checkbox" name="d3" value="A">发生的时间不同
    <input type="checkbox" name="d3" value="B">发生的范围不同
    <input type="checkbox" name="d3" value="C">发生的结果不同
    <input type="checkbox" name="d3" value="D">发生的途径不同
      </p><br>
  p>第十四题:多选</p>
  <p>民族关系的表现形式有:<br>
    <input type="checkbox" name="d4" value="A">发生的时间不同
    <input type="checkbox" name="d4" value="B">发生的范围不同
    <input type="checkbox" name="d4" value="C">发生的结果不同
    <input type="checkbox" name="d4" value="D">发生的途径不同
  </p><br>
  p>第十五题:多选</p>
  <p>民族关系的表现形式有:<br>
    <input type="checkbox" name="d5" value="A">不同民族群体之间的关系
    <input type="checkbox" name="d5" value="B">不同民族个体之间的关系
    <input type="checkbox" name="d5" value="C">同一民族内部群体之间的关系
    <input type="checkbox" name="d5" value="D">同一民族内部个体之间的关系
  </p><br>
  <p>
    <input type="submit" value="提交答案"/>
    <input type="reset" value="清除答案"/>
  </p>
  </p>
</form>

</body>
</html>


在这里插入图片描述

在这里插入图片描述

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>DYT.jsp</title>
</head>
<body>
<%  int score=0;

    String t1=request.getParameter("r1");
    String t2=request.getParameter("r2");
    String t3=request.getParameter("r3");
    String t4=request.getParameter("r4");
    String t5=request.getParameter("r5");

    String t6=request.getParameter("c1");
    String t7=request.getParameter("c2");
    String t8=request.getParameter("c3");
    String t9=request.getParameter("c4");
    String t10=request.getParameter("c5");

    String t11[]=request.getParameterValues("d1");
    String t12[]=request.getParameterValues("d2");
    String t13[]=request.getParameterValues("d3");
    String t14[]=request.getParameterValues("d4");
    String t15[]=request.getParameterValues("d5");

    if (t1==null)
    {
        out.print("<p style='color:blue'>1.漏选</p>");
    }
    else if(t1.equals("1"))
    {
        out.print("<p style='color:green'>1.正确</p>");
        score+=5;
    }
    else
        out.print("<p style='color:red'>1.错误</p>");
    if (t2==null)
    {
        out.print("<p style='color:blue'>2.漏选</p>");
    }
    else    if(t2.equals("1"))
    {
        out.print("<p style='color:green'>2.正确</p>");
        score+=5;
    }
    else
        out.print("<p style='color:red'>2.错误</p>");
    if (t3==null)
    {
        out.print("<p style='color:blue'>3.漏选</p>");
    }
    else    if(t3.equals("1"))
    {
        out.print("<p style='color:green'>3.正确</p>");
        score+=5;
    }
    else
        out.print("<p style='color:red'>3.错误</p>");
    if (t4==null)
    {
        out.print("<p style='color:blue'>4.漏选</p>");
    }
    else    if(t4.equals("1"))
    {
        out.print("<p style='color:green'>4.正确</p>");
        score+=5;
    }
    else
        out.print("<p style='color:red'>4.错误</p>");
    if (t5==null)
    {
        out.print("<p style='color:blue'>5.漏选</p>");
    }
    else    if(t5.equals("2"))
    {
        out.print("<p style='color:green'>5.正确</p>");
        score+=5;
    }
    else
        out.print("<p style='color:red'>5.错误</p>");
    if (t6==null)
    {
        out.print("<p style='color:blue'>6.漏选</p>");
    }
    else    if(t6.equals("4"))
    {
        out.print("<p style='color:green'>6.正确</p>");
        score+=5;
    }
    else
        out.print("<p style='color:red'>6.错误</p>");
    if (t7==null)
    {
        out.print("<p style='color:blue'>7.漏选</p>");
    }
    else
    if(t7.equals("3"))
    {
        out.print("<p style='color:green'>7.正确</p>");
        score+=5;
    }
    else
        out.print("<p style='color:red'>7.错误</p>");
    if (t8==null)
    {
        out.print("<p style='color:blue'>8.漏选</p>");
    }
    else
    if(t8.equals("2"))
    {
        out.print("<p style='color:green'>8.正确</p>");
        score+=5;
    }
    else
        out.print("<p style='color:red'>8.错误</p>");
    if (t9==null)
    {
        out.print("<p style='color:blue'>9.漏选</p>");
    }
    else
    if(t9.equals("4"))
    {
        out.print("<p style='color:green'>9.正确</p>");
        score+=5;
    }
    else
        out.print("<p style='color:red'>9.错误</p>");
    if (t10==null)
    {
        out.print("<p style='color:blue'>10.漏选</p>");
    }
    else
    if(t10.equals("2"))
    {
        out.print("<p style='color:green'>10.正确</p>");
        score+=5;
    }
    else
        out.print("<p style='color:red'>3.错误</p>");
    if (t11==null||t11.length<2)
    {
        out.print("<p style='color:blue'>11.漏选</p>");
    }
    else

    if(t11[0].equals("1")&t11[1].equals("4"))
    {
        out.print("<p style='color:green'>11.正确</p>");
        score+=5;
    }
    else
        out.print("<p style='color:red'>11.错误</p>");
    if (t12==null||t12.length<3)
    {
        out.print("<p style='color:blue'>12.漏选</p>");
    }
    else
    if(t12[0].equals("2")&t12[1].equals("3")&t12[2].equals("5"))
    {
        out.print("<p style='color:green'>12.正确</p>");
        score+=5;
    }
    else
        out.print("<p style='color:red'>12.错误</p>");
    if (t13==null||t13.length<4)
    {
        out.print("<p style='color:blue'>13.漏选</p>");
    }
    else
    if(t13[0].equals("1")&t13[1].equals("2")&t13[2].equals("3")&t13[3].equals("4"))
    {
        out.print("<p style='color:green'>13.正确</p>");
        score+=5;
    }
    else
        out.print("<p style='color:red'>13.错误</p>");
    if (t14==null||t14.length<3)
    {
        out.print("<p style='color:blue'>14.漏选</p>");
    }
    else
    if(t14[0].equals("1")&t14[1].equals("2")&t14[2].equals("4"))
    {
        out.print("<p style='color:green'>14.正确</p>");
        score+=5;
    }
    else
        out.print("<p style='color:red'>14.错误</p>");
    if (t15==null||t15.length<3)
    {
        out.print("<p style='color:blue'>15.漏选</p>");
    }
    else
    if(t15[0].equals("1")&t15[1].equals("2")&t15[2].equals("4"))
    {
        out.print("<p style='color:green'>15.正确</p>");
        score+=5;
    }
    else
        out.print("<p style='color:red'>15.错误</p>");
    out.print("<p style='color:red;'><font size='120px;'>成绩"+score+"</font><p>");
%>
</body>
</html>

在这里插入图片描述

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值