learn java
The moose likes JSP and the fly likes Online Quiz Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » JSP
Reply locked New topic
Author

Online Quiz Application

Ankitt Gupta
Ranch Hand

Joined: Feb 19, 2009
Posts: 101
Develop a JAVA servlet/ JSP application:
Have a set of at least 10 questions and their corresponding answers. Please do not use a database to store these. You may use a file or use static variables in your code for the Q&A. Every time the application is accessed it would show a question and a multiple choice of 4 answers. It would wait for the user input (through radio buttons and 'submit' button).

If user input is correct, it displays "Congratulations. Your answer is correct!"

If user input is incorrect, it displays "Sorry. The correct answer is xxx"

After every Q&A, it would ask the user if he wants to answer another question. If 'yes', then it displays another question from the pool. If 'no', then it says "Bye. Please Visit Later"

NOTE:
1. The questions that are displayed should be randomly selected so that every time the application is loaded, the user is presented with a different question
2. In any given Q&A session, the system should not display the same question twice


I have develop the following 10 JSP's for each question.


JSP1.jsp



S_JSP1.jsp


I want to ask how to achieve the following...
NOTE:
1. The questions that are displayed should be randomly selected so that every time the application is loaded, the user is presented with a different question
2. In any given Q&A session, the system should not display the same question twice

William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12913
    
    5
That is hardly a general solution is it? I suspect your instructor would not be happy with it.

It is time to back off and separate the parts of the problem:

Don't think about the presentation side until you have a solution for the data side:

Some object to represent a question - including the text and a way to keep track of which is the correct answer.
Some way to populate a set of questions from a text file, building a collection of questions.

Now use a question object to populate a HTML page - presumably via JSP.

Bill
Mahtab Alam
Ranch Hand

Joined: Mar 28, 2012
Posts: 347

I have created one Quiz application using JSP Servlet.

While making this small app I learnt a lot specially maintaining sessions.

You can read about it and download the code Online Quiz Application Using JSP Servlet

I am thinking of adding below functionalities into it.

1. Each quiz can have different number of questions

2. Each question can have different number of options

3. A question can have multiple correct options

4. Implementing a timer for the quiz

5. Maintaining a history of the user; like how many tests a user have taken in the past and his score

6. Randomizing the order of questions presented to the user

7. Giving the user option to review his answers before submitting the test for evaluation

8. A dropdown box to jump to any question in between the test rather then clicking next button multiple times.


http://www.mahtabalam.net , Oracle Java Programmer , Oracle SQL Expert , Oracle Java Web Component Developer
J. Kevin Robbins
Bartender

Joined: Dec 16, 2010
Posts: 1317
    
  14

Please do not post the same question multiple times.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." -- Ted Nelson
 
Have you tried LearnNowOnline? http://www.learnnowonline.com/
 
subject: Online Quiz Application