Online Exam

39
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="DEFAULT.aspx.vb" Inherits="online_exam._DEFAULT" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- transitional.dtd"> <HTML> <HEAD> <TITLE> Online Examination... </TITLE> <!--<META content="text/html; charset=windows-1252" http-equiv=Content-Type>--> <META content="MSHTML 5.00.2614.3500" name=GENERATOR> <META content=FrontPage.Editor.Document name=ProgId> <style> button.a{width:60;height:30;color:aqua;background- color:brown;font-size:15;font-family:arial } </style> <SCRIPT language=Javascript1.2> <!-- var mymessage = "Sorry, but you can't view the source of this page."; function rtclickcheck(keyp){ if (navigator.appName == "Netscape" && keyp.which == 3) { alert(mymessage);

description

Online Exam

Transcript of Online Exam

Online Examination...

button.a{width:60;height:30;color:aqua;background-color:brown;font-size:15;font-family:arial }

function getQueryParams() { var params = new Object(); var query = location.search.substring(1); var pairs = query.split("&"); for (var i = 0; i < pairs.length; i++) { var pos = pairs[i].indexOf('='); if (pos == -1) continue; var argname = pairs[i].substring(0, pos); var value = pairs[i].substring(pos + 1); params[argname] = unescape(value); } return params; }

A.{TEXT-DECORATION: none;color:brown;font-family:Comic Sans MS}A:hover{text-decoration:underline;color:brown;font-family:Comic Sans MS}

.spanstyle {COLOR: green; FONT-FAMILY: Arial, Helvetica, sans-serif; FONT-SIZE: 10pt; FONT-WEIGHT: bold; POSITION: absolute; TOP: -50px; VISIBILITY: visible}

var x, y var step = 20 var flag = 0

// Your snappy message. Important: the space at the end of the sentence!!! var message = "Online Examination " message = message.split("")

var xpos = new Array() for (i = 0; i = 1; i--) { xpos[i] = xpos[i - 1] + step ypos[i] = ypos[i - 1] } xpos[0] = x + step ypos[0] = y

for (i = 0; i < message.length - 1; i++) { var thisspan = eval("document.span" + i) thisspan.left = xpos[i] thisspan.top = ypos[i] } } var timer = setTimeout("makesnake()", 30) }

WelcomeToOnline_Examination

Introduction !OnlineExam is used for distance learning. Administer exams and qualification tests or review quizzes in a secure client server implementation using either an internal server or Internet/Intranet linkage.
AUTOMATE THE TESTING PROCESS
With OnlineExam you can create and administer exams, tests or quizzes in a secure client-server environment. The system is web-enabled so you can use either an internal server or link up over the Internet or an Intranet. No programming is necessary. Just input your questions, select the answer type such as Yes/No, Matching, Multiple Choice, Text Answer, True/False, or Numeric. Those being tested scroll thru the exam questions and respond online from their home computer or workstation. Once the test has been distributed, completed submissions are electronically sent to the OnlineExam data processing engine, which stores, scores and tabulates them. Results are published by the reporting module. Detailed records of all data turned in by each respondent is readily accessible by authorized users from the OnlineExam SQL database. Thats how easy it is!
TYPICAL APPLICATIONS
Remote Examinations
Admissions Testing
Employee Skill Assessment
Virtual Classroom Quizzes
Qualification & Eligibility Determination
Self Learning Programs
Distance Learning Programs
Applicant Experience Level

Public Class About Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub

End Class

Imports System.MathImports System.Data.OleDbImports System.CollectionsImports System.Web.UI.WebControlsImports System.Data.SqlClientImports System.DataImports System.Web.UIImports System.ConfigurationImports System.Drawing.ColorImports System.IOImports System.Web.UI.WebControls.RepeaterImports System.Net.Mail.MailMessage'Imports System.Web.Mail.MailMessageImports System.XmlImports System.Text.RegularExpressionsPublic Class addpaper Inherits System.Web.UI.Page Dim con As SqlConnection Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load con = New SqlConnection(ConfigurationManager.ConnectionStrings("reg").ToString()) ' con.Open() End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click Try ' get qno' Dim cmdstr As String = "select (max(qno)+1) from questions where subcode = '" & DropDownList1.Text & "'" con.Open() Dim cmd As New SqlCommand(cmdstr, con) Dim qno As Integer qno = cmd.ExecuteScalar()

' insert a row into QUESTIONS cmd.CommandText = "insert into questions(subcode,qno,question,ans1,ans2,ans3,cans) values(@subcode,@qno,@question,@ans1,@ans2,@ans3,@cans)"

cmd.Parameters.AddWithValue("@subcode", DropDownList1.Text) cmd.Parameters.AddWithValue("@qno", qno) cmd.Parameters.AddWithValue("@question", TextBox1.Text) cmd.Parameters.AddWithValue("@ans1", TextBox2.Text) cmd.Parameters.AddWithValue("@ans2", TextBox3.Text) cmd.Parameters.AddWithValue("@ans3", TextBox4.Text)

cmd.Parameters.AddWithValue("@cans", TextBox5.Text)

cmd.ExecuteNonQuery() MsgBox("New Question Added Successfully!", , "Feedback") con.Close() ' clearform() Catch ex As Exception MsgBox("Error : " & ex.Message, , "Error") Finally 'nf con.State ConnectionState.Closed Then

'End If End Try End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click Response.Redirect("addpaper.aspx") End SubEnd ClassPublic Class CON1 Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub

End Class

Imports System.MathImports System.Data.OleDbImports System.CollectionsImports System.Web.UI.WebControlsImports System.Data.SqlClient.SqlConnectionImports System.Data.SqlClientImports System.Web.UIImports System.ConfigurationImports System.Drawing.ColorImports System.IOImports System.Web.UI.WebControls.RepeaterImports System.Net.Mail.MailMessage'Imports System.Web.Mail.MailMessageImports System.XmlImports System.Text.RegularExpressionsPublic Class examfor Inherits System.Web.UI.Page Dim con As SqlConnection Dim ds As New DataSet() Public cont1 As Integer Public Const NOQ = 5 Dim qno() As Integer Dim pos As Integer ' Dim dt As New DataTable() Dim ans As String Dim count Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load con = New SqlConnection(ConfigurationManager.ConnectionStrings("reg").ToString()) Dim qno() As Integer ReDim qno(NOQ) Dim c = "c"

If (Page.IsPostBack = False) Then ' get questions of subject into datasaet ' Try

Dim dt As DataTable = GetData() If dt.Rows.Count > 0 Then TextBox5.Text = dt.Rows(0)("qno") 'row = ds.Tables(0).Rows(qno(pos)) TextBox1.Text = dt.Rows(0)("question") TextBox2.Text = dt.Rows(0)("ans1") TextBox3.Text = dt.Rows(0)("ans2") TextBox4.Text = dt.Rows(0)("ans3") Session("dt") = dt End If 'Dim da As New OleDbDataAdapter("select question, ans1, ans2, ans3,cans, '' ans from questions where subcode = '" & c & "'", con) 'da.Fill(ds, "questions") 'con.Open() 'Dim cmd4 As SqlCommand 'Dim dtr4 As SqlDataReader 'Dim query1 As String = "select count(qno) from questions" 'cmd4 = New SqlCommand(query1, con) 'dtr4 = cmd4.ExecuteReader() 'dtr4.Read() '' Dim con1 As Integer 'cont1 = (CInt(dtr4.GetValue(0)) - 1) 'dtr4.Close() 'Dim dtr As SqlDataReader 'Dim cmd3 As SqlCommand 'Dim dtbl As Data.DataTable 'cmd3 = New SqlCommand("select qno,question, ans1, ans2, ans3 from questions where subcode = '" & c & "'", con) 'Dim k = 0 'dtr = cmd3.ExecuteReader() 'dtr.Read() 'TextBox5.Text = dtr(0) 'TextBox1.Text = dtr(1) 'TextBox2.Text = dtr(2) 'TextBox3.Text = dtr(3) 'TextBox4.Text = dtr(4) 'Dim dad2 As New SqlDataAdapter 'dad2 = New SqlDataAdapter(cmd3) 'dtbl = New Data.DataTable() 'dtr.Close() 'dad2.Fill(ds) 'con.Close() ' Catch ex As Exception 'MsgBox("Error : " & ex.Message) 'Me.Dispose() 'End Try End If ' get random numbers 'Randomize() 'Dim totrows As DataRow

'totrows = ds.Tables(0).Rows(0) 'Dim i, r, j As Integer 'Dim present As Boolean 'i = 0 'Do While i < 5 ' r = CInt((totrows - 1) * Rnd()) ' present = False ' For j = 0 To i ' If r = qno(j) Then ' present = True ' Exit For ' End If ' Next

' If Not present Then ' qno(i) = r ' i = i + 1 ' End If 'Loop ' while pos = 0 'Dim row As DataRow ' row = ds.Tables(0).Rows(qno(pos)) ' TextBox5.Text = Str(pos + 1) & "/" & NOQ 'DisplayQuestion() End Sub Private Function GetData() As DataTable con.Open() Dim dt As New DataTable() Dim c = "c" Dim cmd As New SqlCommand("select qno,question, ans1, ans2, ans3,cans from questions where subcode = '" & c & "'", con) Dim adapter As New SqlDataAdapter() adapter.SelectCommand = cmd adapter.Fill(dt) ' adapter.Fill(ds) ' Dim ss = dt.Rows(1)("ans1") Return dt

' Dim row As DataRow

'TextBox5.Text = dt.Rows(0)("qno") 'TextBox1.Text = dt.Rows(0)("question") 'TextBox2.Text = dt.Rows(0)("ans1") 'TextBox3.Text = dt.Rows(0)("ans2") 'TextBox4.Text = dt.Rows(0)("ans3") ' lblSubCode.Text = "Subject : " & subcode ' row = ds.Tables(0).Rows(qno(pos))

' 'If row.Item("qtype") = "m" Then ' ' gbMultiple.Visible = True ' ' gbSingle.Visible = False ' ' Chk1.Checked = False ' ' Chk2.Checked = False ' ' Chk3.Checked = False ' 'Else ' ' gbMultiple.Visible = False ' ' gbSingle.Visible = True ' ' rbAns1.Checked = False ' ' rbAns2.Checked = False ' ' rbAns3.Checked = False ' 'End If

End Function

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click If TextBox5.Text < 1 Then Exit Sub End If count = Int32.Parse((TextBox5.Text) - 1) If Session("dt") IsNot Nothing Then Dim dt As DataTable = DirectCast(Session("dt"), DataTable) Dim cc = dt.Rows.Count

If count < dt.Rows.Count Then TextBox5.Text = dt.Rows(count)("qno") 'row = ds.Tables(0).Rows(qno(pos)) TextBox1.Text = dt.Rows(count)("question") TextBox2.Text = dt.Rows(count)("ans1") TextBox3.Text = dt.Rows(count)("ans2") TextBox4.Text = dt.Rows(count)("ans3") End If If count = 1 Then TextBox5.Text = dt.Rows(0)("qno") 'row = ds.Tables(0).Rows(qno(pos)) TextBox1.Text = dt.Rows(0)("question") TextBox2.Text = dt.Rows(0)("ans1") TextBox3.Text = dt.Rows(0)("ans2") TextBox4.Text = dt.Rows(0)("ans3") End If Dim HH = dt.Rows(count)("cans") answer() ' con.Open() Dim marks As Integer If ans = Trim(HH) Then marks += 1 End If Dim c = "c1" con.Open() 'Dim dtt As New DataTable 'Dim cmda As New SqlCommand("select subcode,cans from exams where subcode = '" & c & "' and de= '" & TextBox5.Text & "'", con) 'Dim adapter As New SqlDataAdapter() 'adapter.SelectCommand = cmda 'adapter.Fill(dtt) 'Dim qn As Integer 'Dim qn1 = dtt.Rows(4)("cans") 'Dim q2 = dtt.Rows(4)("subcode")

'If Not IsDBNull(qn = dtt.Rows(count)("cans")) Then

'End If

Dim cmd1 As New SqlCommand("insert into exams(subcode,cans,uname,marks,de) values('" & c & "','" & ans & "','" & "uname" & "', '" & marks & "','" & TextBox5.Text & "')", con) cmd1.ExecuteNonQuery() con.Close() End If End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click 'If pos < NOQ - 1 Then ' pos = pos + 1 ' DisplayQuestion() 'Else ' Beep() 'End If answer() count = Int32.Parse((TextBox5.Text) + 1) If Session("dt") IsNot Nothing Then Dim dt As DataTable = DirectCast(Session("dt"), DataTable) Dim cc = dt.Rows.Count

If count < dt.Rows.Count Then TextBox5.Text = dt.Rows(count)("qno") 'row = ds.Tables(0).Rows(qno(pos)) TextBox1.Text = dt.Rows(count)("question") TextBox2.Text = dt.Rows(count)("ans1") TextBox3.Text = dt.Rows(count)("ans2") TextBox4.Text = dt.Rows(count)("ans3") Dim HH = dt.Rows(count)("cans") answer() ' con.Open() Dim marks As Integer If ans = Trim(HH) Then marks += 1 End If Dim c = "c1" con.Open() Dim cmd1 As New SqlCommand("insert into exams(subcode,cans,uname,marks,de) values('" & c & "','" & ans & "','" & "uname" & "', '" & marks & "', '" & TextBox5.Text & "')", con) cmd1.ExecuteNonQuery() con.Close() End If End If End Sub

Public Sub answer() ans = "" ' If ds.Tables(0).Rows(qno(pos)).Item("qtype") = "m" Then If Chk1.Checked Then ans = "1" End If

If Chk2.Checked Then If ans "" Then ans &= "," ans &= "2" End If

If Chk3.Checked Then If ans "" Then ans &= "," ans &= "3" End If

' End If ' GetData() 'ds.Tables(0).Rows(count).Item("cans") = ans End Sub

Protected Sub Button3_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button3.Click Dim i, marks As Integer Dim dr As DataRow Dim gg = ds.Tables(0).Rows.Count marks = 0 For i = 0 To gg - 1 dr = ds.Tables(0).Rows(i) If Not IsDBNull(dr.Item("ans")) AndAlso dr.Item("cans") = dr.Item("ans") Then marks += 1 End If Next

'Try ' con.Open() ' Dim cmd As New OleDbCommand("insert into exams values(examid.nextval,'" & subcode & "','" & uname & "', " & marks & ",sysdate)", con) ' MsgBox(cmd.CommandText) ' cmd.ExecuteNonQuery() ' Dim msg As String ' msg = "User Name : " & uname & ControlChars.CrLf & _ ' "Subject : " & subcode & ControlChars.CrLf & _ ' "Total Questions : " & NOQ & ControlChars.CrLf & _ ' "Marks : " & marks ' MsgBox(msg, , "Result") 'Catch ex As Exception ' MsgBox(ex.Message) 'Finally ' If con.State ConnectionState.Closed Then ' con.Close() ' End If 'End Try End Sub

Protected Sub Chk2_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles Chk2.CheckedChanged Chk1.Checked = False Chk3.Checked = False End Sub

Private Sub Chk3_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Chk3.CheckedChanged Chk1.Checked = False Chk2.Checked = False End Sub

Private Sub Chk1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Chk1.CheckedChanged Chk2.Checked = False Chk3.Checked = False End SubEnd Class

Public Class ForgetPassword Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub

End Class

Public Class login1 Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click

End SubEnd Class

Imports System.MathImports System.Data.OleDbImports System.CollectionsImports System.Web.UI.WebControlsImports System.Data.SqlClientImports System.DataImports System.Web.UIImports System.ConfigurationImports System.Drawing.ColorImports System.IOImports System.Web.UI.WebControls.RepeaterImports System.Net.Mail.MailMessage'Imports System.Web.Mail.MailMessageImports System.XmlImports System.Text.RegularExpressionsPublic Class contact_us Inherits System.Web.UI.Page Dim con As SqlConnection

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load con = New SqlConnection(ConfigurationManager.ConnectionStrings("reg").ToString()) ' con.Open() End Sub

Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles TextBox1.TextChanged

End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click 'Try ' get qno' ' Dim cmdstr As String = "select (max(qno)+1) from questions where subcode = '" & DropDownList1.Text & "'" con.Open() ' Dim cmd As New SqlCommand 'Dim qno As Integer ' qno = cmd.ExecuteScalar()

' insert a row into QUESTIONS Dim cmdstr As String = "insert into reg(name,fname,userid,password,email,cno) values(@name,@fname,@userid,@password,@email,@cno)" Dim cmd As New SqlCommand(cmdstr, con) cmd.Parameters.AddWithValue("@name", TextBox1.Text) cmd.Parameters.AddWithValue("@fname", TextBox5.Text) cmd.Parameters.AddWithValue("@userid", TextBox2.Text) cmd.Parameters.AddWithValue("@password", TextBox3.Text) cmd.Parameters.AddWithValue("@email", TextBox6.Text) cmd.Parameters.AddWithValue("@cno", TextBox4.Text)

cmd.ExecuteNonQuery() MsgBox("New User Added Successfully!", , "Feedback") con.Close() Response.Redirect("register1.aspx") ' clearform() 'Catch ex As Exception ' MsgBox("Error : " & ex.Message, , "Error") 'Finally ' 'nf con.State ConnectionState.Closed Then

' 'End If 'End Try End SubEnd Class

Public Class Register1 Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub

End Class