|
-
February 19th, 2006, 02:24 AM
#1
Online exam random Questions selection??
Hi m a newbie doing a project in online exams in ASP.NET & MS ACCESS I have the following table containing Questions:
QID(autono),Question,OptionA,OptionB,OptionC,OptionD
and I have one more table Tests:
TestID,QID,Question,OptionA,...OptionD,Duration
Now m showing a form where I enter the number of Questions in the test & duration.I want a random function to pick up Questions from the Questions table(random enuf not to repeat Questions) and insert them to the Tests table(TestID will be provided while creating the test).
Can sum1 help me out with both the above tasks.Its urgent pls help
-
February 19th, 2006, 05:17 AM
#2
Re: Online exam random Questions selection??
Use an array of booleans.
-
February 19th, 2006, 07:51 AM
#3
Re: Online exam random Questions selection??
 Originally Posted by Sahir
Use an array of booleans.
Could you perhaps elaborate a bit more or rather gimme a code snippet
-
February 20th, 2006, 05:22 AM
#4
Re: Online exam random Questions selection??
Suppose you have 100 questions, create a collection or array containing 100 boolean values, all set to false. Now generate a random number between 0 and 99. Suppose you got 37, check if the item at index 37 is true or false; if it's false display question 38 and set item 37 to true. If item 37 is true start iterating from 38 to 99 until you find one that's not used. When you find one, mark it as used and display the question number. Repeat until all elements are used. Suppose you iterate upwards hit 99 and still don't find an unused question then start from 36 and iterate downwards. You can also alternate the direction of iteration i.e. up then down then up etc.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|