where should I store question and answers

  • Thread starter Thread starter Sukh
  • Start date Start date
S

Sukh

I have to design a "Online Test Application" and application is going
to display question and answers.All the questons are objective type so
there is four answer for each question.
My Question is where I shuld store the questions and answers. and how
application can pick randomly question. right now I have all question
in a text file.

Please give me suggestion. I am using C# and asp.net for this.
Regards,
Sukh.
 
you could have two tables in SQL server:
Questions and Answers with relation between them
for each row in questions you will have many answers and all you need
is flag which one is correct

hope this helps
 
Thanks for your promt reply..I also thought the same but the questions
are differnt types like
one question , four answers and one answer is correct, some are Match
the follwing like left side 4 questions/options and on right side 6 or
7 options so user has to match like the correct answer for 1 is 4 like
so..
to implement this I hv to store this type of questions in seprate
table...Am I correct?
and
how to pick randamly questions?
Thanks
sukh.
 
Thanks for your promt reply..I also thought the same but the questions
are differnt types like
one question , four answers and one answer is correct, some are Match
the follwing like left side 4 questions/options and on right side 6 or
7 options so user has to match like the correct answer for 1 is 4 like
so..
to implement this I hv to store this type of questions in seprate
table...Am I correct?
and
how to pick randamly questions?
Thanks
sukh.
 
Thanks for your promt reply..I also thought the same but the questions
are differnt types like
one question , four answers and one answer is correct, some are Match
the follwing like left side 4 questions/options and on right side 6 or
7 options so user has to match like the correct answer for 1 is 4 like
so..
to implement this I hv to store this type of questions in seprate
table...Am I correct?
and
how to pick randamly questions?
Thanks
sukh.
 
If you application is small and would be contained to a workstation (as
opposed to being available as a web page hosted on a server), you may
consider that is would be a little simpler to avoid the databases
alltogether and just load up a Dataset and serialize it to disk. That way
you could always scale to a db later if you need, but don't actually have to
bother with installing a database for now.
You would still be able to release changes to the serialized dataset without
recompiling (that would be a little more work than updating a table in a
database).

I would set up the Dataset just like any other relational database with 2
tables, questions and answers:
Questions
id int identity
questionText string
correctAnswer int (pointer into one of the answers)

Answers
id int identity
fkQuestion int (foreign key to questions.id)
answerText string

To be simple about it, you could then use System.Random class to help you
pick a random question. Just make sure you seed it so that you won't end up
with the same sequence every time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top