Macro to create cloze questions with a table

Macro to create cloze questions with a table

by Tieku Bortei-Doku -
Number of replies: 9

Does anyone have or can anyone help me with a macro to generate an excel csv type import file for a cloze question that looks like this:

Which of these are even numbers:

a. one {1:MULTICHOICE:No Idea ~%-100%True ~=False}
b. two {1:MULTICHOICE:No Idea ~=True ~%-100%False}
c. three {1:MULTICHOICE:No Idea ~%-100%True ~=False}
d. four {1:MULTICHOICE:No Idea ~=True ~%-100%False}
e. five {1:MULTICHOICE:No Idea ~%-100%True ~=False}

 

Average of ratings: -
In reply to Tieku Bortei-Doku

Re: Macro to create cloze questions with a table

by Pierre Pichet -
I obtained
  1. the page source of your post from the browser,
  2. located the table html code and copied
  3. and pasted it in a cloze question editing page in the text mode.
I decoded to check that everything is OK and I saved the question.

see at http://132.208.141.198/moodle_19/
user: moodle pw:moodle
question name : test cloze forum

Pierre



In reply to Pierre Pichet

Re: Macro to create cloze questions with a table

by Tieku Bortei-Doku -

All my cloze questions will follow the same format and have the same layout. There will also be just 2 possible response types:

 

Which of these are cars?

a.

mustang

{1:MULTICHOICE:No Idea ~=True ~%-100%False}

b.

jeep

{1:MULTICHOICE:No Idea ~=True ~%-100%False}

c.

mazda

{1:MULTICHOICE:No Idea ~=True ~%-100%False}

d. 

ibm

{1:MULTICHOICE:No Idea ~%-100%True ~=False}

e.

mac

{1:MULTICHOICE:No Idea ~%-100%True ~=False}

 

I will have 50 questions per exam. Is there any way of NOT having to draw the table 50 times in the editor. I want to have my questions and responses imported from a spreadsheet? Is this possible?

In reply to Tieku Bortei-Doku

Re: Macro to create cloze questions with a table

by Itamar Tzadok -
Yes, or at least here is what I do. smile I use Moodle XML. I have an Excel worksheet with columns for the question name (say A) and the question text (say B) and then for the following elements of the XML item (say E-J):

<-question type='cloze'>
="<-name><text><![CDATA["& B1 &"]]></text></name>"
="<-questiontext format='html'><text><![CDATA[" & C1 & "]]></text></questiontext>"
<-image></image>
<-penalty>0</penalty>
<-/question>

(Remove '-')
Note that the name and question text take their values from columns A and B.
In column D I aggregate the XML elements into one record as in

=E1&F1&G1&H1&I1&J1

All that is quite straightforward. Once I have all the data I simply copy column D and paste it into a text file between

<-?xml version="1.0"?>
<-quiz>

and

<-/quiz>

and upload the file to Moodle. (Remove '-')

The tricky part is to get the tables into the data worksheet. For that I use another Excel file. One worksheet in that file contains formulas which take values from other worksheets and wrap them with HTML code for a table. I store each question in a different worksheet but in the same area and then I simply change a certain value on the first worksheet to display and convert a question into an HTML string (aggregated in one box) which I then copy and paste in the data worksheet.

If that may suit your need I can attach sample Excel files with the formulas I use (although the structure of your questions is much simpler than that of my questions and much simpler formulas may sufficient for your purpose).

Itamar
In reply to Itamar Tzadok

Re: Macro to create cloze questions with a table

by Tieku Bortei-Doku -

Itamar,

Thank you. It looks like  i was trying to do something similar but without success. I will try this and let you know how it goes.

And yes, please attach sample Excel files with the formulas you use in your next response. 

Tieku

In reply to Tieku Bortei-Doku

Re: Macro to create cloze questions with a table

by Itamar Tzadok -
Timothy's Excel2GIFT probably has a much friendlier user interface than the tools I build for myself, so I'm not trying to compete. wink

Attached is an Excel file with formulas ready to convert questions like the one you posted above. I've set it up such that it accepts questions formatted as

mustang True
jeep True
mazda True
ibm False
mac False

and produces HTML which is displayed as

1. mustang {1:MULTICHOICE:No Idea#~=True#~False#}
2. jeep {1:MULTICHOICE:No Idea#~=True#~False#}
3. mazda {1:MULTICHOICE:No Idea#~=True#~False#}
4. ibm {1:MULTICHOICE:No Idea#~True#~=False#}
5. mac {1:MULTICHOICE:No Idea#~True#~=False#}

Each question goes into a different worksheet starting at A1.

To produce the HTML on the main worksheet you type the question's worksheet name in the blue box and then copy the HTML from the purple box.

If you decide to use it and you need any other details let me know. smile

Itamar

In reply to Itamar Tzadok

Re: Macro to create cloze questions with a table

by Tieku Bortei-Doku -

Itamar

Thank you. What would be the best way of communicating if i needed to talk through the workings of the excel workbook with you?

Tieku

In reply to Tieku Bortei-Doku

Re: Macro to create cloze questions with a table

by Itamar Tzadok -
My email should appear in my profile page. Fill free to send me any question you have. smile

Itamar
In reply to Itamar Tzadok

Re: Macro to create cloze questions with a table

by rupert salmon -

Hi Itamar, You have already very kindly responded to my query about using a floating /fixed mp3 player for listening exercises in moodle. I still haven't found a better system than having the students call up their own default player but hope moodle 2 will provide a better solution for later. 
I would like your informed opinion on another topic : I am trying to adapt exercises that already exist for my school so they can be consulted on moodle. We do a lot of listening for trainee air traffic controllers where the information they are listening out for is often numerical. We have 2 types of exercise - 1) cloze on the text itself hence my previous questions and 2) charts. This latter is very good for getting the students listening for meaning as opposed to filling in blanks (without necessarily understanding). 
I would like you to tell me if you think it is possible - in moodle 1.9 - to import such charts into a moodle cloze ex format - I attach examples of such charts with the words in bold figuring as the answers to cloze questions.