Quiz with Instant Results
Online quizzes are a great way to engage your students and test their knowledge on a particular topic. With SurveyJS, you can create multiple online assessment forms, add timing and scoring, customize their appearance, and give personalized feedback to each student once they have completed a test or right after they answered a question. This demo shows how to create an assessment test that displays instant results. Learners can see whether their answer is correct or incorrect immediately after they give it.
Create a Regular Quiz
For your assessment test, you can leverage all available questions types: single- or multiple-choice questions, true/false questions, fill-in-the-blanks questions, and many more. Specify the correctAnswer
property for each question. For detailed instructions on how to make a quiz in JavaScript, refer to the following help topic: Create a Quiz.
Display Results Immediately
To display the response result, check whether a question was answered correctly by calling a question's isAnswerCorrect()
method and show the check result. Handle the survey's onValueChanged
event to perform these actions immediately after a question value is set. In this demo, "Correct" and "Incorrect" labels indicate correct and incorrect answers. These labels are added to question titles (see the changeTitle
function).
You should also disallow users to change their answer. Configure a question's enableIf
expression to disable the question after it is answered.
Optionally, you can handle the survey's onTextMarkdown
event to format the correct/incorrect label text with HTML and CSS.