Questions FAQ

Jump to: navigation, search


How can questions be shared between courses?

See How to let teachers share questions between courses.

If I change a question in the question bank, will it be changed in all the quizzes it appears?

Yes. See Tim Hunt's forum post https://moodle.org/mod/forum/discuss.php?d=234011&parent=1016542#p1016558

Is there a way to set the default for essay questions on our site to allow uploading of one attachment?

The only way to change this at the moment is by editing the code.

In question/type/essay/edit_essay_form.php, find where it sets the default for 'attachments' to 0, and change that to 1.

Note that, after changing the data in the DB, you will need to go to admin -> plugins -> caching and purge the Question definitions cache. Or just purge all caches.

Why do some students correctly guess the answers for questions with images in them?

Example where top image gives the answer (amyloidosis), bottom image has non-descriptive title (img1)

When you insert an image in a question, make sure that the image title doesn't give away the answer, as it is displayed when mousing over the image.

How do I create system-wide question categories?

  1. As an administrator or user with system permissions, go to Question bank > Categories in any course.
  2. Using the "Add category form" at the bottom of the page, set the parent of the new category to be the system context.

How can students upload images to an Essay question?

When creating the question, in the section Response format, choose "HTML editor + uploaded files."

Is there a way to auto-grade answers to Essay questions?

Have a look at the following additional plugins:

Can I use questions (from the question bank) anywhere else besides a quiz?

Yes. See the Embed questions filter - A Moodle text filter plugin that displays questions from the question bank embedded in the page

Is it possible to make existing and future Third-party question types work in the Mobile app?

What is the purpose of the Save button when previewing a question?

The Save button is not very useful for a teacher previewing a question. What it does is to simulate what happens on a multi-page quiz, when the student moves to the next page, and then moves back. Any work-in-progress of the student should be automatically saved, which is why the button should appear to do nothing (unless you look very closely at the Response history table). However, for people developing a new question type, it is important that you can test that works, and that is why the save button was added here.

Can I resize the textboxes while the user is typing?

Yes. Marc Bernat Martínez and Dominique Bauer wrote this code that takes into account the exact width of the input, regardless of its length, font size and family used:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
/*
actualWidth    width of the input
checkWidth     width at which the box becomes wider
defaultWidth   default width of the box
c, ctx         see https://www.w3schools.com/tags/canvas_measuretext.asp
size           size of the font w/ px, e.g. '14 px'
               note that the size of the font can be defined in any units,
               e.g. small, medium, xx-large, 150%, 1.25cm, 22px
               since it is always transformed into px units
sizeN          size of the font w/o px, e.g. '14'
family         family of the font, eg. "Times New Roman", Times, serif
txt            text of the input, e.g. '123456'
*/
var defaultWidth = 100;
document.write('<canvas id="canvas_1" style="display: none;"></canvas>');
function newWidth() {
    var txt = $(".formulas_number").val();
    var size = $(".formulas_number").css('font-size');
    var sizeN = Number(size.substring(0, size.length-2));
    var family= $(".formulas_number").css('font-family');
    var c = document.getElementById("canvas_1");
    var ctx = c.getContext("2d");
    ctx.font = size + " " + family;
    var actualWidth = ctx.measureText(txt).width;
    var checkWidth = defaultWidth - sizeN;
    if (actualWidth >= checkWidth) {
        $(".formulas_number").width(actualWidth + sizeN);
    } else {
        $(".formulas_number").width(defaultWidth);
    }
}
$(document).ready(function(){
    $(".formulas_number").css("padding-left","10px");
    newWidth();
    $(".formulas_number").keyup(function() {
        newWidth();
    });
});
</script>

Note that these scripts can be used with all question types, not just the formulas question. They are available at moodleformulas.org.

See also


Any further questions?

Please post in the Quiz forum on moodle.org.