views:

137

answers:

4

I am designing a simple database of online exam system. But i can not figure out how the questions and the answers should be stored. I am thinking question and Answer as different entities. There will be both MCQ and short questions in the same question set and the number of questions in a set may be dynamic(choose by teacher).

Please someone help me out

Thanks in advance

+1  A: 

maybe this link help to DESIGN tables

http://www.databaseanswers.org/data%5Fmodels/index.htm

a lot of example , also student exams

Haim Evgi
+1  A: 

As I see you're looking for something like this:

  1. User table - everyone who will be answering to the questions. It will have UserId and other profile information - name, class, photo, etc.
  2. Question table - it will have questionid, created by (userid) and text of the question
  3. AnswerOption - it will have optionid, link to question, text of answer option
  4. UserAnswer - it will have useranswerid, questionid, optionid

So for example you have this question: "How much is 2*2?" and answer options are "4", "5", "6".

In this case you will have 1 record in question table and 3 records in AnswerOption table.

Now when someone answers the question, you insert a record into UserAnswer table with respective userid, questionid and optionid.

Is this what you had been looking for?

And of course you should also think how to group questions in test etc.

Vitaly
+1  A: 

Since you've got multi-choice questions (MCQ, I assume), you need to consider carefully whether the alternatives in an MCQ are part of the question or are answers with a status (wrong, part of the right answer, correct). If a question has multiple answers, keep them in separate tables. If a question has just one answer, then keep them in a single table.

Jonathan Leffler
+1  A: 

Start from your smallest item. A question can have multiple answer choices, one of which is good. So you could have an answer table.

ANSWER: AnswerID QuestionID Choice Text Good (boolean qualifier)

QUESTIO: QuestionID Text Points

This is just a suggestion. It all depends on what you want to do. But first, you lay out by categories what your items are. Prefer loose leaf paper.

MPelletier