Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hello,
i have two tables one is quiz in which questions and the correct answer is stored
another table is result in which the answer given by user is stored.
there are total of 10 questions.
how to compare the correct answer and answer given by user and give 0.2 marks for every correct answer .

how can i do this in vb.net.
code plz
Posted
Updated 25-Sep-12 3:10am
v2
Comments
Zoltán Zörgő 25-Sep-12 9:10am    
What exactly is a table in your case? What is it's digital representation?
Jasbeer Singh 25-Sep-12 9:14am    
database table.. two tables stored in database. one is quiz where the admin stores questions and correctanswer and other table is result where the answers from user gets stored as he performs the quiz.
i want to declare the result that how many are correct and for every correct answer, i have to give 0.2 marks to user.
Zoltán Zörgő 25-Sep-12 9:23am    
Could you give us the ddl (schema) of these two tables.
Jasbeer Singh 25-Sep-12 9:31am    
table1: quiz (in this table admin stores questions, options, and correct option)
Columns: Qno,Que,Opt1,opt2,opt3,opt4,sCorrectans
Table2: result (the answers given by user is stored in this table)
columns: Qno,Que,ans

now i want to match sCorrectans from table1 quiz and ans from table2: result to check how many answers given by user are correct, anf for every correct answer, user gets 0.2 marks
Zoltán Zörgő 25-Sep-12 9:36am    
Is sCorrectans and ans a string or the index of the correct and the given option (1,2,3,4)?

It looks as if you are creating four multiple choice answers. Then, the user has to select one of the answers and when they are done, they submit them? I mean, I am only guessing because you say you have two tables, but you want this done in Visual Basic, wouldn't the tables be in a database?

As an example, create a 'RadioButtonList' and put four 'RadioButtons' in there. If you really want to do all of this in visual basic, you would have to dynamically create a RadioButtonList and the four radio buttons, then add the radiobuttons to the list.

As far as validating the proper answer, set three of the buttons to some value such as "No" or -1. The right answer would be...the actual answer. Then, I don't know how you are storing the answers...you say a table. Just compare the value of the radiobutton that was selected with the answer.

The user will start off with a score of zero, and if the question is answered right, add .02 to the score.

If you want to be a little more specific as to how you are doing this (post your code here), I will fix it for you, or if you have no code and need somewhere to start, just ask and I will help you.
 
Share this answer
 
Hi,
In your case you have two table.
I have done this using single table.
When user start Test that time one table contain Question,Ans1,Ans2,Ans3,Ans4,CorrectAns and SelectedAns.
When user press next button that time update SelectedAns field. Every time next button update that particular Row. When Press Finish or End Button that time calculate result using SelectedAns Field.


Try this. It's simple and Also easy to calculate result.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900