Ok so lets break this down into small manageable pieces and work from there.
1) Make a form that you can input questions and answers to a database
2) Make a form that can pull the question from the database and allows the user to input the answer
3) Validate the users input with the answer
That should get you start