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.
Show help buttons If this property is marked, in the module area the buttons "50/50" and "Show Hint" are displayed. Each button can be used once in the whole activity – no matter the number of questions.
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.
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.
Next label The text that appears on the "Next" button.

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 0. The event also has an item, which is the number of a 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 expects 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.

Default styles:

.quiz-error-layer {
    color: #FF0000;
    background-color: #FFFFFF;
    width:100%;
    height: 100%;
}

.question-wrapper {
    width: 100%;
    height: 100%;
}

.question-wrapper .question-title {
    text-align: center;
    height: 33%;
}

.question-wrapper .hint-button {
    background: url("resources/hint.png");
    width: 60px;
    height: 60px;
    cursor: pointer;
    float: right;
}

.question-wrapper .fifty-fifty {
    background: url("resources/50-50.png");
    width: 60px;
    height: 60px;
    cursor: pointer;
    float: right;
}

.question-wrapper .next-question-button {
    width: 60px;
    height: 60px;
    cursor: default;
    float: right;
    opacity: 0.5;
}

.question-wrapper .next-question-button.active {
    cursor: pointer;
    opacity: 1;
}

.question-wrapper .question-tips {
    display: inline-block;
    width: 80%;
    float: left;
    height: 34%;
}

.question-wrapper .question-hint-buttons {
    display: block;
    width: 20%;
    float: right;
}

.question-wrapper .question-hint-buttons .used {
    opacity: 0.5;
    cursor: default;
}

.question-wrapper .removed {
    opacity: 0.5;
}

.question-wrapper .question-tips .question-tip {
    display: inline-block;
    cursor: pointer;
    width: 50%;
    height: 50%;
}

.question-wrapper .question-tips .question-tip.correct {
    background-color: greenyellow;
}

.question-wrapper .question-tips .question-tip.wrong {
    background-color: #A52A2A;
}

.question-wrapper .question-hint-wrapper {
    height: 33%;
    width: 80%;
    float: left;
    display: block;
}

.question-wrapper .question-hint {
    background-color: #FFFF00;
    color: #000000;
    width: 100%;
    height: 100%;
}

.question-wrapper .game-won-message-wrapper {
    background-color: #00aa00;
    color: #ffffff;
    width: 100%;
    height: 100%;
}
.question-wrapper .game-won-message {
    text-align: center;
}

.question-wrapper .game-lost-message-wrapper {
    background-color: #aa0000;
    color: #ffffff;
    width: 100%;
    height: 100%;

}
.question-wrapper .game-lost-message {
    text-align: center;
}

.question-wrapper.disabled,
.question-wrapper.disabled .hint-button,
.question-wrapper.disabled .fifty-fifty,
.question-wrapper.disabled .question-tips .question-tip {
    cursor: not-allowed;
}

.question-wrapper .question-tips .question-tip.correct-answer {
    background-color: #99FF55;
}

.question-wrapper .quiz-progress {
    width: 60px;
    float: right;
    text-align: center;
}

Demo presentation

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