Site Search:
 
Speak Korean Now!
Teach English Abroad and Get Paid to see the World!
Korean Job Discussion Forums Forum Index Korean Job Discussion Forums
"The Internet's Meeting Place for ESL/EFL Teachers from Around the World!"
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Randomize your multiple choice questions

 
Post new topic   Reply to topic    Korean Job Discussion Forums Forum Index -> Technology Forum
View previous topic :: View next topic  
Author Message
mindmetoo



Joined: 02 Feb 2004

PostPosted: Thu Dec 21, 2006 3:22 pm    Post subject: Randomize your multiple choice questions Reply with quote

This is "alpha" mode right now. I'm going to add more bells and whistles (for example, being able to randomize multiple lists at once). I'm not sure the question field is needed. Anything you think needs adding?

http://www.gokorea.info/order.htm

You'll need to enter each item on its own line. I could have it also randomize a comma or tab delimited list but typically tests don't use such lists.

You'll notice one of the stickies above I wrote some Word Macro code to let you highlight a list in your document and then randomize it. This saves you the task of writing multiple choice tests and having to manually randomize the answers. Just highlight and boom. The downside is not everyone is savvy enough to handle the macro utility to paste in this code and it doesn't work on Mac Word. So I'm implementing it in PHP and in the process teaching myself PHP. Three days ago I was trying to figure out how to use ECHO so my code is pretty crappy.

If anyone knows PHP, here is the code below. (Quantity should be list_to_randomize or something.... some cut 'n' paste code I used from a PHP ordering form...)


Code:
<?php

$question = $_POST['question'];
$quantity = $_POST['quantity'];
$aletterflag = $_POST['autoletter'];
$auto_let_array = array('a', 'b', 'c', 'd', 'e', 'f', 'g',

'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',

't', 'u', 'v', 'w', 'x', 'y', 'z', 'aa', 'bb', 'cc', 'dd',

'ee', 'ff', 'gg', 'hh', 'ii', 'jj', 'kk', 'll', 'mm', 'nn',

'oo', 'pp', 'qq', 'rr', 'ss' ,'tt', 'uu', 'vv', 'ww', 'xx',

'yy', 'zz');

$quantityb = split("\r", $quantity);

// get the number of items in the array
// array starts at zero so remember a 3 item count is 0 1 2

$aarraycount = count($quantityb);

// get the last item in the array

$lastitem = strlen($quantityb[$aarraycount-1]);

// trim a blank line

if ($lastitem == 1)
{

  $quantityb = array_slice($quantityb, 0, $aarraycount-1);

}

$aarraycount = count($quantityb);
$aarraycount--;

srand(time());
shuffle($quantityb);
shuffle($quantityb);
shuffle($quantityb);


echo $question . '<p>';

// $aletterflag checkbox to auto letter the list

if ($aletterflag == "on")

{

   for ($i = 0; $i <= $aarraycount; $i++)
   {

     echo $auto_let_array[$i] . '. ' . $quantityb

[$i].'<br>';

   }

}


else
{
   echo '<br>';

   for ($i = 0; $i <= $aarraycount; $i++)
   {

     echo $quantityb[$i].'<br>';

   }
}



?>


I generate the auto lettering with an array vs using HTML's <OL type="a"> tag because when you cut 'n' paste from the output and don't highlight and copy the invisible OL tag, Word doesn't keep the lettering and just reads the <li> tags and renders it as bullets.

I was amused to find a shuffle() function in PHP, which saved me a whack of code.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Korean Job Discussion Forums Forum Index -> Technology Forum All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


This page is maintained by the one and only Dave Sperling.
Contact Dave's ESL Cafe
Copyright © 2018 Dave Sperling. All Rights Reserved.

Powered by phpBB © 2001, 2002 phpBB Group

TEFL International Supports Dave's ESL Cafe
TEFL Courses, TESOL Course, English Teaching Jobs - TEFL International