第三个作业
201819102017赵景云
考试系统:编写一个简单的考试系统。要求由两个页面组成,第一个页面显示试题,第二个页面获取考生提交的选择,并显示提交的结果,正确的使用绿色显示,错误的使用红色显示(若未选对,正确的选项使用蓝色显示),最后统计考生得分并显示。题型要求具有判断题、单选题、多选题,每种类型的题目至少5个以上。
代码如下:
第一个页面要求:显示试题
<%@page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>201819102017</title>
</head>
<body>
<%
%>
<form action="check.jsp" mathod="get">
<h1> 一:判断题</h1>
<br>
1、对于挥发性较小的毒物,可以忽略其挥发作用。<br>
<input type="radio" name="r1" value="1">Ture
<input type="radio" name="r1" value="2">False<br>
2、一般金属化合物在水中的溶解度大,迁移能力也大。<br>
<input type="radio" name="r2" value="1">Ture
<input type="radio" name="r2" value="2">False<br>
3、水中的无机氮在较低的pE值时(pE<5)、NO3是主要形态。<br>
<input type="radio" name="r3" value="1">Ture
<input type="radio" name="r3" value="2">False<br>
4、在pH为6的土壤里,铝离子对碱的缓冲能力较大。<br>
<input type="radio" name="r4" value="1">Ture
<input type="radio" name="r4" value="2">False<br>
5、土壤的活性酸度与潜性酸度是同一个平衡体系的两种酸度。二者可以互相转化。<br>
<input type="radio" name="r5" value="1">Ture
<input type="radio" name="r5" value="2">False<br>
<h2>二:选择题</h2>
<br>
1,下列哪个气体类似与氧气的性质( )<br>
<input type="radio" name="c1" value="1">A.二氧化碳<br>
<input type="radio" name="c1" value="2">B.过氧化钠<br>
<input type="radio" name="c1" value="3">C.氯气<br>
<input type="radio" name="c1" value="4">D.高锰酸钾<br>
2.一些装有化学物质的容器上常贴有危险化学品的标志。下列标志中,应贴在装有酒精的容器上的是 ( )<br>
<input type="radio" name="c2" value="1">A.剧毒品<br>
<input type="radio" name="c2" value="2">B.易燃液体<br>
<input type="radio" name="c2" value="3">C.氧化剂<br>
<input type="radio" name="c2" value="4">D.遇湿易燃物品<br>
3.氧气的摩尔质量为( )<br>
<input type="radio" name="c3" value="1">A.32kg<br>
<input type="radio" name="c3" value="2">B.32mol<br>
<input type="radio" name="c3" value="3">C.32<br>
<input type="radio" name="c3" value="4">D.32g/mol<br>
4.除去NaCl固体中少量泥沙,肯定不会涉及的操作是 ( )<br>
<input type="radio" name="c4" value="1">A.蒸馏<br>
<input type="radio" name="c4" value="2">B.溶解<br>
<input type="radio" name="c4" value="3">C.搅拌<br>
<input type="radio" name="c4" value="4">D.过滤<br>
5.下图所示是分离混合物时常用的仪器,从左至右,可以进行的混合物分离操作分别是 ( )<br>
<input type="radio" name="c5" value="1">A.蒸馏、蒸发、分液、过滤<br>
<input type="radio" name="c5" value="2">B.蒸馏、过滤、分液、蒸发<br>
<input type="radio" name="c5" value="3">C.萃取、过滤、蒸馏、蒸发<br>
<input type="radio" name="c5" value="4">D.过滤、蒸发、萃取、蒸馏<br>
<h3>三:多选题</h3>
<br>
1,水与钠反应时,会产生的现象有哪些()<br>
<input type="checkbox" name="d1" value="1">A.钠会浮动并发出响声<br>
<input type="checkbox" name="d1" value="2">B.水会变成红色<br>
<input type="checkbox" name="d1" value="3">C.不会有任何声音<br>
<input type="checkbox" name="d1" value="4">D.会产生气体,发出臭鸡蛋的味道<br>
<br>
2,水与钠反应时,会产生的现象有哪些()<br>
<input type="checkbox" name="d2" value="1">A.钠会浮动并发出响声<br>
<input type="checkbox" name="d2" value="2">B.水会变成红色<br>
<input type="checkbox" name="d2" value="3">C.不会有任何声音<br>
<input type="checkbox" name="d2" value="4">D.会产生气体,发出臭鸡蛋的味道<br>
<br>
3,能用溶解、过滤、结晶的方法来分离的一组物质是()<br>
<input type="checkbox" name="d3" value="1">A.NaCl和淀粉<br>
<input type="checkbox" name="d3" value="2">B.CuO和KCl<br>
<input type="checkbox" name="d3" value="3">C.BaSO4和CaCO3<br>
<input type="checkbox" name="d3" value="4">D.KNO3和I2<br>
<br>
4,下列关于仪器使用和操作的说法中不正确的是()<br>
<input type="checkbox" name="d4" value="1">A.分液时,分液漏斗中的上层液体应由上口倒出<br>
<input type="checkbox" name="d4" value="2">B.蒸馏时温度计水银球可以高于蒸馏烧瓶支管口<br>
<input type="checkbox" name="d4" value="3">C.振摇分液漏斗时应关闭其玻璃塞和活塞<br>
<input type="checkbox" name="d4" value="4">D.除去KNO3中少量NaCl:将混合物制成热的饱和溶液,冷却结晶,过滤<br><br>
5,有CuO 、Fe 、H 2、Ba(OH)2溶液、K 2CO 3溶液、NaOH 溶液、稀硫酸七种物质,在常温..下两种物质两两间能发生反应可以有( )<br>
<input type="checkbox" name="d5" value="1">A.4<br>
<input type="checkbox" name="d5" value="2">B.5<br>
<input type="checkbox" name="d5" value="3">C.6<br>
<input type="checkbox" name="d5" value="4">D.7<br>
<br>
<input type="submit" name="sub" value="提交">
<input type="reset" name="res" value="重置">
</form>
</body>
</html>
出现试题如下截图:
第二个页面要求:出现对错显示并且打分
<%--
Created by IntelliJ IDEA.
User: 赵景云
Date: 2020/9/20
Time: 17:16
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>成绩及纠错</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>
截图如下: