Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7965341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:07:42+00:00 2026-06-04T06:07:42+00:00

I’m creating a web page of interviews, where the user can answer a specific

  • 0

I’m creating a web page of interviews, where the user can answer a specific question mentioned on the screen inside the textbox. I have a check button. On click of this button I need to compare the answer entered in the specific question textbox and usually display accuracy of answer in percentage by comparing with my XML file’s answer for specific question.

This is my XML file”

<?xml version="1.0" encoding="utf-8" ?> 
<Questions> 
  <Question id="1">What is IL code </Question> 
  <Answer id="1">Half compiled, Partially compiled code </Answer> 
  <Question id="2">What is JIT </Question> 
  <Answer id="2">IL code to machine language </Answer> 
 <Question id="3">What is CLR </Question> 
  <Answer id="3">Heart of the engine , GC , compilation , CAS(Code access security) , CV ( Code verification) </Answer> 
</Questions>

This is my form:

enter image description here

Below is my code for my check button, where I have only compared with a single label and textbox. It works.

XmlDocument docQuestionList = new XmlDocument();// Set up the XmlDocument //
docQuestionList.Load(@"C:\Users\Administrator\Desktop\questioon\questioon\QuestionAnswer.xml"); //Load the data from the file into the XmlDocument //
XmlNodeList AnswerList = docQuestionList.SelectNodes("Questions/Question");
foreach (XmlNode Answer in AnswerList)
{
    if (Answer.InnerText.Trim() == Label2.Text)
    {
        string[] arrUserAnswer = TextBox1.Text.Trim().ToLower().Split(' ');
        string[] arrXMLAnswer = Answer.NextSibling.InnerText.Trim().ToLower().Split(' ');
        List<string> lststr1 = new List<string>();
        foreach (string nextStr in arrXMLAnswer)
        {
            if (Array.IndexOf(arrUserAnswer, nextStr) != -1)
            {
                lststr1.Add(nextStr);
            }
        }
        if (lststr1.Count > 0)
        {
            TextBox1.Text = ((100 * lststr1.Count) / arrXMLAnswer.Length).ToString() + "%";
        }
        else
        {
            TextBox1.Text = "0 %";
        }
    }
}

As you can see, I have only compared the value for one question and respective answer, but I would prefer that this is not hard-coded. Instead, it should take the question and the respective textbox answer and compare with my XML file. How might I achieve my goal?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T06:07:44+00:00Added an answer on June 4, 2026 at 6:07 am

    I’d just keep it simple and set up an array of questions, answers, and user’s answers…

    XDocument xdoc = XDocument.Load(@"C:\Users\Administrator\Desktop\questioon\questioon\QuestionAnswer.xml");
    string[] questions = xdoc.Root.Elements("Question").Select(x => (string)x).ToArray();
    string[] answers = xdoc.Root.Elements("Answer").Select(x => (string)x).ToArray();
    string[] userAnswers = new string[] { TextBox1.Text, TextBox2.Text, TextBox3.Text };
    for (int i=0 ; i < questions.Length ; i++)
    {
        // handle responses
        string[] words = answers[i].Split(' ', StringSplitOptions.RemoveEmptyEntries)
            .Select(w => w.ToLower().Trim()).ToArray();
        string[] userWords = userAnswers[i].Split(' ', StringSplitOptions.RemoveEmptyEntries)
            .Select(w => w.ToLower().Trim()).ToArray();
        string[] correctWords = words.Intersect(userWords);
    
        // do percentage calc using correctWords.Length / words.Length
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.