Click to See Complete Forum and Search --> : Quiz script


aommaster
05-31-2004, 03:01 AM
I don't know if this is the right board to post on, but, I'll have a go. I am using a quiz script from this page:
http://www.codeproject.com/aspnet/xmlquiz.asp

I want to do two things with this script, and since I am trouble in these languages, I am totally hopeless!

1.I want to put the whole quiz on one page, like a form. At the bottom of the page link above, a user had asked about it, but I couldn't understand what to do with the package that was recommended.

2.When the quiz answers have been submitted, the quiz displays the answers that have been given, and whether they are correct or incorrect. The thing I want it to do is also to display the correct answer with and explanation of WHY it is the correct answer.

Are these two thing possible? I can't use ASP, only ASP.NET by the way :)

buntine
05-31-2004, 11:12 PM
This is an ASP.NET question. I will move it to the correct forum for you.

CardboardHammer
06-01-2004, 08:42 AM
If you want to do it all on a single page, then the task is a whole lot simpler and you can just roll it from scratch. Of course, if you're totally clueless with coding, that'd be its own set of problems. However, if you've done regular ASP, you should be able to sort your way through it with a minimum of pain. If you check the response to that other user's question on the page you linked, someone gave a link to other code that might be more suitable for your needs.


Rolling your own:

If you're only using a single quiz and never another, you can hard code questions, answers, and explanations right into the page, else use a database (or an XML file per quiz, but a database is better (and less of a PITA to code), especially if you want to store results) to hold the data.

Slap all your questions and choices in a form (either hardcoded or populated from a data source) and put a submit button at the bottom. On posting, process the form (you might want to check that all questions have been answered and give the user another chance if they haven't). If desired, store the user's results. Then send back each question, the user's answer, and, if the user's answer was wrong, the correct answer and explanation of the correct answer (or you can give all the explanations, in case the user just guessed luck on the ones s/he got correct).

If you've processed a form in ASP, you should be able to figure out the basic logic. Look for sample code that processes forms for a guide.

aommaster
06-01-2004, 10:27 AM
Originally posted by CardboardHammer
If you check the response to that other user's question on the page you linked, someone gave a link to other code that might be more suitable for your needs.


Could you please tell me the link there? There was one one putting all the questions on one page, but the person who had replied had given a script to a poll, is that the one you are talking about? How can I use that to help me solve my problem?

CardboardHammer
06-01-2004, 11:00 AM
Yeah, that was what I was referring to... and, yeah, after closer inspection, it doesn't seem all that applicable to your situation.

Try using Google (this should be a good start: http://www.google.com/search?q=%22ASP.NET%22+survey+code+free&hl=en&lr=&ie=UTF-8&start=10&sa=N ). There should be some more applicable code out there.

PeOfEo
06-01-2004, 12:48 PM
Is the user going to login? It would be a lot easier to keep the values of every choice in a data base, rather then try to put them in a cookie.

aommaster
06-01-2004, 01:09 PM
Originally posted by CardboardHammer
Try using Google (this should be a good start: http://www.google.com/search?q=%22ASP.NET%22+survey+code+free&hl=en&lr=&ie=UTF-8&start=10&sa=N ). There should be some more applicable code out there.
Ok. there is something that I don't understand, why have you given me a survey code ?

Originally posted by PeOfEo
Is the user going to login? It would be a lot easier to keep the values of every choice in a data base, rather then try to put them in a cookie.

The user is not going to login. Like I said, I have no absolute idea about coding. My level is at its simplest! How do I link the script with a database? :) Sorry for bothering you guys, but I really find it hard to script. Telling me things like "Put the answers in a database" (which i though SHOULD have been done), make it really difficult for me to do. I never knew that it was in a cookie!

CardboardHammer
06-01-2004, 03:35 PM
Dang... Somehow I used the wrong search term. Try "quiz" instead of "survey" as a search term.

Not exactly my best day today...

PeOfEo
06-01-2004, 04:16 PM
Aommaster, data bases are just something you are going to need to learn how to do. I suggest buying a book on asp.net if possible and learning how to do it. We can help you make this, but we are busy and cannot make it for you. Right now I am working on my content management system, and am pretty far behind so I would not be able to stop and write script for you. If you learn how to use asp.net, and learn how to use data bases, you will be able to make some powerful applications, you will be able to make blogs, forums, image galleries, and many many more real world applications. If you actually learn how to use asp.net, you will actually see how powerful it is and how much you can extend your web sites.

This is going to go over your head, but this is how I would imagine the application to work

You have a data base
Table:
questions, with id, and the id of correct answer
Table:
answers, with id and question id to match with them
User table:
has all of the users names, passwords, ids, and then a feild with answer ideas in it separated by a - or something

The user takes the page and the last feild of the members table is updated, you redirect, the questions are all displayed, the answers are all displayed, correct answer is bold, their selection is red. Their selection can be picked out of the last feild of the members table by using a loop and a sub string with the question id.

That is roughly what I picture as how to do it, of cource there are other methods, it just depends on how many questions you are going to have in all. Also, this was an access/mssql server theory, not xml.

Good luck on google, hope you find what you are looking for.. otherwise you are going to have to learn how to put together what I said above which could prove to be a pain (though we would help you along the way).

aommaster
06-02-2004, 03:44 AM
Thanx alot for explaining that to me! That, i understood :) I'll have a go at that. Accroding to my first post, I already have the script for the quiz. Its just putting them all in one page that is causing a problem! Is there an easy way of doing it, or do I need to learn ASP.NET to be able to do it?

PeOfEo
06-02-2004, 03:55 AM
Originally posted by aommaster
Thanx alot for explaining that to me! That, i understood :) I'll have a go at that. Accroding to my first post, I already have the script for the quiz. Its just putting them all in one page that is causing a problem! Is there an easy way of doing it, or do I need to learn ASP.NET to be able to do it? well learning asp.net would really help lol. It would mean you would have to recode it to put them all on one page, the actual code would need to be almost completely redone. Dividing it would actually be a bit easier code wise IMO.

aommaster
06-02-2004, 04:01 AM
At the moment, I have my GCSEs, so, I don't think I could learn ASP.NET, but I would love to do it over the summer holidays!

So, what do you suggest, just leave the code as it is?

Also, the second part of my question said that if I wanted to display the correct answer if the wrong answer was chosen. Would that be possible by just inserting a piece of code, or, would the whole code need to be redone?

PeOfEo
06-02-2004, 04:04 AM
The second part would involve some new code being written, and it may or may not mean code being added to the script before. It probably will not need to be a full recode. I am assumeing the correct and wrong answers would be after the quiz.

Leaving it the way it is is always a good solution, as it is the least work :p I am lazy so I find my self settleing for mediocrity pretty often

aommaster
06-02-2004, 04:08 AM
:) ok! Thanx alot for your time!

aommaster
06-02-2004, 07:13 AM
Take a look here:

http://www.bbc.co.uk/schools/gcsebitesize/gigaflat/business/brandingandpackaging/brandingandpackaging_quiz.shtml

In hat language has this been written in?

Could I find a script similar to this?

CardboardHammer
06-02-2004, 12:07 PM
It is processed server side and there is no clear indication of how it is being processed on the server side.

You might be able to find some free code that'd behave like that for you, or you might not.

Your main choices are:
-Buy something that does what you need.
-Pay someone to do what you need.
-Learn enough to modify what you can find into what you need or to make it from scratch.
-Get someone to do it for you for free (don't count on it).
-Search for free code until you find exactly what you need (don't count on it).

If you need what you need NOW, then you're most likely going to have to part with some money. If it's not that critical, take your time and learn .NET in general and you can get a better return on the investment of your time... Trying to modify code without having a good handle on what's going on is a recipe for frustration.

aommaster
06-02-2004, 12:51 PM
Ok. Thanx alot for the advice, I'll have a look and see what I could do!

nolymytz
09-19-2004, 05:37 PM
anyone have any suggestions on how to write the results of this quiz to an xml file so that it can be sent to a database?

PeOfEo
09-19-2004, 09:07 PM
http://aspnet.4guysfromrolla.com/articles/071603-1.aspx
http://aspnet.4guysfromrolla.com/articles/112603-1.aspx

aommaster
09-20-2004, 08:46 AM
Talking about ASP.NET, and I think it will make Peo happy. I am going to take an MCAD (Microsoft Certified Applications Developer) course. This will include ASP.NET, VB.Net and will contain everything that I will need to learn! :)

PeOfEo
09-20-2004, 09:05 PM
good for you :D

Cstick
09-23-2004, 09:59 PM
aommaster,
I could always use a few bucks, I'll write your quiz for a very small fee! :)


PeOfEo, I read earlier you are working on a CMS. What language are you writing it in, how far along are you? I've been working on one for a few days here and there at work and finding that it seems to be a massive undertaking. I wouldn't mind seeying how you are tackling it.

PeOfEo
09-23-2004, 11:26 PM
ugh I burned out a long time ago. I have a few pages done but sort of stalled. I use vb.net. I know some c#, but use mostly vb.net for everything. CMSs are not super difficult to code... its just so much code that goes into them. I have 4 actual files of the thing, the rest I have planned out in my noggin, but thats about it. I was expecting around 15 files total to make it nice and complete. The four files I have are just a little code and not really complete themselves, they are not beautified or setup for the files to come. I have a job + school + life, and not much time for hobby work or freelance stuff.

Cstick
09-24-2004, 08:26 PM
Mine is about 400 lines of VB .net so far. I have got standard content editing down now: content, page title, & heading. I'm now working on the rollback ability and then I plan on working out the user & group settings so that the employees are restricted to their areas of the site. I have some modularizing, but I will have to keep going over it and filtering it down as I go along. It is all on 2 vb classes, one for the core and another for sql transactions. I have set it up a lot like Mambo, even borrowed some icons. :\

PeOfEo
09-24-2004, 08:37 PM
I just have the framework there for the secondary pages which would be able to be created edited deleted etc by the user, and I have the blog mostly done. Mine is far from being anything. I had a lot of good ideas, just no motivation to work on them. I was making mine completely with css, that was going to make it really easy to skin. So that the user would be able to redo the layout if they want, or use a lot of prefabs. I was going for all validity. I was using a lot of client side forms too just because I was getting more control using them. I sort of go back to asp classic style coding here and there when I really want a handle on the page.

Cstick
09-24-2004, 08:51 PM
Luckily, I am not concerned about handling templates or layout with mine. I am really trying to make it as simple as I can.
So far it is, in order to have a page fully functional I simply make the <title> tag a generichtmlcontrol, use a placeholder for the <meta> tags, and a place holder in the body column which displays content and editing controls dynamically. It has a lot of punch for just 3 tags.
The real trick was mastering dynamic addition of controls and postback.

PeOfEo
09-24-2004, 09:04 PM
I just get rid of post pack. I get rid of all post data. I do a redirect then fire scripts etc. I kill all that stuff right away to prevent problems from happening. But when you use css its great. I mean I do all my layouts with css anyway, but using it adds that much more functionality to the thing.

Cstick
09-24-2004, 09:38 PM
The real trick was mastering dynamic addition of controls and postback.

I'm sorry, let me take that back. It wasn't postback that I was having trouble with, it was the viewstate. I had to force the viewstate to include the programatically added controls. Later i figured out that pre-instantiating the controls and then adding them programatically did not require fooling with the viewstate.

PeOfEo
09-24-2004, 10:14 PM
viewstate is basically useless. It can move some strings here and there, but the same functionality can be acheived through a hidden input. I do not like viewstate because it tends to bloat source code. I turn it off.