Quiz with random questions

I am designing a quiz with 20 questions each with four possible answers, each set question-answers is included in a virtual screen. I would like randomly display each virtual screen. I have used Taifun code described in https://puravidaapps.com/snippets.php#2removerandom with a slight variation though instead of displaying a virtual screen this message pops up: The operation Visible cannot accept the arguments: , [com.google.appinventor.components.runtime.VerticalArrangement@915d359]
Note: You will not see another error reported for 5 seconds.

Any help would be greatly appreciated.

Here is my code :https://drive.google.com/open?id=1JWrlPZKlQvkoHp8lXa_kLjPx0ye0Jf0r


The issue is here:

“Visible” accepts only True or False.

Thank you Ken, I’ve been able to control “emptyArrangement” screen visibility. Now I am trying to randomly send the information contained in any of the virtual screens named “questionA, questionB, questionC, questionD” into “emptyArrangement” screen though after reading through forums and video tutorials I can’t find the appropriate block or logic to use. Can you help me sort this out?

Here are my blocks and designer screen captures:

Blocks: https://drive.google.com/open?id=1_cV0tXMmNOmNiXQqZ8mcg07et5HbUacM
Designer: https://drive.google.com/open?id=1J_VE1vrLh_SW6v4LZV8USFzOYZ0cWcS2


Move the questions inside the emptyArrangement screen and Set the question(s).visible to false.
Set visible to true when you want them to display.

Side Note:
You can upload your pictures directly to this forum, you don't need to share a google drive link like we had to with the old forum.

Hi Ken, I have finally managed to randomly display my virtual screens though when I cycle through all of them I can’t get the warning I have coded, also do you have any ideas how to to hide the current virtual screen and return to the initial Screen when clickin on a reset button?

Here are my blocks

Maybe something like this would work:

Make a new list of all of your questions(I called it fullList) and use these blocks:


You could make index a global variable instead of a Local one.

Thank you for your help. I’ve sorted out the warning message not displaying since the problem laid on the way I was understanding its behavior. Also I’ve managed to randomly display my virtual screens. Now I’m in the process of adding a countdown timer for each question, I have included a reset button for each question with the intention of restarting the quiz should the player desires to do so, unfortunately I have not been able to reestablish the counter to its initial value of 10 despite all my efforts I can’t find the solution to this. Do you have any suggestions on how to solve it?

Here are my blocks:

1 Like

Hi Ken, never mind, I just figured out how to reset the countdown timer, I just added the four setTimer-Text blocks to all the reset buttons

Here are my blocks:

1 Like

Hi Ken, do you have any ideas as to how I can reload my questions when clicking the Reset button?

1 Like

Set myList to fullList

I have included the block combination “set myList to fullList” in each of the reset buttons though I can’t get the desired behavior. I can’t figure out what I am doing wrong. I am getting very weird results and the app just freezes up. How should I place these blocks? :thinking:

This might be setting myList to point to the original fullList, causing operations on myList to affect fullList. (This is one of the dangers of using linked lists internally.)

To be safe, instead set myList to copy(fullList), to avoid the possibility of side effects on fullList.

Thank you very much, my logic is now working as desired :slight_smile:

I am making a score counter for my App. The idea behind is to increase the score by one when a wrong answer is clicked, I’ve made a list including the three wrong answers though every time I click a button the score gets incremented by three instead of 1, could you please help me sort this out?


Under what circumstances would your global list wrongAnswers have anything else than exactly 3 items in it?

The idea behind the App is to have a group of 20 questions of which only 10 will be randomly displayed during each instance of the quiz, each of these questions have 4 options with only 1 right answer, every time a wrong answer is clicked the score counter should increase by 1. Whenever 5 questions are incorrectly answered the game is over and it resets itself to play once more. What I am doing now is experimenting how to implement the counter. The wrongAnswer list will have 60 items in it when the App is finished.