Good day
I'm new to C# programming so I need to ask C# experts here, what techniques should I use for a multiple choice exam application I'm planning to develop. I'd like my quiz app to be like this:
1.) What is the capital city of UK?
a. London
b. Washington D.C.
c. Tokyo
d. Manila
2.) What is the capital city of Russia?
a. Bangkok
b. Beijing
c. Islamabad
d. Moscow
After the user has choose any of the answers there will be a button at the end of the questions that will grade the user according to correct answers.
Reply soon

Guest UserRank #259 · 9.8K pointsPosted Aug 18, 2014, 8:11 PM EDT
var random=new Random();
random.Next();
to generate random numbers & show up random questions rather following same question in series
Please accept answer if you find it helpful!
JOHN JOHNNNYRank #9,451 · 206 pointsPosted Oct 12, 2014, 1:16 PM EDT
Thank you for this reply have been having a hitch connecting the dots together
Can you recomend a tutorial on this for me
Regards
Munesh SharmaRank #174 · 13.9K pointsPosted Oct 12, 2014, 8:23 PM EDT
JOHN JOHNNNYRank #9,451 · 206 pointsPosted Oct 13, 2014, 1:23 AM EDT
JOHN JOHNNNYRank #9,451 · 206 pointsPosted Oct 13, 2014, 8:05 AM EDT
Thank you for your reply i have been studying the code from the link you directed me to, but i still have a little hitch.
How can i translate that kind of code be redered in xaml assuming the xaml.cs is below
int score = 0; int i = -1; int a = 0; string[] questions = new string[] { "What is 9 cubed?", "What is 6+3?", "What type of animal is tuna sandwiches made from?", "What is 18 backwards?" }; string[] answers = new string[] { "9", "81", "729", "2", "4", "2", "9", "1", "zebra", "aardvark", "fish", "gnu", "31", "81", "91", "88" }; string [] quizAnswers=new string[]{"729","9","aardvark","81"}; private void btnStart_Click(object sender, EventArgs e) { if (i questions.Length) i++; //txtScore.Text = score; lblQuestion.Text = questions[i]; radA.Text = answers[a]; a++; radB.Text = answers[a]; a++; radC.Text = answers[a]; a++; radD.Text = answers[a]; a++; btnStart.Visible = false; btnStart.Enabled = false; btnSubmit.Visible = true; btnSubmit.Enabled = true; } private void btnSubmit_Click(object sender, EventArgs e){ if(getSelectedAnswer().Equals(quizAnswers[i])) { MessageBox.Show("Correct"); score++; txtScore.Text = Convert.ToString(score); btnSubmit.Enabled = false; btnSubmit.Visible = false; btnStart.Visible = true; btnStart.Enabled = true; btnStart.Text = "Next"; } else { MessageBox.Show("Incorrect"); score--; txtScore.Text = Convert.ToString(score); btnSubmit.Enabled = false; btnSubmit.Visible = false; btnStart.Visible = true; btnStart.Enabled = true; btnStart.Text = "Next"; } } string getSelectedAnswer() { if (radA.Checked) return radA.Text.ToString(); if (radB.Checked) return radB.Text.ToString(); if (radC.Checked) return radC.Text.ToString(); if (radD.Checked) return radD.Text.ToString(); return ""; } Regards