Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Random display of quiz questions

Posted on 2003-02-19
4
Medium Priority
?
290 Views
Last Modified: 2013-12-23
Dear experts,
Hello there and thanks for viewing this section.
I am still new to Dreamweavre Ultradev and i need to ask you guys a question about mah project.please help me

well i have to be able to display a page where by students can take an online assessment.The quiz would contain several questions and will be assessed online,where by the students get an immediate feedback on their scores and their scores will be sent to the database to be input to their grades table.Now comes the tricky part of the quiz questions,they have to be displayed by being randomized.The thing is how will i go about doing this.
will the questions need to be randomized at the database section or at the ultradev section.i am using sql as mah database
and if even so how would i deter the students to modify any content in the page by using view source.???

All replies are kindly welcomed.Thanks in advance.

hj
0
Comment
Question by:spicy7
1 Comment
 
LVL 1

Accepted Solution

by:
HanbingL earned 400 total points
ID: 8206257
Following is what I have done.  
1) Display a page of quize with 50 questions.
<%
'initialize database
sql="select * from test"
rs.open sql,conn,1,3

do while not rs.eof
RANDOMIZE
RandomValue = INT(200000*RND)+1
'Response.Write RandomValue & "<br>"
rs("count")=0
rs("count")=RandomValue
rs.update
rs.movenext
loop
rs.close

'get questions
sql="select top 50 * from test order by count desc"
Set rs = conn.Execute(sql)
%>

2) Then Display 50 questions in a web form:

<form action="submitanswer.asp" id="FORM1" method="post" name="FORM1">
<%
  i=1
  rs.movefirst
  do while not rs.eof%>
  <p><table align="center" width="80%">
  <tr>
  <td>
  <% Response.Write(i & ".")%> <%=rs("question")%></font>
  </td>
</tr>
</table>
    <table >
     
      <tr > 
        <td > 
          <input name="ans<%=i%>" type="radio" value="A">
          <%=rs("A")%> </td>
      </tr>
      <tr>
        <td>
          <input name="ans<%=i%>" type="radio" value="B">
          <%=rs("B")%> </td>
      </tr>
      <tr>
        <td>
          <input name="ans<%=i%>" type="radio" value="C">
          <%=rs("C")%> </td>
      </tr>
    </table>
<%
i=i+1
rs.movenext
loop
set conn = nothing
%>  
<input id="submit1" name="submit1" type="submit" value="Submit">
    <input id="reset1" name="reset1" type="reset" value="Reset">

3) Check answer and display a grade:
Submitanswer.asp

<%
NumCorrect = 0
rs.open "select top 50 * from test", conn
do while not rs.eof
  i=i+1
  StudentAnswer = request.form("ans"&i)
  if StudentAnswer = rs("Answer") then
    NumCorrect = NumCorrect + 1
  end if
rs.movenext
Loop
score = int(NumCorrect/j*100)

response.write score
%>
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
Suggested Courses
Course of the Month11 days, 6 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question