Note: You are currently viewing documentation for Moodle 2.2. Up-to-date documentation for the latest stable version is available here: Drag and Drop question tutorial.

Drag and Drop question tutorial

From MoodleDocs

Tutorial: A simple example

I want to make a drag and drop question for a beginning French class - to test the knowledge of the words pomme(apple), orange, and grenouille(frog). To do so, I will use a background image with these words, and images of an apple, orange, and frog. I create the images and upload them to my moodle course files.

Words.jpg

Frog.gif Orange transparent.gif Apple transparent.gif

Then I edit a new drag and drop question. For this example, I've left the "Text" field empty. If some text is entered here, it will be shown under the initial position of the drag and drop image during the quiz.

Editing screen1.jpg
(Note that the fields "Image: X, Y, Width, Height:", " Hotspot: X, Y,
Width, Height :", and " Alternative hotspots :" can be ignored.  These
are for advanced usage - when you need to align images accurate to the
pixel, or when you need to have more than one possible "correct" hotspot
for an image.  The x,y,width,height values will automatically be filled
in when graphically positioning the images/hotspots in the second step.)

Then I click on "Position the hotspots" to proceed to the second step.

Initially, the images are underneath the background image:

Editing screen2-1.jpg

I drag and drop the images to where they should be:

Editing screen2-2.jpg

Now, I want to position the hotspots. When the student answers the question, if any part of the drag and drop image overlaps its hotspot, it will be considered correctly positioned. I click the button "Snap hotspots to all images". The hotspots are the red boxes that appear:

Editing screen2-3.jpg

I'd like to position the hotspots so that they cover each word, but not any of the empty space around each word. With the images and the hotspots both visible, it's hard to see what I need to see - the words on the background image. It could also be a little difficult to reposition and resize the hotspots, because it is easy to click on the drag and drop image instead of the hotspot. To make life easier, I click on the button "Hide images".

Editing screen2-4.jpg

Now I can see the background image without the drag and drop images getting in the way. By holding down the shift key as I click and drag on the lower-right side of the hotspots, I can resize the hotspots. Without the shift key pressed, I can position the hotspots by dragging them. When I'm done, it looks like this:

Editing screen2-5.jpg

Satisfied, I click on the button "Save and continue". This finishes the editing of the question.

When added to a quiz, the question looks like this:

Quiz view.jpg
Quiz view-2.jpg

Advanced option: alternative hotspots

Brian Kings help text extracted from the quiz forum : if you want one of the drag'n'droppable images to be correct if dropped on more than one hotspot, then you can specify alternativehotspots. you do this by providing a comma-seperated list of the ids (that you see on the screen, i.e. 1-10) of the other drag'n'drop image(s) whose hotspot you want it to match.

clear as mud?

for example, if you have 3 drag'n'drop images, and you want the first and third to be marked correct if they are dropped on the hotspot of either the first or third drag'n'drop image, then you would put 3 in the in the "alternativehotspots" of the drag'n'drop image 1, and put 1 in the "alternativehotspots" of the drag-n-drop image 3.

if you wanted the second drag'n'drop image to also match the other two hotspots, you would put 1,3 in "alternativehotspots".