Forum General


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

True/False Quiz: How to display different sets of questions

avillegas16avillegas16 Member ✭✭

I am working on a True/False Quiz app, and currently only one set (list) of questions is being asked. I want, however, to have more variety by having two versions of the same question, and show JUST ONE of these. For example--as shown in the code below for my question list--I have "1=2" (false) but I also want the question "1=! 2" (true). Again, I'd like to just show ONE of these in my quiz.
By the way, I already tried adding an "or" and "||" to each question in my question list, but that's not working. Thank you.


public QuizPageModel()

       random = new Random();

        questions = new List<Question>()

questions = new List()
new Question() { QuestionText="1=2", Answer=false } ,

        new Question() { QuestionText="2=5", Answer=false },
        new Question() { QuestionText="5=2+3", Answer=true},

        new Question() { 4*4=8", Answer=false },


//True of False Methods ommited//

private void LoadQuestion()
var index = random.Next(questions.Count);
TextoPregunta = questions[index].QuestionText;
CurrentAnswerValue = questions[index].Answer;

Best Answer


  • avillegas16avillegas16 Member ✭✭

    @XamarinProblems Thank you for your response. Will this play One question Or the other though? I don't want to play ALL of the questions at the same time. (just one variant out of the two for each question!)

  • XamarinProblemsXamarinProblems Member ✭✭✭

    @avillegas16 which question you present it up to you, the way you model your data doesn't determine how you use it. You will have to think of your list in 2 dimentions first you pick you question with the first index lets call that index1 and then you select a random variation of your question with a secound index lets call that index2. If you dont want the exact same question to appear you remove the question at QuestionSegments[index1].Questions[index2], if you want to remove the entire question and all its variants you remove the entire list of questions on QuestionSegments[index1]. Hopefully this makes sence (:

Sign In or Register to comment.