How do you calculate correct answers and wrong answers in a quiz app?

The first step in reducing blocks is to get all the questions, answer candidates, and correct answers out of text blocks and into a spreadsheet, so it can be exported as a csv text file and loaded into the Media folder.

Columns for a quiz:

  • question
  • correct answer
  • answer for button 1
  • answer for button 2
  • answer for button 3
  • answer for button 4
3 Likes

Thanks for reply but how to implement it and with the use of spreadsheet can I make offline app ?
Is it possible to show with blocks ?

in this case you can use files in csv format, probably easiest is to have a file with the questions like this

This is question 1
This is question 2
This is question 3

and another file with the answers

This is the correct answer for Q1, another answer 1,another answer 2, another answer 3
This is the correct answer for Q2, another answer 1,another answer 2, another answer 3
This is the correct answer for Q3, another answer 1,another answer 2, another answer 3

store the files in the assets, read them on first run of the app, convert them into lists and assign them to the question and answers list
do a search in the community for these steps in case you need help...

A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook http://www.appinventor.org/book2 ... 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 http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles
How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .

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.

2 Likes

Thank You. I will study these.

Sorry sir but I I didn't find any tutorial for this in community. I am eagerly want to make app for my students. please can you help me?

Have you read
http://www.appinventor.org/bookChapters/chapter10.pdf
?

1 Like

Yes. I understand how to store questions and answer in list. I got how to create the quiz and display result after user solve all questions. But I want to set background color green of button which user clicks if it is correct answer else red.And the background color of button should set green which has correct answer.
That is the point which I am not understanding. Sorry to bother you.

Devise a way for the user to spend time to see the colors you set in response to their answer.

Didn't understand, how to do it ?

I tried to apply a generic click event to your 4 answer buttons in screen3, then discovered you had several sets of 4 buttons each in that screen, and i did not have the language skills to tell which was right.

Here is the generic button click event I wrote, to replace the Samanya1-4 click events.
FirstMarathiEnglishQuizAppABG.aia (111.1 KB)

Your Screen3 is too complex for me to work with, with so many extra buttons in a language I don't understand.

P.S. Please read through the logic of this generic answer button handler and tell me if it makes sense to you.

P.P.S. It might be necessary for you to turn off button feedback for your 4 answer buttons in the Designer, in case the click animation interferes with background color replacement.

P.P.P.S. What is the difference between the two global variables CurrentflagSamanya and QuestionNumberSamanya? Why do you need two variables?

1 Like

Thank You So much It Works. You are genius.
It reduces some blocks.
In my project I made 4 List for options, 1 list for questions and 1 for answers so If I take 25 question then there might be 150 blocks only for quiz answer and options. That is why I want to develop quiz app as Taifun made. to make list for option in one csv
Can this logic work with this type of list as shows in Image blocks.


As shown in image, Can be implemented nextQuestion procedure in my app ?

I am sharing aia which you create for me with some modifications . Now I made it in English.FirstMarathiEnglishQuizAppABG.aia (106.5 KB)

Your nextQuestion procedure looks solid.

I did not bother opening your .aia file yet, as you did not report any problem with it, and I have not yet caught up with the overnight postings.

I am doing this but not getting expected result . What is wrong with blocks

FirstMarathiEnglishQuizApp_copy.aia (117.1 KB)

Show us the misbehavior so we can know what to look for.

Unless you are willing to wait for some one who understands your language to come along, an English version of your demo would be more likely to get a helpful response.

Also, some text describing

  • how you wanted it to react vs
  • how it actually reacted

would be helpful.

FirstMarathiEnglishQuizApp_copy.aia (128.4 KB)
Please have a look, I make demo in English.
You have helped me a lot. If this query will be solved, I am ready to publish app due to your help.
App misbehave as I shown in video

I chose the Profession quiz, and did not see any questions appear on the screen.

I looked for a Question Label in the Designer, but did not find one.

@SunilPawar

This is a basic quiz, it is in Spanish, maybe you can get some ideas.

The questions, the options and the result are in a file:

Capital of France,Madrid,Paris,Roma,Paris
Question,option,option,option,result

alea means that every time you Click in btn_Siguiente, the options are presented in random order.

borrar_p55A_preguntas_tipo_test_archivo.aia (4.1 KB)

http://kio4.com/appinventor/55A_preguntas_test_archivo.htm

2 Likes

Thank you so much for your help. Finally I got solution. Its all because of you.