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

  • Home
  • SEARCH
  • 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 6809955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:08:51+00:00 2026-05-26T20:08:51+00:00

I am building a multiple choice exam, which is better, to store each choice

  • 0

I am building a multiple choice exam, which is better, to store each choice into choices table, and link them to the question, or just create an object which contains all the choices and question text, and store it serialized into DB as one record ??

If I chose the serialized object method, I will save my self thousands of choices records belonging to questions.

class Quiz < ActiveRecord::Base
  has_many :choices
end

class Choice < ActiveRecord::Base
  belongs_to :quiz
end

So, which method to consider ??

  • 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-26T20:08:52+00:00Added an answer on May 26, 2026 at 8:08 pm

    Use separate tables. Storing serialized data in a relational database is almost always a bad idea; if you start with a clean normalized schema, changes will be much easier in the future (and all software changes over time, especially “one off quick hacks”).

    In your case, you want the choices in a separate table so that you can easily answer questions like “how many people chose option 3 for question 8?” or “which questions only have 2 choices”.

    Having separate tables also makes referential integrity much easier. For example, you could set up taken_quizes which have many answers which have one answer_choices each; then you can link the answer_choices back to choices to avoid inconsistent data. Referential integrity is difficult and very expensive if you’re storing serialized data structures in the database.

    BTW, you seem to have forgotten your Question class: a Quiz has many Questions and each Question has many Choices.

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

Sidebar

Related Questions

I'm building an application with multiple server involved. (4 servers where each one has
I'm building a RESTful web service which has multiple URIs for one of its
We are building an enterprise application in which we will incorporate multiple platforms for
I am building an application and I want to batch multiple queries into a
I am building an automation test suite which is running on multiple machines, all
I am building a online form, with about 20 multiple choice checkboxes. I can
I'm very new to Maven, and have a question about building multiple Maven projects.
Im building a Grails app that will have multiple similar websites (each it's own
I am building an application which has multiple user entry screens. I would like
I'm building a CLI survey app in Java that lets users answer multiple-choice questions.

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.