The Exam feature turns a survey into a timed quiz. A countdown timer is displayed to the respondent, and the survey records how much time remains when they finish. Optionally, audio sounds can play for correct and incorrect answers.

This is useful for knowledge assessments, literacy tests, field staff competency checks, and any survey where time-on-task is meaningful data.


check-exam() function

Configure the exam using check-exam() in the calculation column of a calculate field placed at the start of the form:

  check-exam(examTime, questionToStoreRemainingTime)
check-exam(examTime, questionToStoreRemainingTime, rightSound, wrongSound, excludeQuestion)
  

Параметри

#ParameterDescription
1examTimeTotal exam duration in seconds
2questionToStoreRemainingTimeThe name of a calculate or integer field that will store the remaining time when the exam ends
3rightSound(Optional) Filename of the audio file to play when a correct answer is given (attach to the form as a media file)
4wrongSound(Optional) Filename of the audio file to play when an incorrect answer is given
5excludeQuestion(Optional) Comma-separated list of field names to exclude from the exam timer (e.g., 'intro_note,consent')

Основно setup

Step 1: Add exam fields

typenamelabelcalculation
calculateexam_configcheck-exam(600, 'remaining_time')
calculateremaining_time

exam_config triggers the 600-second (10-minute) timer. remaining_time is populated automatically when the respondent finishes.

Step 2: Add your questions

The exam timer covers all questions in the form except those listed in excludeQuestion.

typenamelabel
select_one yesnoq1The capital of Kenya is Nairobi. True or false?
select_one choicesq2Which organ pumps blood around the body?
select_one choicesq3Water boils at 100°C at sea level. True or false?

Step 3: Store the remaining time

The field named in parameter 2 (remaining_time) is automatically set to the number of seconds remaining when the respondent submits. A value of 0 means time ran out; a high value means they finished quickly.


With audio feedback

Attach sound files to the form (as media attachments), then reference them:

typenamelabelcalculation
calculateexam_configcheck-exam(300, 'remaining_time', 'correct.mp3', 'wrong.mp3')
  • correct.mp3 plays when the respondent selects the right answer
  • wrong.mp3 plays when the respondent selects a wrong answer

Excluding questions from the timer

Pass a comma-separated list of field names to exclude from the exam (e.g., introductory notes or consent questions):

  check-exam(300, 'remaining_time', '', '', 'intro_note,consent_ack,section_header')
  

Leave rightSound and wrongSound as empty strings '' if you do not need audio but do need exclusions.


Complete example

typenamelabelcalculation
noteintroWelcome to the health knowledge assessment. You have 5 minutes to answer all questions.
triggerstart_ackTap OK when you are ready to begin.
calculateexam_configcheck-exam(300, 'remaining_time', 'correct.mp3', 'wrong.mp3', 'intro,start_ack')
calculateremaining_time
select_one yesnoq1Handwashing prevents the spread of disease.
select_one yesnoq2You should drink at least 2 litres of water per day.
select_one yesnoq3Malaria is caused by a virus.

Best Practices

  1. Always inform respondents about the time limit before starting — use a note or trigger before the check-exam() field.
  2. Exclude intro notes and consent questions from the timer using the excludeQuestion parameter.
  3. Use remaining_time in a follow-up calculation to detect time-outs: if(${remaining_time} = 0, 'Timed out', 'Completed').
  4. Keep the number of questions proportional to the time allowed — 2–3 minutes per question is a reasonable baseline for most knowledge assessments.
  5. Test with audio files on the actual device before deployment — audio playback varies across Android versions and browsers.

Limitations

  • The timer is display-only — the form does not automatically submit when time runs out; the respondent must still submit manually.
  • Audio feedback requires the device volume to be on and not muted.
  • The exam feature is an rtSurvey extension and is not part of the standard XLSForm specification.
Беше ли полезна тази страница?