I have a MCQS test application in which i have 3 tables e.g
i) Subject (sub_code, subject)
ii) Question (question_id,question, rate/level, sub_code)
iii) Answer (answer_id, answer, question_id)
I added the subject in subject i added the relevant question and for that question i added relevant answer in answer table.
If the user click on any option how can i know that the selected answer is right or wrong. OR
how can i pull the right answer as out put from my database. Plz Help
Thanks in advance
In the answers table...
So, the answers would be in the table like this: - insert into questions (id, subject_id, correct_answer_id, order, question) VALUES
-
(1, 1, 1, 1, 'what is computer');
-
-
insert into answers (id, question_id, answer) VALUES
-
(1, 1, 'A computer is machine')
-
(2, 1, 'A computer is mobile')
-
(3, 1, 'A computer is fax')
-
(4, 1, 'A computer is nothing');
The IDs I've given are arbitrary, and generally shouldn't be set manually.
9 1954
That depends on what determines the correct answer. In neither your Question table nor your Answer table is there any attribute defining which answer is correct. This should be defined on the question... Is that what the "sub_code" is?
kovik thanks for your response
so where i should define the correct answer whether in question or answer table and in what manner plz help me
Well, your question implied that this was already defined by this "MCQS" system.. Is this pre-built or did you make it?
No its not pre-build i want to make it
i make these three tables and now i have some problem about the right answer i you have some idea about this plz help me its urgent or if need to know about my code i can upload that.
Then, you either have to define the correct answer in the question or in the answers. If it is possible to have more than one correct answer, then define it in the answers. If there will always be one correct answer, define it in the question. I would also add an "order" attribute to these items so that they can be reordered without changing their physical IDs. - # Subjects
-
create table subjects (
-
id int not null auto_increment,
-
title varchar(255) not null,
-
primary key (id));
-
-
# Questions
-
create table questions (
-
id int not null auto_increment,
-
subject_id int not null,
-
correct_answer_id int, # Add this if there's one correct answer
-
order int not null default 0,
-
question text not null,
-
primary key (id));
-
-
# Answers
-
create table answers (
-
id int not null auto_increment,
-
question_id int not null,
-
answer text not null,
-
is_correct boolean default false, # Add this if there can be multiple answers
-
primary key (id));
Thanks for this kovik but where should i place the choices like a,b,c,d,e etc
e.g
Q 1 what is computer
a: A computer is machine.
b: A computer is mobile.
c: A computer is fax.
d: A computer is nothing. etc
In the answers table...
So, the answers would be in the table like this: - insert into questions (id, subject_id, correct_answer_id, order, question) VALUES
-
(1, 1, 1, 1, 'what is computer');
-
-
insert into answers (id, question_id, answer) VALUES
-
(1, 1, 'A computer is machine')
-
(2, 1, 'A computer is mobile')
-
(3, 1, 'A computer is fax')
-
(4, 1, 'A computer is nothing');
The IDs I've given are arbitrary, and generally shouldn't be set manually.
Thanks alot for your time Kovik
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Kevin A |
last post by:
Hi,
Is there a way to determine the name and version of the
operating system in a portable way? (for Solaris/Linux)
Thanks,
Kevin
|
by: Carmen Wai |
last post by:
Hello:
I would like to know whether there is any different in installing Postgresql
on the Linux system with file system of EXT2 or EXT3. I have two machines
with idential OS (Red Hat 7.3...
|
by: Fred Nelson |
last post by:
I'm a newby and I'm writing my first VB.NET print program!
I need to change the default left and right margins for my printed output
"e" is my "System.Drawing.Printing.PrintPageEventArgs
By...
|
by: Agnes |
last post by:
I got an window server 2000.
How can I get the server system date and systemtime , and put it into a
textbox ??
Thanks a lot
|
by: anil kumar.m |
last post by:
hi Gurus.
i have a requirement like pulling data from disconnected system.
y disconnected system means....cleint is not authorising us to connect to
his system becoz its in secured zone,so i can't...
|
by: Zelalem |
last post by:
Hi...
In the near future I am going to start developing an application program with VB.6, that can be used to handle students' examinaton process. Some of the functionalities of the ...
|
by: lazooo |
last post by:
I have the two following questions:
1. When you write the code you can do it in two different ways. You can write all the code directly in your gameloop or you can break it down in small functions...
|
by: sdlt85 |
last post by:
Hi, I need some help.
My program is runing but it is not given me the right answer.
The program it suppost to solve a polynomial, using Horners.
The user will enter the value for x and the...
|
by: Fro |
last post by:
Hi,
I have a php-script which writes uploaded files into a directory. My
php-script gives a specific names to the saved files. I found in the
directory a file which has a name which could not be...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |