Upload
astha-patel
View
82
Download
0
Embed Size (px)
Citation preview
Online Examination
Submitted as partial fulfillment of the requirement
For M.Sc. IT Semester III
Prepared for Subject: PROJECT III (P305)
Prepared By
Group No:-39
Name of Project Developer
1. Astha Patel (1416it22025) (237)
2. Hetal Zala (1416it22085) (271)
3. Zarana Patel (1416it22251) (251)
M.Sc. IT Programme
Department of Computer Science
Kadi Sarva Vishwavidyalaya
Gandhinagar
1
PROJECT – IIIP305
Semester - III2015
Group No : 39
M.Sc. IT Programme, Department of Computer ScienceKadi Sarva VishwavidyalayaGandhinagar
Date:
PROJECT WORK CERTIFICATE
This is to certify that the project report submitted by Astha Patel,Hetal Zala,Zarana
Patel having Enrollment no.1416it22025,1416it22085,1416it22251, a student of M.Sc. IT
Semester- III, Department of Computer Science, KSV University, Gandhinagar have/has
completed his/her project titled as Online Examination satisfactorily.
We appreciate the enthusiasm & dedication towards work submitted.
2
Internal Project Guide
Mr. Bhavesh KatariyaM.Sc. IT, GandhinagarKadi Sarva Vishwavidyalaya
Prof. B. R. Pandya
Head of Department, M.Sc. IT, GandhinagarKadi Sarva Vishwavidyalaya
ACKNOWLEDGMENT
I am grateful to my Mr.Bhavesh Katariya for providing me valuable guidance for
project work and other domain related information.
I would like to express my endless thanks to external source of referral, for giving
invaluable advice, direction, support and transferring knowledge throughout the project work.
Also my hearty gratitude to Head of Department, Prof. B. R. Pandya for giving me an
opportunity for learning through the process of project work by which I can improve my
technical skills along with practical exposure and its applicability in the industry.
Name of Student: Enrollment No.:
Astha Patel 1416it22025
Hetal Zala 1416it22085
Zarana Patel 1416it22251
Scope:-
3
Can be used anywhere any time as it is a web based application(user location doesn’t matter).
Online examination is designed for educational institutes(general).
The type of question is only multiple choice.
Requirement
Functional Requirement
User Aspect:
Requesting registration.
Logging into the system.
Selecting Subject
Appearing for the examination.
Show the result at the end of the examination.
Exam Module:-
Examination process
1)Login to the online examination system.
2)Give Exam.
3)Submit.
The form of question in test page:-
Multiple choice questions .
The question are selected at random.
Tools And Technology:-
4
Code Building Language :-
Microsoft Visual Studio 2012
Scripting Language :-
ASP.NET(C#)
CSS(Cascading Style Sheet)
HTML(Hyper Text Markup Language )
JAVA Script
Application Browser :-
Chrome or above
Data Base:-
Microsoft Sqlserver-2008
Scripting Tool :
AJAX
Platform :-
Microsoft Windows 7
5
Hardware Requirement
Server Side :-
60 GB of available hard-disk space 2 GB of RAM 2.5 GHz processor
Clint Side :-
256 MB of RAM Intel Pentium 4 processor HDD 50 GB
Server Side :-
Operating System : Microsoft Windows 7 Front End : MS Visual Studio 2012 Back End : SQL Server 2008 Programming Language : Asp.Net with C# Web browser : Internet Explorer, Chrome
Clint Side :-
web browser : Chrome Chrome or above Internet Explorer 9 or above Microsoft Windows XP/7 OS
Data Dectionary
6
Software Requirement
1. Registration
2. Subject
7
Column Name
Data type Constraint Description
Subject id Int PK Store subject id
Subject name Varchar(15) Not null Store subject name
8
3. Question
Column name
Data type Constraint
Que id Int PK
Que Varchar(max) Not null
Option 1 Varchar(max) Not null
Option 2 Varchar(max) Not null
Option 3 Varchar(max) Not null
Option 4 Varchar(max) Not null
Correct Ans Varchar(2) Not null
4. Exam
9
Column name
Data type Constraint
e_id Int PK
sub_id int FK
title nvarchar(50) Not null
date nvarchar(20) Not null
start_time nvarchar(50) Not null
no_of_que int Not null
duration nvarchar(50) Not null
markque int
5. Result
10
Column name
Data type Constraint
Result_id Int PK
Exm_id int FK
Que_id int FK
Total Int Not null
Obt_marks int Not null
Coding
Bal.cs :-
11
using System;using System.Collections.Generic;using System.Linq;using System.Web;
public class Bal{
public Bal(){
} public int regi_id { get; set; } public String name { get; set; }
public String uname { get; set; } public String pwd { get; set; } public String email { get; set; } public String cno { get; set; } public int login_id { get;
12
set; } public string pic { get; set; } public int que_id { get; set; } public int e_id { get; set; }
public String question { get; set; } public String op1 { get; set; } public String op2 { get; set; } public String op3 { get; set; } public String op4 { get; set; } public String ans { get; set; }
13
public int sub_id { get; set; }
public String title { get; set; } public String date { get; set; } public String start_time { get; set; } public String duration { get; set; } public String score { get; set; } public String sub_name { get; set; } public String no_of_que { get; set; } public String markque { get; set; }
public int result_id {
14
get; set; } public int total { get; set; } public int obt_marks { get; set; }
public string subject { get; set; }
Dal.cs:-
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Data;
15
using System.Data.SqlClient;using System.Configuration;
public class Dal{ SqlConnection con; SqlCommand cmd = new SqlCommand(); SqlDataAdapter da; DataSet ds; SqlDataReader dr; DataTable dt;
public Dal() { con = new SqlConnection(ConfigurationManager.ConnectionStrings["cnstr"].ToString()); }
//registration
public void registerinsert(Bal b) { cmd = new SqlCommand("insert_reg", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@uname", b.uname); cmd.Parameters.AddWithValue("@pwd", b.pwd); cmd.Parameters.AddWithValue("@email", b.email); cmd.Parameters.AddWithValue("@cno", b.cno); cmd.Parameters.AddWithValue("@pic", b.pic);
con.Open(); cmd.ExecuteNonQuery(); con.Close();
}
//Login
public SqlDataReader login(Bal b) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.CommandText = "select * from registration where uname=@uname and pwd=@pwd "; cmd.Parameters.AddWithValue("@uname", b.uname);
16
cmd.Parameters.AddWithValue("@pwd", b.pwd); cmd.Connection = con; dr = cmd.ExecuteReader(); return dr; } // question
public void addque(Bal b) {
cmd = new SqlCommand("insert_que", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@sub_id", b.sub_id); cmd.Parameters.AddWithValue("@que", b.question); cmd.Parameters.AddWithValue("@op1", b.op1); cmd.Parameters.AddWithValue("@op2", b.op2); cmd.Parameters.AddWithValue("@op3", b.op3); cmd.Parameters.AddWithValue("@op4", b.op4); cmd.Parameters.AddWithValue("@ans", b.ans);
con.Open(); cmd.ExecuteNonQuery(); con.Close(); } //subject public void addsub(Bal b) { cmd = new SqlCommand("insert_sub", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@sub_name ", b.sub_name);
con.Open(); cmd.ExecuteNonQuery(); con.Close(); } //exam ss public DataTable getsub() { da = new SqlDataAdapter("select * from subject", con); dt = new DataTable(); da.Fill(dt); return dt;
}
public void addexam(Bal b)
17
{
cmd = new SqlCommand("insert_exam", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@sub_id", b.sub_id); cmd.Parameters.AddWithValue("@title", b.title); cmd.Parameters.AddWithValue("@date", b.date); cmd.Parameters.AddWithValue("@start_time", b.start_time); cmd.Parameters.AddWithValue("@no_of_que", b.no_of_que); cmd.Parameters.AddWithValue("@duration", b.duration); cmd.Parameters.AddWithValue("@markque",b.markque); con.Open(); cmd.ExecuteNonQuery(); con.Close();
} public void addresult(Bal b) { cmd = new SqlCommand("insert_result", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@subject", b.subject); cmd.Parameters.AddWithValue("@reg_id", b.regi_id); cmd.Parameters.AddWithValue("total", b.total); cmd.Parameters.AddWithValue("obt_marks", b.obt_marks); con.Open(); cmd.ExecuteNonQuery(); con.Close(); }
}
Exam.cs:-
using System;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;
18
usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Data;usingSystem.Data.SqlClient;usingSystem.Configuration;
publicpartialclassUser_Exam : System.Web.UI.Page{Bal b1 = newBal();Dal d1 = newDal();SqlConnection con;SqlCommandcmd;SqlDataReaderdr;stringstr = ConfigurationManager.ConnectionStrings["cnstr"].ConnectionString;
protectedvoidPage_Load(object sender, EventArgs e) {
if (!IsPostBack) {Fillsub();showrecord(); } }publicvoidFillsub() { DropDownList1.DataTextField = "sub_name"; DropDownList1.DataValueField = "sub_id"; DropDownList1.DataSource = d1.getsub();DropDownList1.DataBind();DropDownList1.Items.Insert(0, newListItem("- - - select - - -", "0")); }
publicvoidshowrecord() {
con = newSqlConnection(); con.ConnectionString = str;cmd = newSqlCommand();
cmd.CommandText = "SELECT *, ROW_NUMBER() OVER(ORDER BY sub_idasc) as Sequence FROM(select Top 10 * FROM question WHERE (sub_id = " + DropDownList1.SelectedValue + ") ORDER BY NEWID() ) as t";cmd.Connection = con;con.Open();dr = cmd.ExecuteReader();if (dr.HasRows) { GridView1.DataSource = dr;
19
GridView1.DataBind(); }else { GridView1.DataSource = null;GridView1.DataBind();Response.Write("No question"); }con.Close(); }protectedvoidbtnsubmit_Click(object sender, EventArgs e) { GridView1.Visible = false;rs.Visible = true;int que = GridView1.Rows.Count;string sub = DropDownList1.SelectedItem.ToString();RadioButton r1, r2, r3, r4;HiddenFieldhrd;int count = 0;stringselans="-1";for (int i = 0; i < GridView1.Rows.Count; i++) { r1 = (RadioButton)GridView1.Rows[i].Cells[0].FindControl("rad1"); r2 = (RadioButton)GridView1.Rows[i].Cells[0].FindControl("rad2"); r3 = (RadioButton)GridView1.Rows[i].Cells[0].FindControl("rad3"); r4 = (RadioButton)GridView1.Rows[i].Cells[0].FindControl("rad4");hrd = (HiddenField)GridView1.Rows[i].Cells[0].FindControl("hf");
if (r1.Checked) {selans = "A"; }
if (r2.Checked) {selans = "B"; }if (r3.Checked) {selans = "C"; }if (r4.Checked) {selans = "D"; }if (hrd.Value == selans) {count++;
}
20
Label1.Text = "Your score is " +" " + count + " " + "out of" + " "+ que;
} b1.total= que; b1.obt_marks=count; b1.subject= sub; b1.regi_id = 1;d1.addresult(b1);
}protectedvoid Button2_Click(object sender, EventArgs e) {rs.Visible = false; GridView1.Visible = true; Button1.Visible = true;showrecord(); }}
Screen Shots.
Registration
21
Login
22
Add Subject
23
Add Exam
24
25
Add Question
26
Start Exam
Result:
27
28