im a math teacher and was wondering if anyone would know how to program a random, self grading quiz/test. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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.

14th Aug 2017, 11:22 PM
Kermit Brewster
16 Answers
+ 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
15th Aug 2017, 12:00 AM
jay
jay - avatar
+ 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!
14th Aug 2017, 11:47 PM
jay
jay - avatar
+ 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)
14th Aug 2017, 11:53 PM
jay
jay - avatar
+ 7
Create a variable for score. later you can expand on this to show correct incorrect answers.
15th Aug 2017, 12:02 AM
jay
jay - avatar
+ 6
entirely.
14th Aug 2017, 11:30 PM
jay
jay - avatar
+ 3
Sounds good...thanks James and jay for your responses!!!
15th Aug 2017, 12:04 AM
Kermit Brewster
+ 2
That first response for Jay btw.
14th Aug 2017, 11:38 PM
Kermit Brewster
+ 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
14th Aug 2017, 11:51 PM
James Cooke
+ 2
15th Aug 2017, 2:28 AM
Calviղ
Calviղ - avatar
+ 2
@calvin...thanks!!!
15th Aug 2017, 4:41 AM
Kermit Brewster
+ 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?
15th Aug 2017, 12:00 AM
Kermit Brewster
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.
14th Aug 2017, 11:33 PM
James Cooke
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.
14th Aug 2017, 11:33 PM
Kermit Brewster
0
I'd check out using an MVC framework like. NET or Spring MVC.
14th Aug 2017, 11:35 PM
James Cooke
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?
14th Aug 2017, 11:37 PM
Kermit Brewster
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.
14th Aug 2017, 11:53 PM
Kermit Brewster