Best Practice to store questions and options for Multiple Choice Question (MCQ) app?

Hello Folks!
I was trying to build an app with set of MCQ question. I tried creating a list of question, where each element is an object with “ques”, {“choice”: Option1/2 , “selected”: True/False}.
However, populating checkbox field with this nested data variable create problem with checkbox select and unselect(event was not updating the value on UI).

Can someone please guide the best way to populate MCQ. I think having it locally in app will be a better choice, still open for your valuable inputs.

Hi Mayank

The way I created a questionnaire was to read a list of questions from an external DB via API, but if there aren’t too many questions and if they won’t change regularly, there’s no reason why you can’t store them in the app or local storage.

I assign my list of questions to an app variable, which I repeat in a container an then display each question as either a toggle list item (could have used a checkbox) or input field, depending on the question type.

2 Likes

Thanks for your response. I am sorry, I gave up on this and was not active around.
Just one quick question, are you calling update record for swapping the true/false response via checkbox/toggle button? I was trying to keep the db calls limited in order to use free quota. So curious about this.

Hi, no I only create a record once all questions have been answered and the user taps a button when they’re done. I get the toggle value from the app variable I use to build the list.

1 Like