Automatic question paper generation
-
Hi, i am creating an online test engine..Question papers and choices are stored in the database.when a user login for the test, a question paper vl b generated(randomly questions are selected from database).How to code that in c#.
sarodam wrote:
(randomly questions are selected from database)
You need to make use of
Rand()
method available in SQL Server. This will generate random number. I presume that each of your question having unique id. First you need to find starting and ending question number. Then start a cursor, Find random number which comes in between starting and ending question id. Inside this loop you need to select question details for the randomly generated question id and insert values into one temporary table. Finally select your temporary table. Using cursors is not advisable practice, but if no other methods are available you can choose this. :doh:
-
Hi, i am creating an online test engine..Question papers and choices are stored in the database.when a user login for the test, a question paper vl b generated(randomly questions are selected from database).How to code that in c#.
Use Random function to get the questions
Best Regards, Chetan Patel
-
sarodam wrote:
(randomly questions are selected from database)
You need to make use of
Rand()
method available in SQL Server. This will generate random number. I presume that each of your question having unique id. First you need to find starting and ending question number. Then start a cursor, Find random number which comes in between starting and ending question id. Inside this loop you need to select question details for the randomly generated question id and insert values into one temporary table. Finally select your temporary table. Using cursors is not advisable practice, but if no other methods are available you can choose this. :doh: