1 2 Previous Next 22 Replies Latest reply on Nov 22, 2012 2:56 PM by TPD-Opitz Go to original post
      • 15. Re: Java questionaire app
        797836 wrote:
        Now tell me how we can do the randomization
        Sir, yes Sir!
        and how we can label the questions which is been answered?
        This depends on your data storrage. Ideally you'd have a database holding the questions. Then you could simpla add a table that stores the question ID, the user id and the ID of the answer (when given). this way you can later track wich user passed and wich failed.

        The minimal solution is to put a bean in the session context of the application server, but then the information will be lost when the session expires.

        • 16. Re: Java questionaire app
          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)
          Is there some good reason why you didn't mention that 11 days ago when you first asked for help? Or is it possible that you are still discovering requirements? In which case asking for a solution is considerably premature.
          • 17. Re: Java questionaire app
            Thanks. Honestly I was working on the requirements as we havent got the exact requirement which we are looking for.Now we got the exact picture of what we need to do.
            • 18. Re: Java questionaire app
              797836 wrote:
              Thanks. Honestly I was working on the requirements as we havent got the exact requirement which we are looking for.Now we got the exact picture of what we need to do.
              Excellent. Being a proper developer you should now be capable to pick it up and implement it. Or at least be able to come up with a start.
              • 19. Re: Java questionaire app
                Thanks. This is the design i am looking at:-

                     public class Question (mapped to the Question table)
                     private Integer questionId;
                     private Integer userId; // FK of User table
                     private String questionDesc;
                     private Integer answerId; // FK of Answer table
                     private List<Answer> answerDesc; // FK of Answer table
                     private String category ; // FK of Category table (Java,.NET, etc)

                public class Answer
                     private Integer answerId;
                     private String answerDesc;

                Now here the Question object will hold the details of the answers as well.

                Hence for a particular User who has logged in based on this expertise in a particular category (Java, .net, etc) the questions and the answers will be displayed. Here the

                QuestionId  UserId    QuestioonDesc     AnswerId     AnswerDesc       Category
                100 200 What is JVM? 1 aaa,bbb,ccc,ddd Java

                For the above question option 1 is correct which is aaa. Whether the above is right? or is there any better way to design the tables? . please clarify. Thanks.
                • 20. Re: Java questionaire app
                  After 400+ posts, isn't it time to learn how to put formatted code?
                  https://wikis.oracle.com/display/Forums/Forums+FAQ -----

                  You should have a marker in your Answer Table that indicates correct ones.
                  <tt>userId</tt> should not be part of the Question table unless each user gets it verry own set of questions.

                  And bye the risk of repeeting myself:
                  I'd crate another table that connects users, questions and the answer given by the user:
                  • 21. Re: Java questionaire app
                    Thanks TPD. Here the answerId will display the 4 objectives(that is the 4 answer options for the questions?) if not how we can map the multiple answers (in this case 4 for a question) and also mentioning the correct answer among the four in answer table? please clarify. Whether the multiple answers for the question should be separated by a comma as i shown in the previous example? Please clarify.
                    • 22. Re: Java questionaire app
                      Before proceding I strongly recomment reading:

                      This is not the place to learn the basics.

                      1 2 Previous Next