How i can shuffle questions?


in this code you create a logic due to which answers are shuffle ,so how i can shuffle questions

Instead of incrementing the index, get a random index between 1 and length of listQ and use that random index to select the question from listQ and corresponding answers from listA

http://ai2.appinventor.mit.edu/reference/blocks/math.html#randomint

Taifun

sir please mark it in image where it will

Question for you: where exactly are you incrementing the index currently? Especially examine procedure nextQuestion...

Taifun

sir this code is written by you ,L hope you know better than me

Of course I know... but you should understand the blocks if you like to use it...
The question is very simple... if you understood the example, then you should be able to answer it...

Taifun

This is a simple shuffle procedure:

But you don't want to shuffle only the questions, since the answers have to be in the same position in the list as their questions.

So instead, you build a list of the number from 1 up to 4 (the number of questions you have, and shuffle the list of question numbers.

Then you follow the contents of the list, using the items to look up the next question and answer as you administer the quiz.

ok sir ,but if you tell me then i will understand

please sir tell me ,i hope it is complex and i am beginner also.

Here is the answer for you again

What about trying something?

Taifun

1 Like

No, it is actually very simple...
It looks like first you have to learn some basics...

A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook App Inventor 2 Book: Create Your Own Android Apps ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here Course In A Box and the aia files for the projects in the book are here: App Inventor 2 Book: Create Your Own Android Apps
How to do a lot of basic things with App Inventor are described here: How do you...? .

Also do the tutorials Our Tutorials! to learn the basics of App Inventor, then try something and follow the Top 5 Tips: How to learn App Inventor

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.