Program | Online Quiz Code
Exam.asp provides a range of topics and options formatted with radio buttons. In order to make the quiz more challenging, there is a time limit. I set up a clock that starts automatically at mount time, setting it to 20 seconds. The remaining time is displayed in the status window at the bottom of the screen. The time factor can change as well as the number of questions. In order to choose a different topic from the database every time the member wants to take the test, I use a random function. In the database, the number of topics is fixed to 10, each member to answer 5 questions. All the questions are displayed together and then the timer starts. The following code is a function of the timer:
< script language= "JavaScript" >
var ck=0;
var tf=0;
var timeup=0;
var timeleft=0;
var tcount=0;
Timerfunc ();
function Timerfunc () {
Tf=window.settimeout ("Timerfunc ();", 1000);
tcount++;
Timeleft=20-tcount;
Window.status = Timeleft + "Seconds remaining";
}
</script >
Be aware that there is no time limit to the test is not fun.
This page of the query is like this:
id = request.querystring ("section")
Session ("id") = ID
Sql_tblname = "Select Tbl_name from paper where id=" &id
Set rs_tblname = Application ("Conn"). Execute (Sql_tblname)
Subject= rs_tblname (0)
MyString = Split (Subject, "TBL", -1,1)
The query string is stored in a session ("ID"), and the query is started sequentially. The purpose of this SQL declaration is to find the table name from the quiz table. The purpose of using the Split function is to remove TBL from the result. (I used a naming convention that preceded the table name with the TBL prefix). Once the table name is found, the query to the specified table begins. To make the application more interesting, I used random functions to generate any number from 1 to 10. These numbers are used to select an ID from the specified account table:
sql_details = "Select a.ID, A.question, A.choice1, A.choice2,a.choice3," &_
"A.choice4 from" & Subject & "A Where a.id=" &myarray (Counter)
In this query, Id,question, Choice1, Choice2, Choice3, and Choice4 are the domain names in the Account table.
MyArray (Counter) is a random number that has been generated.
After the quiz is finished, the results are stored and added to the database Details table. So members can see the results of the test. (In this case, I only keep one record for the account and a hundred score.) You can also have a time-date flag. )