Quizzes

Quiz

A QuizActivity has associated a Quiz object that contains the set of the quiz questions and the learners responses to the quiz.

Questions

The quiz questions can be either of type MultipleChoice, where learners can select one or more option, or OpenEnded, where learners can write an open ended answer.

API Example

Since there are different question types, quiz questions make use of GraphQL Interfaces. Common fields, such as id and content can be represented through QuizQuestion interface, specific fields can be fetched via an inline fragment.

pageInline fragments
query {
  activity(id: "db79e3a7-07e7-4b2f-b799-e00ed94c1c8a") {
    __typename
    ... on QuizActivity {
      quiz {
        questions {
          __typename
          content
          order
          isOptional
          questionType
          ... on QuizQuestionMultipleChoice {
            selectionMode
            randomizeAnswers
            options {
              order
              content
            }
          }
        }
      }
    }
  }
}

Responses

The quiz responses contains the learners answers to the quiz. Each answer can be either MultipleChoice or OpenEnded, depending on the question type.

API Example

Responses are available via a pageable GraphQL Connection.

pagePaginating queries
query {
  activity(id: "db79e3a7-07e7-4b2f-b799-e00ed94c1c8a") {
    __typename
    ... on QuizActivity {
      quiz {
        responses(first: 2) {
          edges {
            node {
              retryNumber
              submitter {
                name
              }
              group {
                members {
                  name
                }
              }
              answers {
                __typename
                question {
                  content
                  questionType
                }
                ... on QuizAnswerMultipleChoice {
                  selectedOptions {
                    content
                    order
                  }
                  isCorrect
                }
                ... on QuizAnswerOpenEnded {
                  content  
                }
              }
            }
          }
        }
      }
    }
  }
}

Last updated