0
im a math teacher and was wondering if anyone would know how to program a random, self grading quiz/test.
Is there a way for a test to pull from a set of questions and create a test.
16 Réponses
+ 11
@Kermit: That would be a starting point.
w3schools will contain most of the reference material you will require.
https://www.w3schools.com/jsref/jsref_random.asp
https://www.w3schools.com/jsref/prop_html_innerhtml.asp
+ 8
The course here is pretty good. Firstly you will need to able to create the quiz question and answer sections in html. After you can get a question and answer to display (like a tempate) you can then look at including the js functionality to fill out the template with the questions and possible answers.
lol. My first answer 😀. answers your question though doesnt it!
+ 7
^ that what I was thinking he should do for now, then later move over to a database (when it is all working as expected)
+ 7
Create a variable for score. later you can expand on this to show correct incorrect answers.
+ 6
entirely.
+ 3
Sounds good...thanks James and jay for your responses!!!
+ 2
That first response for Jay btw.
+ 2
Tbh I don't know JS that well. I'm used to using the above 2 frameworks to query a db and then passong the data to the front end to be manipulated by JS.
For all my JS needs I use w3schools.com, sorry I can't be of more help.
To do simple procedural programming as a basic test you could have radio buttons for answers. The questions could be hardcoded and put into an array and then the value of each one plucked out into each html element.
At the end the form could be posted and on pressing the submit button, the value of each radio button set could be taken and compared against the answers array etc. Etc. Something like that
+ 2
Try study Maz's quiz code...
https://code.sololearn.com/W36fu3dZLNZ8/?ref=app
+ 2
@calvin...thanks!!!
+ 1
At the end the form could be posted and on pressing the submit button, the value of each radio button set could be taken and compared against the answers array etc. Etc. Something like that
Ok yea...I found a method that does this but how would I get a report of my students results when they are done?
0
Yes absolutely, though you would need to populate a database with the questions and answers. They'd most likely need to be multiple choice too to make validating user input easier. Each written word would make validation slightly more complex due to different ways of saying the same thing.
Short answer: yes! OO programming would definitely make this easier in my opinion.
0
I'm not aware if it's very difficult...but if not entirely, then some direction would be greatly appreciated. And I only know very basic js at the moment. But thanks for responding.
0
I'd check out using an MVC framework like. NET or Spring MVC.
0
Thanks James,
Would you be able to provide some guidance for getting started? Maybe a js book or website that may shed some light on this?
0
@jay...I found some information that showed how to make a simple quiz. However, it wasn't random. I guess I'm asking how would I link a database of questions or array to quiz/test to pull from and produce feedback.