Hi m a newbie doing a project in online exams in ASP.NET & MS ACCESS I have the following table containing Questions:
and I have one more table Tests:
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
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.