Jump to navigation

Class: QuestionGroup

Numbas.QuestionGroup

new QuestionGroup(exam, number)

Represents a group of questions.

Parameters:
Name Type Description
exam Numbas.Exam
number number

The index of this group in the list of groups.

Properties:
Name Type Description
exam Numbas.Exam

The exam this group belongs to.

xml Element

The XML defining the group.

json object

The JSON object defining the group.

questionSubset Array.<number>

The indices of the picked questions, in the order they should appear to the student.

questionList Array.<Numbas.Question>
Source:

Members

settings

Settings for this group.

Properties:
Name Type Description
name string
pickingStrategy string

How to pick the list of questions: 'all-ordered', 'all-shuffled' or 'random-subset'.

pickQuestions number

If pickingStrategy is 'random-subset', how many questions to pick.

Source:

Methods

chooseQuestionSubset()

Decide which questions to use and in what order.

Source:

createQuestion(n, loading) → {Numbas.Question}

Create a question in this group.

Parameters:
Name Type Description
n number

The index of the question in the definitions.

loading boolean

Is the question being resumed?

Fires:
  • Numbas.Exam#event:createQuestion
Returns:
Type Description
Numbas.Question

question

Source:

loadFromJSON(data)

Load this question group's settings from the given JSON dictionary.

Parameters:
Name Type Description
data object
Source:

loadFromXML(xml)

Load this question group's settings from the given XML <question_group> node.

Parameters:
Name Type Description
xml Element
Source: