I'm basically wanting to develop a java questionaire app, that holds a bunch of questions and the corresponding correct answers. So the question i would imagine i would make appear on the label and then having four possible answers a b c and d . Then finally giving the user a score. I'm not really sure what the best way to do this using J2EE but i have searched high and low and cannot find a good piece of code to give me some ideas. My problem is everything i search in google about java questionaires etc it just gives me a million tests of java knowledge.

Have any of you guys built or seen any code that you could link me to ?

797836 wrote:
Thanks Kayaman. I have knowledge on J2EE, but what some sample questionaire app. so that i will get more idea on how i can go about it. Any help is really appreciated.

J2EE huh? But that's knowledge from a decade ago.

I'll assume you know JEE - but then you're clueless as to requirements capturing and application design? Being able to translate specifications into a solution is basically your job you know. You just can't tell me you don't at least have a global idea of how to attack this problem. So share it - what did you come up with yourself so far?

797836 wrote:
Yes I am planning to store the questions and answers in the DB.

So you should do first things first:
Look at your requirements an decide which information need to be stored in the DB.
Define the relationships between those information and convert this initial data model to 3rd normal form.
When this is done it should be rather easy to create a WebApp using a framework of your choice.

If you haven't reached the experience level of programming with frameworks such as struts/spring and are still relatively new to JSP/Servlets, I suggest you make the program using JSP/servlets. I think it will get you up and running the quickest. Before doing so, I suggest you read a book on JSP (which normally covers servlets) rather than trying to find on-line pieces of completed code. Then, create a design as follows: a central servlet that all you JSP pages submits to. Have the servlet instantiate business logic that uses JDBC to communicate to the database (not exactly MVC design, but you can refactor later). In your database, have one table that holds the questions where each question has a primary key. Figure out how to read the table and display the questions. Add another table that holds the possible answers (parent/child table relationship). Display those under each question (with a checkbox for user input). Add a log in page to identify each user (userID/password). Create another table to hold the userID, questionID, and selected answer. In this way, you build up your design piece by piece instead of trying to do the entire database, etc at once. If you want, you can alternatively use JSF instead of JSP, after reading a book on it.

To make it clear, I am working on a project that requires me to create a class containing 20 questions and then I have to randomly select 5 questions with the respective answers in objectives (4 of them), but with the possibility of any number. can you please tell me how I can do this? Any help is highly appreciated and links are welcome.

Thanks. The real problem is not displaying the questions and the respective answers . Here we need to display the questions in random order by shuffling the questions frequently for the users and once a particular question has been answered correctly we need to remove it or label it saying that it is already answered hence the same question wont be displayed again for the same user? Now tell me how we can do the randomization and how we can label the questions which is been answered?