Randomizing question options
Hello. I am trying to create a multiple choice quiz using an array for the questions and answers data. Each array has 4 answer options which I have put the correct answer as the first option. I would like to randomize each question's answers so the correct answer isn't always answer A. Here is some of the code. Thanks for you time
var testModel: Array = [{
num: "30",
q: “what color is red?",
a1: " red ",
a2: " blue ",
a3: " green ",
a4: " pink"
a_btn.addEventListener(MouseEvent.CLICK, goclick_a);
b_btn.addEventListener(MouseEvent.CLICK, goclick_b);
c_btn.addEventListener(MouseEvent.CLICK, goclick_c);
d_btn.addEventListener(MouseEvent.CLICK, goclick_d);
var user_Test_ans: Array = new Array();
var newtestModel: Array = shuffle1Array(testModel);
var index1: int = 0;
var userTanswer: String = "";
questions_txt.text = newtestModel[index1]["q"];
a1_txt.text = newtestModel[index1]["a1"];
a2_txt.text = newtestModel[index1]["a2"];
a3_txt.text = newtestModel[index1]["a3"];
a4_txt.text = newtestModel[index1]["a4”];
You might be confusing the Array with an Object. Your Array as shown only holds one item, an Object that consists of a question and 4 answers and what I will guess is the value of the question. Where you shuffle the array you will not be doing anything to shuffle the answers within each question, you will only be shuffle the objects, essentially randomizing the order in which the questions get asked (assuming your shuffle1Array does what it would seem to).
If you want to randomize the answers you will need to place them in an array as well and then shuffle that before displaying the asnwer selections. You can probably do this without changing the Object so that you can refer to the "a1" property of the object to determine if a correct answer is selected.
Similar Messages
-
Some random questions about integration features
Greetings,
after working for a few weeks with Autovue's ISDK (web server) and having some sucess with its integration with our custom CMS, I have a few random questions about what can be done and what can't be done. So, instead of opening many new threads, I'll post them here together.
1) Translation. We are localised in Russia, and its translation is incomplete. I have found a tra_en.properties file in AutoVue/bin, and a description about how to create a properties file for custom actions. But no information about how to translate to other languages - and russian translation appears to be packed within the jar of the applet. Is there a clean way to translate, or refine the current translation, so we don't get a mix of russian and english commands in the applet? Because my tries using EXTRABUNDLES have failed, as I don't want to add a bundle for extra actions, but to replace it for existing ones.
2) Attachments in markups. Markups allow to attach other files, but since our CMS is custom, we only get the option to attach files from our local drives. We did no browse integration with the CMS, as people with different levels of permission will have different access to files there, and we considered unnecessary to provide that level of integration. We are considering to remove this action from the GUI, but before that I'd like to evaluate how hard would it be to generate an upload file action, so the attached file would be stored in the custom CMS and linked to it so the whole thing worked. My guess is "it will be hard and time consuming", so for now, we are considering to delete this feature in our integration.
3) Is there a way to resize the Open markup dialog? We have several properties displayed, and fit well within a standard screen, but the dialog is small and you have to scroll the table to see all properties.
Thanks for any assistance with these issuesAs always, thanks for the fast answer, Artash.
Yes, now I see attachments are stored inside the markup file. The problem is, when I open markup mode for the attachment, since the attachment uses some kind of default access method, my url's from the integration with the background CMS are broken completely. I believe the ideal state here would be to make some kind of inner markup for the attachment, maybe stored within the original markup file along the attached file. Or maybe it works that way, and I need to access it with the default gui action instead of my custom one. If that is the case, is there any way to tell the gui file how to differentiate a standard opened file from an attached one? If so, the issue has solution. If not... Well, then maybe something escapes me.
Edited by: Jordi Bosch on Apr 6, 2012 12:27 AM -
Random question slide not shown when FP 8 or FP 9 output
Hi everyone
I've just begun to use Captivate a month ago, so it is not
that much experience I can contribute with by now.
One thing I have recognized is that I get some problems with
random questions slides made from different question pools when
using Flash Player 8 or 9 in the output otions.
When using Flash Player 7 everything works as supposed: one
random question is shown for every random question slide using one
distinct question pool for each random question slide.
When using one of the two others some of my random question
slides are not shown. There are slides that are played - meaning
that the player shows an empty slide for the time of 3 seconds -
but the content is not shown. This happens only for some of the
random question slides, and those are the same question slides each
time, I publish - but when working or dragging around with the
random question slides and publish again, the problem would come
with some other random question slides, not positioned the same
place as before, but showing the same problem in each published
version.
As written before each question pool is only used once. The
different question slides used in the question pools are all
duplicates, naturally with adjusted content.
Does anyone has experienced something like that before? Could
there be any other trouble with the content when using Flash Player
7 in the output options, like quiz not playing in newly updated
Flash Players ore something like that? Anything?
I appreciate your suggestions or comments! Thanks in advance
and kind regards,
LarsSome more info - and a working solution...
I have worked on this topic a bit more - and found out, that
I have a problem with output option set to Flash Player 7, too.
When I delete every other navigation option than the "next
question" (what is it called in english?) button, I get this
problem:
The quiz now "freezes" randomly, not every time, but again
and again. The quiz has both random slides from question pools and
simple question slides.
I have found out, that putting the simple question slides
into question pools and then showing a random slide from those
question pools fixes the problem.
Has anyone experienced problems like that? Other solutions?
Kind regards
Lars
Maybe someone has a similar problem. -
Convert to Question Pool random questions?
We are updating a course we developed last year (prior to
Captivate 3). This year we want to apply Captivate 3's "Question
Pool random questions" to this course. Is there a way to create the
question pool(s) in this existing quiz, and then add last year's
questions to them without having to re-enter each question into the
Question Pool Manager?
Thank you for any tips!Hi Jan
Sure thing. Just convert the version 1 or 2 project to a
version 3 project. Then define a Question Pool. Once you have done
that, switch to Storyboard view. Select the question slides you
wish to add to the pool and right-click. You should be presented
with an option to add the selected slides to the pool.
Once you have moved the question slides to a pool, you would
then insert Random slides that point to the pool.
Cheers... Rick -
I have added 10 random questions to captivate 7 and I want to ask three to show for student. I have this set-up for text to speech. When I complete the module the questions appears fine, but I have experienced it reading a questions that it not on the slide. Any suggestions???
OK, I think I entered everything correctly on GoDaddy, but it's still not quite working. The only thing that's really changed is there's now a GoDaddy logo and message saying the site does not exist. I have a feeling the problem's on MobileMe's end, as I'm pretty sure I followed all the instructions for GoDaddy correctly. Although I skipped over the "Configure MobileMe" step since I'm pretty sure I've already done that correctly before (in MobileMe under Personal Domain my domain is there, saying everything is fine). Just in case I tried to reconfigure MobileMe by going into iWeb, then File>>Set Up Personal Domain on MobileMe, but whenever I click it it says the page does not exist. I'm afraid to remove the domain entirely from MobileMe and start from scratch because the "Set Up Personal Domain on MobileMe" option isn't currently working, at least not for me...
-
Need functionality to pick any 3 random questions from 5 input fields
Hi Experts,
In our password reset web dynpro application, we are providing 5 security questions to be answered by users,
but can we have the option to give only any 3 input fields randomly from 5 and allowing to be filled.
Need functionality to pick 3 random questions from 5.
Thanks in Advance
Sateesh JHi,
modify the sample code accordingly or else use below code.
DATA :
lv_mini TYPE i,
lv_maxi TYPE i,
lv_rndi TYPE i,
lv_i TYPE i.
lv_mini = 1.
lv_maxi = 5.
lv_i = 3.
WHILE lv_i > 0.
CALL FUNCTION 'QF05_RANDOM_INTEGER'
EXPORTING
ran_int_max = lv_maxi
ran_int_min = lv_mini
IMPORTING
ran_int = lv_rndi
EXCEPTIONS
invalid_input = 1
OTHERS = 2.
CASE lv_rndi.
WHEN 1.
WRITE :/ 'Question - ',lv_rndi.
WHEN 2.
WRITE :/ 'Question - ',lv_rndi.
WHEN 3.
WRITE :/ 'Question - ',lv_rndi.
WHEN 4.
WRITE :/ 'Question - ',lv_rndi.
WHEN 5.
WRITE :/ 'Question - ',lv_rndi.
WHEN OTHERS.
ENDCASE.
lv_i = lv_i - 1.
ENDWHILE.
Thanks,
Chandra -
Random question: Why are there multiple virtual consoles?
I'm very interested in every single detail of some things and that has spawned a random question.
Why do we have multiple virtual consoles(proper term?) ? i.e. if I am looking at my desktop I can simply hit ctrl-alt-f3 for example, and poof! I'm at a new login prompt.
What is/are the purpose(s) for this feature? Can someone name off some scenarios?
Thanks!Forgotten Path wrote:
How so? I tried running
virtualbox --startvm Windoze
on a virtual console and received an error about finding the X server.
Here is my ~/.xinitrc
#xset b off
setxkbmap -option ctrl:nocaps
case $WM in
kde)
ck-launch-session dbus-launch startkde
gnome)
ck-launch-session dbus-launch gnome-session
compiz)
~/bin/compiz&
ck-launch-session dbus-launch compiz ccp
#ck-launch-session dbus-launch fusion-icon
lxde)
~/bin/lxde&
ck-launch-session dbus-launch startlxde
openbox)
~/bin/openbox&
ck-launch-session dbus-launch openbox
e17)
ck-launch-session dbus-launch
enlightenment_start
vb)
VirtualBox -startvm "Windows XP" -fullscreen
xfce4)
ck-launch-session dbus-launch startxfce4
i3)
ck-launch-session dbus-launch i3
ck-launch-session dbus-launch startxfce4
esac
From the console, use :
WM=vb startx
or, if there is already something running on Screen 0 (OpenBox, Xfce4, whatever) simply:
WM=vb startx -- :1
Note that the examples start VitutalBox. I could just as easily set WM to any of the other environments defined in my .xinitrc.
I have also made this work straight from kdm. I think I created a custom session, but I may have created a .desktop file in /usr/share/apps/kdm/sessions/
I am not using kdm on this machine and I don't remember
edit: Typo
Last edited by ewaller (2012-02-11 23:14:09) -
AC4 - Random Question - the flv files are played automatically! What is the problem?
I have a problem under AC4 - random questions created from a question pool with questions containing "flv" files - are played automatically (as if the "Autostart" option was ticked") If I move all the questions with video (flv) into a filmstrip, I can decide when to play the video. How can I deal with this problem? I need those type of questions to be chosen randomly but the user has to decide when to play the video. Any ideas?
RadekI have a problem under AC4 - random questions created from a question pool with questions containing "flv" files - are played automatically (as if the "Autostart" option was ticked") If I move all the questions with video (flv) into a filmstrip, I can decide when to play the video. How can I deal with this problem? I need those type of questions to be chosen randomly but the user has to decide when to play the video. Any ideas?
Radek -
I was attempting to create a user at this site:
http://www.samsunggalaxys3forum.com/forum/register.php?do=addmember
It asks a "random" questions "Floors are horizontal, walls are ___?" When I hit submit, it returns an error that the answer was wrong. I tried several times using my macbook running firefox.
I get to work, where I am using an intel based machine running Windows 7, IE 9 and am able to register on the site and answer the question with no problem.
I have had the same problem on sites that use captcha - I cannot get past inputting the captcha phrase, as it returns an error every time, while using IE9 is problem free.
Is there something wrong with my setup of Firefox?The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
To Reset Firefox do the following:
#Go to Firefox > Help > Troubleshooting Information.
#Click the "Reset Firefox" button.
#Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
#Firefox will open with all factory defaults applied.
Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
Did this fix your problems? Please report back to us! -
Where is the random play option in the new version?
Where is the random play option? I want to play all my music through random but you can't seem to make that choice in this new itunes. Anybody figure it out?
Could it be Controls > Shuffle?
-
hey guys.. i have two random questions..
1) when you recalibrate your battery... after you drain the computer and leave it for 5 hours.. when you RECHARGE IT (before its fully recharged) are you allowed to use it? or are you only allowed to use the macbook AFTER it's recharged... (because in the instructions it only talks about using it for the 2 hours AFTEr it's rechaarged)
2) also... i always wondered if there was a better alternative between amc the ripper and handbrake (since mac the ripper apparently can rip different region coded dvds)... but ir ealised mac the ripper does FULL dvd rips whilst handbrake converts it into like mp4 and stuff... is that true? (as in.. u cant do vice versa on each?)
thanks a buncho everybody! go the mac..2) I use handbrake if I am planning on watching the
DVD on my ipod etc and Mac the Ripper to copy
(Backup) full DVDs. Obviously I do this in America as
it's illegal for some reason in the UK.
It is illegal in the US too. Seems "fair use" does not apply to DVDs and disabling the copy protection (which you do when you rip your DVD via mac the ripper or handbrake) is against the law. -
Publishing w/ Random Questions
Hi,
I am using random questions in one of my programs and about
to send it off to the client. This client has Captivate and would
like for me to send the CP files. My question is, if I send the CP
file for the program, will the random questions in the pool go with
it? If not, how do I get them there?
Many thanks for your help!Hi gbcvette
Yes, your random questions would be contained inside the .CP
file.
Cheers... Rick -
HTML random question score incorrect. SWF works fine
Version 8.0.1.242
Question pool 25 questions. Random Question slides inserted. All questions set to score 1. 24 are multichoice, all standard.
Published as HTML
Score reported is 1 out of x.
I have tested with 3, 5 and 25 random questions from the pool. But the score is always 1 out of x
Published as SWF
Works correctly
I really need the HTML version.
Closed, reloaded. Saved as - retested. Turned it off and turned it back on. Sacrificed a mouse...
AndyCorrect questions
....Should be same as total points scored anyway as there is 1 point for
each question. -
How to make Random questions work without closing and restarting?
I have a quiz using random question slides and random pools.
The random slides display random questions when I run the CP4 file, let it close then relaunch it. I'm using an LMS.
I would like to be able to repeat the quiz again without closing and relaunching, but my method does not work.
I tried using a button (retake) on the last slide to 'jump to' slide 1 when clicked. The quiz does repeat, but show the exact same questions.
I thought there might be a variable that would reset the quiz, but could not find one.
Does anyone have method to do this?
Thanks,
DaveI don't know of a way. My experience is the same as yours. The quiz questions are selected and shuffled when the lesson is launched. When 'retake' is clicked, the quiz repearts the same questions. The only way to get a new set of questions is to close and relaunch it.
I suppose there's be some function to invoke or array to manipulate via AS, but I've no idea what that may be...
So no help here, just backing what you're seeing.
Erik -
Random Questions are Not Random
The Question Pool has twenty-five (25) questions, and ten (10) Random Question slides in the project. The frist time a learner takes the course the questions are randomly chosen, as they should be. Assuming the learner fails and retakes the quiz, the learner is seeing the same set of questions; not a new 'random set. Is there some setting that I am missing to give them a new random set of questions? Thanks for any help!
Sorry, but that is the way random question slides are designed. The only way to have another set of random slides is to restart the module.
Lilybiri
Maybe you are looking for
-
Jump from Sales Order to Purchase Order and back again (all in change mode)
Hi, Situation is this: - Sales Order is created with 10 items. 4 items are created with connection to Purchase Order. - User open Sales Order in change mode - User goes to item 20 that has a related Purchase Order - User wants to jump to rela
-
PLD: BO on A/R Invoice
Hi all, I have a customer who is trying to add a Back Order field to her A/R Invoice PLD. If you have any suggestions that would be helpful. Thanks! Best regards, Jeff Haldeman Support One
-
Garageband - original file could not be located
I have just started to use garageband but i have fallen at the first hurdle. When i click on a song from my itunes library in the media browser i get the message "original file could not be located" However, if i right click on it, i locate it in my
-
Photoshop Elements 11 not exiting completely
When I exit from Photoshop Elements 11, I cannot reopen unless I go to task manager and make sure I end the Photoshop Elements process.
-
After upgrading my MacBook to OS X a few icons were added to my desktop that were originally my dock. When I try moving them onto the dock they copy themselves to the dock but stay on my desktop. Any ideas for how to keep my icons on the dock alone?