Sie sind auf Seite 1von 9

DOT NET FRAMEWORK FOR APPLICATION DEVELOPMENT

ASSIGNMENT REPORT
ON
“Quiz Application using C#”
CONTENTS

ABSTRACT 3

INTRODUCTION 4

SOURCE CODE 5

SCREENSHOTS 8

CONCLUSION 9

BIBLIOGRAPHY 9
ABSTRACT

Quiz Application project is a desktop application developed using C# Language.


The Project is based on a concept of taking a quiz on different topics. Talking
about the system, there are different questions on different topics and the user
has to answer those asked question in order to gain score points. Each of the
given questions is multiple choice questions. This means there are total 4
options provided and the user has to select any one of them. After placing an
answer, the system does not display the correct answer at the same time, each
question carries 10 marks. Only at the last, the user can know his/her total
scores. The questions are provided randomly, this means any question can
appear at any time interval for any given subject.
INTRODUCTION

Quiz Application is a C# application that has general questions related to


science, states, capitals, movies etc. It has multiple choice questions with no
time limit and it also calculate scores of each correct answer. It is good for
students of every age group it helps in increasing general knowledge about
world, sports and movies etc. The application helps the user to increase his/her
knowledge.
Before start of the quiz, the rules and regulations are that it includes description
of the genre of questions you want to answer, number of questions to be
answered and scoring methods. Quiz is started by displaying one question with
options each based on science, states, capitals, movies etc. If the answer is
correct, score is incremented by 10 points and no negative marks for wrong
answers. After a few limited question's answer quiz application will finally
direct you to the score page.
The main objective of “Quiz Application” is to facilitate a user friendly
environment for all users and reduces the manual effort. In past days quiz is
conducted manually but in further resolution of the technology we are able to
generate the score and pose the queries automatically. The functional
requirements include the users that are going to participate in the quiz,
automatic score generated, etc.
SOURCE CODE

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Quiz
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.IO;
using System.Xml.XPath;
using System.Xml.Linq;
using System.Collections;

namespace Quiz
{
class Result
{
private string file;
private string result = "";
private string quesid;

public string getResult(string option, int id, string category)


{
try
{
quesid = id.ToString();
file = category + ".xml";
XElement root = XElement.Load(file);
IEnumerable<XElement> address =
from el in root.Elements("question")
where (string)el.Attribute("id") == quesid
select el;
foreach (XElement el in address)
foreach (XElement el1 in el.Elements())
{
if (el1.Name == "correct")
{
if (el1.Value == option)
{
result = "CORRECT";
}
else
{
result = "WRONG";
}
}
}
return result;
}
catch (XmlException)
{
return "XML Exception has occured! Please contact administrator.";

}
catch (FileLoadException)
{
return "Not able to load data from backend! Please contact administrator.";
}
catch (FileNotFoundException)
{
return "Data file not found in backend! Please contact administrator.";
}
catch
{
return "Unknown error! Please contact administrator.";
}

}
}
<movies>
<question id="1">
<ques>What is the biggest planet in our solar system??</ques>
<wrong>Earth</wrong>
<correct>Jupiter</correct>
<wrong>Mars</wrong>
<wrong>Mercury</wrong>
</question>
<question id="2">
<ques>What is the chemical symbol for the element oxygen?</ques>
<wrong>K</wrong>
<wrong>M</wrong>
<correct>O</correct>
<wrong>C</wrong>
</question>
<question id="3">
<ques>Pure water has a pH level of a around?</ques>
<correct>7</correct>
<wrong>6</wrong>
<wrong>8</wrong>
<wrong>5</wrong>
</question>
<question id="4">
<ques>The highest mountain on earth is?</ques>
<wrong>Mount Abu</wrong>
<wrong>Mount Fiji</wrong>
<correct>Mount Everest</correct>
<wrong>Mount Chi Chi</wrong>
</question>
<question id="5">
<ques>Water is made up of what two elements??</ques>
<correct>Oxygen and Hydrogen</correct>
<wrong>Helium and Hydrogen</wrong>
<wrong>Nitrogen and Oxygen</wrong>
<wrong>Lithium and Neon</wrong>
</question>
<question id="6">
<ques>What is the name of the closest star to the earth?</ques>
<wrong>Xenova</wrong>
<wrong>Maltis</wrong>
<wrong>Aurora</wrong>
<correct>Sun</correct>
</question>
<ques>Firefox, Opera, Chrome, Safari and Explorer are types of what?</ques>
<ques>What country experiences the most tornadoes?</ques>
<wrong>UAE</wrong>
<correct>USA</correct>
<wrong>India</wrong>
<wrong>Austria</wrong>
</question>
</movies>
SCREENSHOTS
CONCLUSION

This project has helped us in getting a clearer understanding of real world


application development. It has provided us a deeper insight of using C# in
making applications.
The entire learning outcome of this project has proved to be immensely
beneficial for our future application development.

BIBLIOGRAPHY

https://www.google.com/search?rlz=1C1CHBF
https://en.wikipedia.org/wiki/C_Sharp_(programming_language)
https://www.geeksforgeeks.org/c-sharp-net-framework-basic-architecture-
component-stack/

Das könnte Ihnen auch gefallen