0

Want to create a small project for online exam using jsp. As of now I am unable to find, how can I
> Get random questions from mysql database
> Put the timer, so that the exam result is shown automatically after the specified time for exam is over

More queries to follow.

3
Contributors
5
Replies
10
Views
8 Years
Discussion Span
Last Post by ThinkFree
0

take a look on the following tutorial
http://roseindia.net/jsp/online-quiz-application-jsp.shtml

How can you suggest so awful example?

> Get random questions from mysql database
Depending on database structure. If you have questions organized by unique numeric value, then run random generator for numbers and then collect data from database. Worst case scenario no IDs, then store questions in array list, run random generator and match generated numbers with position in array list

> Put the timer, so that the exam result is shown automatically after the specified time for exam is over
Not sure of this, but I guess it will be done with JavaScript

0

Depending on database structure. If you have questions organized by unique numeric value, then run random generator for numbers and then collect data from database.

How to generate unique random numbers? If I use Random class, what should I do to ensure that any question isn't repeated?

0
  • Create a collection of integers (Array - there are some shortcomings to using array, ArrayList, Vector etc.)
  • Provide a loop mechanism that will repeat same process desired number of times
  • Generate random number
  • Compare against collection that this number is not already in collection
  • Depending on result you will either add this number to collection if it doesn't exists or you will request new random number
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.