I need a suggestion about a scenario. E.g. if a student is taking assessment quiz online from his home and during this quiz …the elecricity failure happens in the middle of quiz. so in that scenario, how would we manage the state. I mean what could be the possible solution for that.. the solution can be in any form. Please give ur suggestions about how would you handle that situation. Previously, the states are being stored using sessions and cache.
Thanks in advance.
Electricity failure on student’s side
Your quiz probably flows from page to page where each page POSTs data to the server. You should just save posted data to some persistent medium (database would be best).
Identifying users after restart
Users are anonymous
If your users don’t need to login before taking the quiz you have to identify them somehow. Give them a persistent cookie with some identifier that you use in your DB to store their answers, so if power goes down and when they come back you will still be able to know who they are, because cookie will be sent to you automatically. The problem here is of course what happens when multiple students use the same machine. You’d have to solve that too. The easiest way is to let your users login to your quiz app.
Users are logged in
This is the simple case where you simply save their answers along with their ID. It works similar to first example but with the difference, that you know who they are exactly (know their name etc.)
What if you have several quizzes?
If that’s the case you probably don’t want to create a separate table for each one to store answers in. Th best way in this case would be to have a single table schema:
This will give you all the information about where users are in the quiz (so you they can continue after power failure) and save answers as XML data. Current step may help you when quiz is a stepped process and users return to existing unfinished quiz. This will help you display the first unfinished step to them, so they can easily continue where they left.
This will give you enough possibilities to store several different quizzes in the same table. XML data can provide simple straightforward answers or branched ones. Depends what your quizzes are like.
What kind of DB should you choose?
You can either choose schematic database like MySql, Oracle or SQL Server or you can go with a document-oriented database that may be much more suited to your needs. Depending on the platform you use you will find a suitable doc-type DB.
Assessment based on pool of questions
As you say you have a pool of questions and I suspect a DB schema like this should support the business process. You’d have these tables:
Subject– this table is needed in case you’d have a centralized application for various study subjectsGroup– has defined question groups and relates to Subject table; groups may be semester 1, semester 2 or similar; These groups will make it possible to select a set of assessment questions that are related to some subject and are part of the group that should be assessedQuestion– this is the actual pool of questions; Every question has related data to table Group; this table could have additional metadata that would have information about question level which could count toward result question/answer pointsStudent– your students must most likely login into this application and as pointed out by several answerers here it’s also recommended approach especially since I suspect students will be using common facility workstations which means that multiple students may be using the same computerAssessment– this is one of the central tables, that holds data about students taking assessment test; it’s related to Student table, has timestamp when assessment started etc.AssessmentQuestion– a relational table that’s used to record student’s answers; When assessment starts an X number of records within this table are created, that actually point to particular questions that were selected for a student out of the appropriate question pool; it has at least three columns: StudentID, QuestionID and answer (nullable); additional columns are needed in case students are allowed to set an answer of don’t know or similar; in this case an additional column AnswerState would be added and would relate to a lookup table with predefined states.When a student starts an assessment and in the meantime a power failure occurs, you can always know which questions student already answered and which ones should still be answered.
You could also have additional tables with correct answers so assessment would be automated, giving results immediately after assessment questions are all completed.
Algorithm that chooses questions could be done in a way so questions are equally distributed on the long run.
But you could make the system even more complicated with even more administrative data that would automate as much tasks as possible and make them configurable so it would be more widely useful.