Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6109507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:24:45+00:00 2026-05-23T14:24:45+00:00

I am creating a testing program. The three main objects I have right now

  • 0

I am creating a testing program. The three main objects I have right now are Tests, Questions, and Answers. I have three tables in the database, tests, questions and answers and a FK from questions to tests and a foreign key from answers to questions. As part of the questions table I have a column called correct_answer_seq_num which stores the seq_num (unique identifier) of the answer that is the correct answer to that question. I decided to put this attribute in the questions table, because only one answer can be the correct answer (for this specific test; I know there are tests where that is not the case), and if I put it in the answers table, then you could mark all answers as correct.

The trouble I am having is which object I should put this property in. Its not really an attribute of a question, it is more of an attribute of an answer, but I still think it should be in the question class for data integrity sake.

Am I making too big of a deal of this, and if not, where should I put the property?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:24:46+00:00Added an answer on May 23, 2026 at 2:24 pm

    I think the way you’ve done it in the database is correct and translates correctly into the model, too. Consider the following:

    Question  AvailableAnswers  CorrectAnswer
       1 * 1           1, 2, 3              1
       1 + 1           1, 2, 3              2
       1 + 2           1, 2, 3              3
    

    All three Questions have the same available Answers, and it’s only when an Answer is related to a Question and placed amongst other Answers that you can say whether it is correct. An Answer therefore has no ‘correctness’ without being associated with a Question, which makes an Answer's ‘correctness’ a property of a Question, not an Answer. This is especially true if the same Answer could be associated with multiple Questions – correct for some, incorrect for others.

    So to sum up, I think Question.CorrectAnswer makes more sense than Answer.IsCorrect.

    Finally, I think it is worth making a big deal out of this sort of thing, as if you’re not comfortable with your design decisions and the structure of your model it’s probably a sign that something isn’t right 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a program to transfer text from a word document to a database.
I'm currently stacked with the web service that im creating right now. when Testing
I am creating an automated testing framework in Perl for regression tests. I would
Creating liquid layouts is an immense pain. Now, I totally understand that tables should
I was creating my new webforms application and testing it. Now I added a
So I've done unit testing some, and have experience writing tests, but I have
I'm testing a conversion of our site's database from Sql Server to MySQL on
I am creating a little testing component and am running into a problem Basically
I am creating a copy of our testing Oracle DB (10g both) and run
I'm creating an EnityList to do some client side testing with my ViewModel. Something

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.