Documentation

Quiz

Description

The Quiz module is used for creating a single-choice test. When the user selects the wrong answer, the test will end. The module allows adding hints to questions and using the 50/50 type of assistance.

Properties

The list starts with the common properties, learn more about them by visiting the Modules description section. The other available properties are described below.

Property name Description
Questions This property contains a list of questions. Each question must have a specified Question topic, a CorrectAnswer, and three wrong answers. If the module is configured to show help buttons, each question also needs to have a specified Hint.
Test mode Allows continuing the game if a wrong answer is given.
Show help buttons If this property is marked, in the module area the buttons "50/50" and "Hint" are displayed. Each button can be used once during the game – no matter the number of questions.
Help Buttons Mode It is possible to show both the "50/50" and "Hint" buttons or just one of them. Note that the 'Show help buttons' property needs to be marked for this selection to make a difference.
Auto jump to next question If this property is marked, answering the question correctly will move the user automatically to the next one.
Next label The text that appears on the "Next" button that visible if the 'Auto jump to next question' property is not marked.
Game lost message Information that appears when the user selects the wrong answer.
Game won message Information that appears when the user gives proper answers to all questions.
Summary Mark this property if you wish to show the summary at the end of the game.
Summary message If the 'Summary' property is marked, you can write here the text that will be shown at the end of the game.
Correct message If the 'Summary' property is marked, you can write here the text that will be shown regarding the number of correctly answered questions.
Wrong message If the 'Summary' property is marked, you can write here the text that will be shown regarding the number of incorrectly answered questions.
Center vertically Mark for vertical centering.
Is activity This property allows defining whether the quiz module is an activity or not. When it is not defined as an activity, the answers given are not considered in the overall result. It is helpful when e.g., creating simulations.
Lang attribute This property allows defining the language for this module (different than the language of the lesson).
Speech texts Sets the values of speech texts - predefined phrases providing additional context while using the module in the Text To Speech mode. Speech texts are always read using the content's default language.

Supported commands

Command name Params Description
isAllOK --- Returns "true" when all questions are answered correctly, otherwise "false".
isAttempted --- Returns "true" if the user has made any interaction with the module, "false" otherwise.
hide --- Hides the module if it is visible.
show --- Shows the module if it is hidden.
enable --- Enables the module.
disable --- Disables the module.
reset --- Resets the module.

Show Answers

This module is fully compatible with the Show Answers module and displays correct answers when a relevant event is sent.

Events

When the user answers all questions properly, the module sends the 'ALL OK' event. This event is different from a normal event, so its structure is shown below.

Field name Description
Item all
Value N/A
Score N/A

When the user selects the answer, the module sends the 'ValueChanged' event. This event has a score of 1 if the answer is correct, otherwise it's 0. The event also has an item, which is the number of the current question.

Field name Description
Source ID of this instance of the module.
Item The number of a currently answered question.
Value 1
Score 1 - answered correctly
0 - answered incorrectly

Configuration

The module needs at least one fully configured question to appear correctly. If the "Show help buttons" option is marked, each question needs to have a specified hint. Otherwise, the hint is not required.

CSS classes

Class name Description
.question-wrapper The main module's layer.
.question-wrapper .question-title Indicates the style that applies to the question content.
.question-wrapper .hint-button Indicates the style that applies to the "Hint" button.
.question-wrapper .fifty-fifty Indicates the style that applies to the "50/50" button.
.question-wrapper .next-question-button Indicates the style that applies to the inactive "Next question" button.
.question-wrapper .next-question-button.active Indicates the style that applies to the active "Next question" button.
.question-wrapper .question-tips Indicates the style that applies to a layer with possible answers.
.question-wrapper .question-hint-buttons Indicates the style that applies to a layer with special buttons (Next Button, Hint, 50/50).
.question-wrapper .question-hint-buttons .used Indicates the style that applies to the inactive "Hint" and/or "50/50" buttons.
.question-wrapper .removed Indicates the style that applies to the possible answer removed by the "50/50" hint.
.question-wrapper .question-tips .question-tip Indicates the style that applies to each possible answer.
.question-wrapper .question-tips .question-tip.correct Indicates the style that applies to the correct answer.
.question-wrapper .question-tips .question-tip.wrong Indicates the style that applies to a wrong answer.
.question-wrapper .question-hint-wrapper Indicates the style that applies to the wrapper of a feedback area.
.question-wrapper .question-hint Indicates the style that applies to a layer with a hint for the current question, placed in a feedback area.
.question-wrapper .game-won-message-wrapper Indicates the style of the overlay placed in the feedback area when the game is won.
.question-wrapper .game-won-message Indicates the style of a layer placed in a feedback area with the "Game won message".
.question-wrapper .game-lost-message-wrapper Indicates the style of an overlay placed in a feedback area when the game is lost.
.question-wrapper .game-lost-message Indicates the style of a layer placed in a feedback area with the "Game lost message".
.question-wrapper .question-tips .question-tip.correct-answer Indicates the style that applies to the correct possible answer in the "Show Answers" mode.
.question-wrapper .quiz-progress Indicates the style that applies to the layer with information about progress.
.question-wrapper.disabled Indicates the style that applies to the module when it is disabled.

Example quiz styles

.addon_Quiz {
    width: 750px !important;
    height: 300px !important;
}

/* question title */
.question-wrapper .question-title {
    display: table-cell;
    width: 740px;
    text-align: center;
    height: 60px;
    margin: 5px 0;
    padding: 5px 0;
    vertical-align: middle;
    box-shadow: 0 0 0 3px #fff;
    background-color: #2a8edc;
    border-radius: 50px;
    color: #fff;
    font-size: 18px;
    line-height: 28px;
}

/* question tips */
.question-wrapper .question-tips {
    width: 100%;
    height: 135px;
    margin-top: 20px;
}

.question-wrapper .question-tips .question-tip {
    float: left;
    width: 343px;
    height: 28px;
    border-radius: 50px;
    margin: 5px 5px 0 0;
    padding: 10px;
    background-color: #57a6e2;
    border: solid 3px #fff;
    color: #fff;
    font-size: 18px;
    line-height: 28px;
}

.question-wrapper .question-tips .question-tip.wrong {
    color: #fff;
    font-size: 18px;
    background-color: #aa0000;
}

.question-wrapper .question-tips .question-tip.correct {
    color: #fff;
    background-color: #4CAF50;
}

/* question feedback */
.question-wrapper .question-hint-wrapper {
    height: 75px;
    width: 740px;
    background-color: #fff;
    border-radius: 100px;
}

.question-wrapper .game-lost-message-wrapper,
.question-wrapper .game-won-message-wrapper,
.question-wrapper .question-hint {
    display: table-cell;
    vertical-align: middle;
    border-radius: 100px;
    width: 740px;
    height: 75px;
    color: #fff;
    text-align: center;
    font-size: 18px;
}

/*question hint buttons*/
.question-wrapper .question-hint-buttons {
    width: 740px;
    position: absolute;
    top: 315px;
}

.question-wrapper .next-question-button {
    text-indent: -9999px;
    background-image: url(/file/serve/5800091593867264);
    background-size: 34px 34px;
    background-position: center center;
    border-radius: 50%;
    background-repeat: no-repeat;
}

.question-wrapper .hint-button,
.question-wrapper .fifty-fifty {
    background-image: url(/file/serve/4715951553380352);
    background-size: 34px 34px;
    background-position: center center;
}

.question-wrapper .fifty-fifty {
    background-image: url(/file/serve/4683842109440000);
    background-size: 54px 54px;
}

.question-wrapper .fifty-fifty,
.question-wrapper .hint-button,
.question-wrapper .next-question-button {
    width: 64px;
    height: 64px;
    border-radius: 50%;
}

.question-wrapper .quiz-progress {
    position: absolute;
    left: 350px;
    width: 64px;
    height: 64px;
    border-radius: 3px;
    line-height: 65px;
    color: #fff;
    background-color: cadetblue;
    border-radius: 50%;
    text-align: center;
    font-size: 18px;
}

.question-wrapper .hint-button,
.question-wrapper .fifty-fifty {
    float: left;
    margin-right: 15px;
}

.question-wrapper .fifty-fifty {
    background-color: #e59d14;
}

.question-wrapper .hint-button {
    background-color: #e354b6;
}

.question-wrapper .next-question-button {
    background-color: #4caf50;
}

.question-wrapper .question-hint {
    background-color: #e354b6;
}

.shape_quiz {
    background-color: #011645;
}

Demo presentation

Demo presentation contains examples of how to use the Quiz module.