Question categories

From MoodleDocs


A question category can contain individual questions or other question categories. They can be found by using the Question bank or when building a quiz.

What are question categories?

You can imagine a question category as a folder on your desktop computer. Then, questions are stored in these categories in a similar way as your files are stored in a file system.

Question bank categories
Question bank categories


Each category must have a name and you can include a short description of the category. You can create a category hierarchy. For example, you can specify a parent category for each category or the 'Top' as the parent, when a category has no parent. 'Top' is not really a category. It is just a parent for all the top-level categories. It exists so that, when you are adding questions to the quiz, you can select it as a way to get any question.

Tip: Creating question categories and sub categories is a good practice. It is better than keeping all your questions in one big list in the questionbank module. The hierarchy feature enables you to separate categories into sub categories and sub categories into sub sub categories etc. indefinitely. Categories and sub categories, etc., are very powerful when combined with random questions that can select either from one category or from a category or any of its sub categories.

Category set-up and management

  1. When you are in a question bank, from the Questions dropdown, select Categories.
  2. Click the Add category button to add a new category and fill in the form.
  3. Choose the 'parent' category in which your new category will be placed. Placing your category in another category makes it a sub-category of the parent. Choosing 'Top' means that your category is a top level category, not a sub category. When more than one sharing context is available you can place your category as a top level category in any of the contexts.
  4. Type the name of your new question category in the text box.
  5. Add an optional meaningful description in the category info area.
  6. Click the 'Add Category' button.

Your new question category will appear in the list of current categories.

New feature
in Moodle 5.2!


Collapse and expand categories

Categories in a question bank can now be collapsed or expanded, much like course categories on the site homepage. This is particularly useful in question banks with many categories. You can fold away sections you're not working on and focus on what's relevant. Click the arrow beside any category to toggle it.


Collapse/expand question bank categories
Collapse/expand question bank categories

Drag and drop categories

Categories can be dragged and dropped to reorder them within a question bank. This makes it straightforward to rearrange the layout as your course evolves. For example, dragging and dropping the Nutrition dense diet category from Speedy snacks to Default for Veg Cook category.

Drag and drop question categories
Drag and drop question categories

In-place category name editing

Category names can now be edited directly in the question bank interface without navigating to a separate settings page. Click on a category name to make it editable, type the new name, and the change saves instantly. This is a significant time-saver when renaming multiple categories at once.

In-place editing for question categories
In-place editing for question categories

Moving categories

From the categories page you can drag and drop to move, or click the three dots action button to the right of a category and select 'Move'.

Deleting categories

Click the three dots action menu to the right of a category and select 'Delete'.

Delete a category

If you try to delete a category containing questions, then you will be asked to specify another category to move them to. You cannot delete or move the last category. Also, you can’t delete the default category in a Question bank.

Editing categories

To edit an existing category, click the three dots action menu to the right of the category and select 'Edit settings'.