+ 1

How can I make the computer to give random questions and even check the answers and tell if it is correct or not. Is it possible

11th Aug 2023, 7:47 AM
AAISH
AAISH - avatar
3 ответов
+ 2
You can use a pseudorandom number method, most languages (if not all) have it, then link that to a dictionary with your questions and answers. Can you please change your tags as per this guide: https://code.sololearn.com/W3uiji9X28C1/?ref=app
11th Aug 2023, 7:51 AM
Ausgrindtube
Ausgrindtube - avatar
+ 2
Make an array of questions and lets say you have 10 questions. To get random question you need to take array[n] where n is random number between 0-9. And now to do check for answers you can compare every question but the way I'd do it to avoid a lot of typing is compare the n number with every possible output using if-else. Good luck.
11th Aug 2023, 7:56 AM
Hrvoje Kožul
+ 1
You could create a small class that hosts a question and an answer to the question. You can define whatever logic for checking correction of answers there. Then as others have said, you could create a list or array of those objects and then use a random number generator to output questions, to which you'd need to answer. You can't do this in pure html, but you could with Javascript and make it generate questions dynamically in your website.
11th Aug 2023, 12:07 PM
Marcos Chamosa Rodríguez
Marcos Chamosa Rodríguez - avatar