图4-2 考生在线报名页面
4.2.2在线考试
考生登陆考试系统时,系统根据登录名和密码判断考生是否为报名后的考生,如果没有报名则提示考生先注册,注册完成后需要管理员审核考生是否符合条件,审核通过后考生才能参加考试。
考生登录后,可以选择相应的试题进行在线考试。考试过程中考生的答案保存在考试过程控制表(prj_process)中。自动生成试卷函数根据考试计划中的设置,从试题库中随机按要求组成试卷并存入考试过程控制表(prj_process)中。
考试结束采取自动交卷和到了规定的时间系统强制交卷的有机结合的方式予以实现。系统根据管理员制定好的答案进行判断,自动给出考生的考试成绩。
在线考试主要页面有function.asp,考试页面testing.asp,保存答案页面test_saveanswer.asp,考试结束显示结果页面testfinish.asp,成绩查询页面student_markquery.asp .
自动生成试卷的主要代码片段如下: '生成试卷
function makePaper(intPrjID,intStudentID) dim
rsPaper,strSqlPaper,rsNew,strSqlNew,intCourseID,intCount,arrTemp,intSSCount,arrSS,intMSCount,arrMS,intBCount,arrB,intCurType,I,J,intPos,blnPass
G_CONN.execute \from prj_process where prjid=\& intPrjID & \set rsPaper = server.createobject(\
strSqlPaper = \courseid,ss_count,ms_count,b_count from project
第 8 页 共 24 页
and studentid=\
where prjid=\
rsPaper.open strSqlPaper,G_CONN,1,1 if not rsPaper.bof and not rsPaper.eof then
intCourseID = rsPaper(\intSSCount = rsPaper(\intMSCount = rsPaper(\intBCount = rsPaper(\rsPaper.close set rsPaper = nothing makePaper = false exit function
else
end if rsPaper.close
for intCurType = 1 to 3
select case intCurType case 1
intCount = intSSCount intCount = intMSCount intCount = intBCount case 2 case 3 end select if intCount > 0 then
redim arrTemp(intCount)
strSqlPaper = \rsPaper.open strSqlPaper,G_CONN,1,1
if rsPaper.recordcount < intCount then '判断当前题库内试题是否足够
rsPaper.close set rsPaper = nothing makePaper = false exit function
\
end if
第 9 页 共 24 页
randomize timer
intPos = int(rnd() * rsPaper.recordcount) arrTemp(1) = intPos for I = 2 to intCount
intPos = int(rnd() * rsPaper.recordcount) blnPass = false while blnPass = false
for J = 1 to I - 1
if intPos = arrTemp(J) then
exit for end if
next if J = I then
blnPass = true
'使用线性探测解决冲突问题 intPos = intPos + 1
if intPos = rsPaper.recordcount then
intPos = 0 end if else
end if
wend
arrTemp(I) = intPos
next
strSqlNew = \
set rsNew = server.createobject(\rsNew.open strSqlNew,G_CONN,1,3 for I = 1 to intCount
rsPaper.move arrTemp(I),1 rsNew.addnew
rsNew(\rsNew(\rsNew(\rsNew.update
第 10 页 共 24 页
next rsNew.close rsPaper.close
end if
next
G_CONN.execute \G_CONN.execute \set rsPaper = nothing makePaper = true
end function
考试过程中对考生答案的保存的主要代码片段如下: <%
dim rsSaveAnswer,strSqlSaveAnswer,intAnswer,strAction,intID '考生答案,动作(主要用于多选题,决定是选中还是取消),试题ID
intAnswer = CLng(trim(request.querystring(\取得考试信息和答案 strAction = request.querystring(\intID = request.querystring(\
set rsSaveAnswer = server.createobject(\取得详细的题目,考生及考生答题状况信息。
strSqlSaveAnswer = \P_P.*,P_S.state,P_S.starttime,P.limittime from prj_process P_P,prj_student P_S,project P where P_P.studentid=P_S.studentid and P_P.prjid=P_S.prjid and P_S.prjid=P.prjid and P_P.id=\
rsSaveAnswer.open strSqlSaveAnswer,G_CONN,1,3
if rsSaveAnswer(\< rsSaveAnswer(\验证此答案是否在有效的时间内提交的.
‘判断答案合法性
if intAnswer = 0 or intAnswer = 1 or intAnswer = 2 or intAnswer = 4 or intAnswer = 8 or intAnswer = 16 or intAnswer = 32 then
'根据题目类型不同以不同方式保存答案
if strAction = \
if rsSaveAnswer(\
rsSaveAnswer(\rsSaveAnswer(\
=
rsSaveAnswer(\
or
else
第 11 页 共 24 页
相关推荐: