...

View Full Version : Creating a "Quiz" on my Website



rand0mz
01-15-2012, 02:12 AM
I would like to add a "Quiz" to my website.

I have used basic HTML forms to create how I would like the quiz to look, the quiz is multiple choice. Now I would like the quiz to be graded automatically without e-mailing me, and tell the user how they did.

I don't know JAVA but I would like to know if Java would be one method of doing this.

Any other methods I am also open to, thanks.

xelawho
01-15-2012, 02:39 AM
well, the first thing is that this is the javaSCRIPT forum. Java and javascript are 2 different languages.

the next thing is that javascript is very good for things like collecting the answers that a user gives on a quiz, but it is very bad at keeping the correct answers secret, because all that anybody has to do to see the answers is hit "view source" and there it all is.

but if you aren't worried about your users "cheating", probably javascript would be the easiest way to go.

rand0mz
01-15-2012, 02:44 AM
well, the first thing is that this is the javaSCRIPT forum. Java and javascript are 2 different languages.

the next thing is that javascript is very good for things like collecting the answers that a user gives on a quiz, but it is very bad at keeping the correct answers secret, because all that anybody has to do to see the answers is hit "view source" and there it all is.

but if you aren't worried about your users "cheating", probably javascript would be the easiest way to go.

Ok "Javascript" then I apologize.

Is this a fairly simple task for a beginner with javascript?

I am also curious what other methods I could use to avoid cheaters.

Old Pedant
01-15-2012, 03:20 AM
You can do it all in JavaScript, but anybody smarter than a turnip will be able to look at your JavaScript code and figure out what all the answers are. Thus defeating the normal purpose of a quiz.

If it's just a "self-test" or maybe a "pre-test" and you don't really care if the person can cheat, then JavaScript is a fine way to do it.

There have probably been at least one question like this every month for the past several years in this forum, so odds are good that a search of this forum will yield a workable answer. If you can't find something--and you don't care if people can cheat--then post again.

felgall
01-15-2012, 04:52 AM
I have a few quiz scripts at http://www.felgall.com/net3j.htm which don't allow people to cheat by just viewing the source code - it would require a lot more effort and a reasonable knowledge of JavaScript to work out the correct answers from the source - far more than is worth it for a quiz that is running in JavaScript and therefore can be considered to be "just for fun".

If you want a quiz that will actually record the results at the end and do something with them then you'd do better to use a server side language to create the entire quiz as JavaScript cannot do all of the things that are necessary for a more serious quiz where the result matters.

Old Pedant
01-16-2012, 04:24 AM
Well, I have to admit it was more work than it was worth, but...

The answer is the first number modulo ( 2 more than ( second number modulo 13 ) )

And adding this question caused it to bite the dust:
What is the name of the ~ mark?

<grin/>

(Referring to your "Revised Quiz Maker 1".)

felgall
01-16-2012, 08:58 AM
Well, I have to admit it was more work than it was worth

exactly - and you need to know JavaScript to be able to work it out (or have a very very large sample of quiz questions). For any 'just for fun' quiz that effort wouldn't be even remotely worth it.


And adding this question caused it to bite the dust:
What is the name of the ~ mark?

Yes I picked the ~ character as the separator because it is far less likely to occur in a quiz question or answer than any other easily accessible key on the keyboard. You obviously spotted that from the code and deliberately manufactured a question that you knew would break the script <grin/>

I created those quizzes specifically because I was asked to by a number of people who were unable to install server side quizzes because of the limitations on what part of the site they controlled. I would not consider using any JavaScript quiz on a site where I had access to use a server side version instead.

Old Pedant
01-16-2012, 09:43 PM
You could fix the embedded ~ problem.

Just use \t instead. Unless somebody copy/pastes a question in to your generator program, they can't input a tab as part of a question. And even if they do, you could use a regular expression to zap all tabs (convert them to spaces, say). The use of the \t would make the code even more obscure looking.

But never mind. That's being nit picky. It's a reasonably secure system, I agree. Not for serious quizzes but more than adequate for most website quizzes.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum