Click here to Skip to main content
12,623,511 members (31,893 online)
Click here to Skip to main content
Add your own
alternative version


81 bookmarked

Integrated Quiz WebApp with Graphical Score Report

, 21 May 2005 Ms-PL
Rate this:
Please Sign up or sign in to vote.
Integrated online quiz app with graphical score report. Users can bookmark questions in order to review in the end.


The quiz application demonstrated here allows users to proceed with multi-choice questions like in an IQ Quiz. The database is a simple XML file. The application is a single web user control. The data holder between the pages is the Session bag (Viewstate[ data ]).There are three panels within our quiz user control. They are Quiz panel, Review panel and Score Report panel. I have used my own progress bar control within the Score Report...


Our database is a simple XML file:

<?xml version="1.0" encoding="utf-8" ?> 
     <question correctAnsNo='1'>Which of the fol....?
     <answer correct='No' ><![CDATA[<span class="code-SummaryComment">  <img src="x...]]></span>
     <answer correct='No' ><![CDATA[<span class="code-SummaryComment">  <img src="x...]]></span>
     <answer correct='Yes'><![CDATA[<span class="code-SummaryComment">  <img src="x...]]></span>
     <answer correct='No' ><![CDATA[<span class="code-SummaryComment">  I Don't Know  ]]></span>

Using the code

Our quiz user control has four methods:

  • ShowQuestion(int _qNo)
  • Review()
  • ReAnswer()
  • ShowResult()

The code

First, there are some common member variables:

//create xmlDocument holder
XmlDocument doc=new XmlDocument();
//create empty navigator in order to navigate
//through our XMLDocument 
XPathNavigator nav;
//to loop through 
XPathNodeIterator nodeItrator;
//hold user Answers
ArrayList historyALst=new ArrayList();
//hold bookmarked Question(s)
ArrayList bookmarkLst=new ArrayList();
//used to replace index 1 by A and 2 by B ....etc
char[] perfix=new char[10] {'A','B','C','D','F','G','H','J','K','L'};
int currentQNo; //current question number
int totalQNumber; // total quiz question number
int totalMarkedQuestion; // total marked questions number
    int currentMarkedQuestion; //current bookmarked question number
    int markLoop; // the res number of reanswered bookmarked questions
DateTime startTime; // quiz start time
TimeSpan spentTime;
bool isReview; // to indicate the status of current qustion
bool wasChecked=false; //signed as marked Q within Review report.

In the page_load(....), do the following:

private void Page_Load(object sender, System.EventArgs e)
    //load our XML DB
    //create navigator for loaded xml File

    //Is New Quiz?.
        quizPanal.Visible=true;// show quiz screen.

        //record start time
        //count and record Total questions Number
        //using our XmlDocumentnavigator by passing
        //XPath sring of question node ( <mc>...</mc>)
            //store our data in Session bag
            //simply,I use the same name for Sessionbag object
            //and member Field..
        //go to first Question

Let's render question number as currentQNo : ShowQuestion(currentQNo);

Render a specific multi-choice question. This method takes question number as parameter, and uses this number within different XPath strings to navigate through our XML nodes:

/// <span class="code-SummaryComment"><summary>

There are some actions that take place when this method renders bookmarked questions:

    //retrieve current status from session bag 
    //Is Review Bookmarked questions Only? 
        //disable bookmark checkbox
        //dispaly an image to notify user 
        RequiredFieldValidator1.Text="Answer The Question !";
}//end method

After that, the user reviews answers history and is allowed to go back or view score reportReview() :

/// <span class="code-SummaryComment"><summary>

If the user decides to go back, then ReAnswer():

/// <span class="code-SummaryComment"><summary>

In the end, call the Score report: ShowResult()

/// <span class="code-SummaryComment"><summary>

Done ..........!


This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


About the Author

Ameen Abudbash
Team Leader
Egypt Egypt
• Over 8 years of experience in software developing, designing and implementing High Available web based applications specialized in Microsoft & IBM technologies.
• Extensive experience in developing, designing and implementing ECM solutions using IBM Filenet,Workplace, IBM BPM, REST services, AND Partial Experience in major CMS (Documentum and Oracle ECM).
• Extensive experience in Designing & Implementing Web2 Enterprise Apps using Leading RIA Frameworks (ExtJs , YUI… ).
• Partial experience in development with Microsoft SharePoint 2007 & 2010.
• Practical experience in Microsoft BI tools SSAS, SSIS, SSRS and Excel Services.
• Deep understanding of the OOP and Strong Design patterns background
• Interactive and fast enough to learn new technologies and sciences.

• Extensive experience in problem-to-resolution troubleshooting skills
• Playing different IT roles including designing, implementing, supporting, consulting and development, Managing teams composed of analyst, developers & QA.
• Agile project management methodologies and managed teams with Scrum.
• Deliver technical workshops, presentations, documents and POCs.

You may also be interested in...


Comments and Discussions

QuestionIn Review How to Display Correct Answer Pin
sabaaqeel7-Apr-14 3:49
membersabaaqeel7-Apr-14 3:49 
QuestionHow to run your application? Pin
megha_gharote17-Jun-09 18:38
membermegha_gharote17-Jun-09 18:38 
AnswerRe: How to run your application? Pin
sandeepknrohan4-Jul-11 19:36
membersandeepknrohan4-Jul-11 19:36 
QuestionHelp needed Pin
P.K.Pattnaik15-May-07 1:25
memberP.K.Pattnaik15-May-07 1:25 
Questionhow to see the codes in action ? Pin
arunbiswas16-Feb-07 22:03
memberarunbiswas16-Feb-07 22:03 
GeneralA Great Start Pin
John Jasper15-Jul-06 7:26
memberJohn Jasper15-Jul-06 7:26 
Just what I was looking for.
For me, it will be a "great start" to improve upon and modify for other quiz projects.
It could use a few tweaks to "Show the incorrect answers" for further study, and allow a "Quit" option.
Thanks -
GeneralThank You! Pin
ohyeahbaby2-Aug-05 8:33
memberohyeahbaby2-Aug-05 8:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161128.1 | Last Updated 21 May 2005
Article Copyright 2005 by Ameen Abudbash
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid