{"id":6643,"date":"2025-09-14T16:44:05","date_gmt":"2025-09-14T16:44:05","guid":{"rendered":"https:\/\/obsidiansofteducation.com\/?page_id=6643"},"modified":"2025-09-14T16:44:06","modified_gmt":"2025-09-14T16:44:06","slug":"mit-app-inventor-shuffle-quiz-app","status":"publish","type":"page","link":"https:\/\/obsidiansofteducation.com\/index.php\/mit-app-inventor-shuffle-quiz-app\/","title":{"rendered":"How to Shuffle Quiz Questions in MIT App Inventor | Easy Tutorial"},"content":{"rendered":"\n<p class=\"has-medium-font-size wp-block-paragraph\">Hello friends, and welcome to Obsidian Soft,<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Today, I will teach you how to add shuffling to your quiz questions.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">This was a feature requested by many people, so I thought that I should do a short video on this topic.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">I will not make a full quiz app as I have already done two quiz tutorials: the movie quiz app and the landmarks quiz app with multiple choices. I will just tell you how to structure your quiz questions, answers, and answer choices, and then do the shuffling.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">However, to show you shuffling at work, I do need to make a testing screen so it will be quick, quite ugly :D, but it will serve the purpose.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Start a new project. Let\u2019s call it ShuffleApp. Add a label from the user interface. Rename it to quesLbl. Make font bold, font size 18. Duplicate it by selecting it and pressing <strong>Ctrl + C &amp; Ctrl + V<\/strong> on the keyboard for Windows and <strong>Command + C &amp; Command + V <\/strong>for macOS.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Rename this one to ansLbl. Duplicate it again. Rename it to choiceLbl1. Duplicate it again. Rename it to choiceLbl2. Duplicate it again. Rename it to choice Lbl3.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Now, add a button below it. Rename it to nextBtn. And change the text to Next.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Duplicate the button and rename it to restartBtn. And change the text accordingly.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Our super simple screen is done, so let\u2019s go to the blocks section. The trick is in structuring this quiz. In our previous quiz tutorials, we had a list of questions, answers, and in the case of the landmarks quiz, an answer choices list. Here we are going to make one grand list.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">So, let\u2019s make a global variable called quizList and assign it an empty list.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">We still need a variable for holding our question number, so make that and assign it the value 1.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"454\" height=\"111\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-30.png\" alt=\"\" class=\"wp-image-6644\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-30.png 454w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-30-300x73.png 300w\" sizes=\"auto, (max-width: 454px) 100vw, 454px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Get the screen initialization event and start setting up our quiz.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Each item in our quiz list will be a list to,o with 3 items.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li class=\"has-medium-font-size\">Question<\/li>\n\n\n\n<li class=\"has-medium-font-size\">Answer<\/li>\n\n\n\n<li class=\"has-medium-font-size\">List of answer choices<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"355\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-31-1024x355.png\" alt=\"\" class=\"wp-image-6645\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-31-1024x355.png 1024w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-31-300x104.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-31-768x266.png 768w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-31.png 1142w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Make 3 more questions like this and add to the initialize event. Next, make a procedure that returns a result (the second type of procedure) and call it shuffle.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"226\" height=\"110\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-32.png\" alt=\"\" class=\"wp-image-6646\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Next, click on the cog wheel and add an input and rename it to list.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"310\" height=\"110\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-33.png\" alt=\"\" class=\"wp-image-6647\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-33.png 310w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-33-300x106.png 300w\" sizes=\"auto, (max-width: 310px) 100vw, 310px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Next, add a make sorted list block from lists. Make sure that you add this exact block.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"628\" height=\"222\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-35.png\" alt=\"\" class=\"wp-image-6648\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-35.png 628w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-35-300x106.png 300w\" sizes=\"auto, (max-width: 628px) 100vw, 628px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Now, get the getList block by hovering your mouse over the input list and provide it to <strong>from<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"222\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-34.png\" alt=\"\" class=\"wp-image-6649\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-34.png 800w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-34-300x83.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-34-768x213.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Next, plug in a &lt;= block from math and check if a random fraction is less than 0.5.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"248\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-36.png\" alt=\"\" class=\"wp-image-6650\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-36.png 800w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-36-300x93.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-36-768x238.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">This is a nice and simple way of shuffling lists, and it serves our purpose. But let me add a disclaimer: this is the simplest way, not the most professional. Later, I will show you a professional shuffling method that programmers actually use.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">So how does this work? The <strong>random fraction<\/strong> block gives us a decimal number between 0 and 1. Half the time it will be less than 0.5, and half the time it will be greater than 0.5. We use this 50\u201350 chance to randomly decide which item should come before another one in the list. The result is that the list ends up shuffled.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">While we are at it, let\u2019s make an empty procedure and call it showQuestion.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">And call both shuffle and showQuestion in screen1. initialize event.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"843\" height=\"1024\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-37-843x1024.png\" alt=\"\" class=\"wp-image-6651\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-37-843x1024.png 843w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-37-247x300.png 247w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-37-768x933.png 768w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-37.png 1240w\" sizes=\"auto, (max-width: 843px) 100vw, 843px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Now, let\u2019s work on our showQuestion procedure. You have to remember the structure of the quiz. We have a grand quizList in which each item is a 3-item list. So, first, we have to find the quiz question that has to be shown using the questionNum. The item returned by this selection is a 3-item list where the item at index=1 is the question\u2019s text, so set that to the quesLbl.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">The second item is the answer\u2019s text, so set that to ansLbl.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Now, the third item is a list with a&nbsp; further 3 things in it: our answer choices. So, construct the blocks carefully. Go for the index=3 to get the list of answer choices and then go for index =1 for choiceLbl1, index for choiceLbl2, and index = 3 for choiceLbl3. <img loading=\"lazy\" decoding=\"async\" src=\"blob:https:\/\/obsidiansofteducation.com\/3771a2a1-c39e-422e-840d-92583125924a\" width=\"602\" height=\"347\"><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">And put all of this inside an if block from control that checks that questionNum is less than or equal to the length of the grand quizList. Otherwise, we will get a list error.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">The next button code is simple: we add 1 to the questionNum number and we call the showQuestion procedure.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"180\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-39-1024x180.png\" alt=\"\" class=\"wp-image-6653\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-39-1024x180.png 1024w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-39-300x53.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-39-768x135.png 768w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-39.png 1162w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">The restart button for testing our shuffling is also quite simple. We set questionNum to 1, call the shuffle procedure, and then call the showQuestion procedure.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"286\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-38.png\" alt=\"\" class=\"wp-image-6652\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-38.png 1024w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-38-300x84.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-38-768x215.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">So, this is done. You can incorporate this structure in any of your quiz apps and make your quizzes more interesting by adding the random factor.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">I hope you liked this tutorial. You can also have a look at the video tutorial:<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<p class=\"responsive-video-wrap clr\"><iframe loading=\"lazy\" title=\"How to Shuffle Quiz Questions in MIT App Inventor | Easy Tutorial\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/rm_lbZ30LQ8?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<\/div><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Please like my videos and share it with your friends and family. Also, subscribe to my channel and press the bell icon so you don\u2019t miss any of the great projects I have planned for you.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><a href=\"https:\/\/www.youtube.com\/c\/obsidiansofteducation\" target=\"_blank\" rel=\"noopener\">https:\/\/www.youtube.com\/c\/obsidiansofteducation<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Please like my Facebook page and Instagram page for more educational resources and tips.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Facebook:<\/strong><a href=\"https:\/\/www.blogger.com\/blog\/page\/edit\/4947000819484484884\/7140650632339107612#\" target=\"_blank\" rel=\"noopener\">&nbsp;https:\/\/www.facebook.com\/ObsidianSoft\/<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Instagram:<\/strong><a href=\"https:\/\/www.blogger.com\/blog\/page\/edit\/4947000819484484884\/7140650632339107612#\" target=\"_blank\" rel=\"noopener\">&nbsp;https:\/\/www.instagram.com\/obsidiansoftapps\/<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Pinterest:<\/strong>&nbsp;<a href=\"https:\/\/www.pinterest.com\/obsidiansoft\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.pinterest.com\/obsidiansoft\/<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">For links to free educational&nbsp;<a href=\"https:\/\/obsidiansofteducation.com\/index.php\/flappy-bird-game-mit-app-inventor\/#\">&nbsp;apps<\/a>, have a look at the&nbsp;<a href=\"https:\/\/obsidiansofteducation.com\/index.php\/mobile-apps\/\">educational apps page<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello friends, and welcome to Obsidian Soft, Today, I will teach you how to add shuffling to your quiz questions. This was a feature requested by many people, so I thought that I should do a short video on this topic. I will not make a full quiz app as I have already done two [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-6643","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/6643","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/comments?post=6643"}],"version-history":[{"count":1,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/6643\/revisions"}],"predecessor-version":[{"id":6654,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/6643\/revisions\/6654"}],"wp:attachment":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/media?parent=6643"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}