exam simulator in visual basic language

Discussion about hacker.org's server
Post Reply
User avatar
anicoolrocks
Posts: 29
Joined: Tue Jul 01, 2008 5:03 am

exam simulator in visual basic language

Post by anicoolrocks »

:) :P :twisted:


here is the coding for the simulator

for this u must know visual basic and pL/SQL programming



INTRODUCTION


About the Online Exam

1“Exam Simulator” is a unique name given to this project by us. It is not related to any Exams what so ever. This project is in relation to automate the ‘Registration and Drawing result’ Services of the Online Exams. There are few extra services added in this project. They are
1) To check the registration status.
2) To draw On-the-Spot Result
3) To add new subjects whenever required by administrator only
4) To add more questions in any subject by administrator only
It also has an option to create a report which shows all the details according to date or by year.

Certification Exams are becoming popular day by day because of technical advancements and growing industrial acceptance. A certificate for a particular technology is an important tool to get first break in the software market as a fresher.

Our project "EXAM SIMULATOR" is an attempt to provide a virtual environment of actual exam conducted by an Organization


Objectives

1. To study and automate the registration and draw result activities for an exam.

2. To identify the sub activities involved in the above, namely
a. Checking registration status
b. Cancellation of seat
c. Draw On-the-Spot Result
d. Add new subjects whenever required by administrator only
e. Add more questions in any subject by administrator only

3. To create Reports for checking the overall students appeared in a subject till date.


"Our attempt is to provide a simulated environment with the objective of making people familiar with the actual exam environment".

Problem Solving Approach

The following top-level algorithms depict, though trivially, the problem solving approach used to develop the product, Exam Simulator.
Step 1: designing the database.
Step 2: creation of the database in SQL Server 2000
Step 3: creation of forms in VB 6.0
Step 4: linking the forms with the database
Step 6: report generation in VB 6.0
Step 7: debugging and testing the product


Debugging and Testing Methods Employed

The product developed had a prominent part of the debugging and testing phase namely
• debugging and testing forms in VB 6.0


Future Enhancements

In Future, we would like to give complete procedure by which Exam is actually conducted. Our attempt would be to simulate the complete environment starting from registration procedure to result processing and maintenance of student records with the help of Client/Server based Applications.
Apart of this ,we would like to make our project in such a manner so that new subjects can also be added as and when required


PROJECT DETAILS

Project Analysis

1. Need of the Present Product

Examination Registration, Appearing and Drawing result, as it stands, is needed to reduce the ever increasing workload of an educational organization. There is a need of a comprehensive and cost effective automation (software) package to automate the educational work areas.
The development of the present product, Exam Simulator, is a step in this direction and this product has been developed in such fashion as to integrate seamlessly.
With the deserved comprehensive product, this automates work areas of educational organization which includes Registration of the aspiring student for appearing in subject of his interest, Drawing on-the-spot result, On the part of Educational Organization it can add new subjects and can also update themselves in the previous subjects by simply adding up the new questions as the developed product is a part of Expert system.
In order to appreciate the working Of Exam Simulator, we need to understand the actual Online Examination process involved there in.

2. The Online Examination Process

The Online Examination process is divided into three categories:
1) Registration of the student
2) Appearing in the exam
3) Drawing on-the-spot result

3. Product Development Environment

The present software product, Exam Simulator has been developed using following resources:
Hardware
The Pentium III based processors with 128 MB RAM
Software
The concept of a database application on client-server architecture has been implemented using:
a. SQL server 2000 (on windows XP) as the backend database server.
b. Visual Basic 6.0 as the front end tool to access the database.


Project Design

Form Design

This Splash screen is basically used for defining under which company the project has been developed and what are the warnings and the copyrights

This is a main screen which enables the candidate to select the subject in which he wants to appear

Once the candidate is selecting the subject he has to register himself but the registration is only possible when the candidate accept the terms and conditions and he /she is a graduate holder
After filling up the form he press the save button to get registered and now he can appear in the exam

This screen enables the candidate to appear in the exam by selecting the one of the given alternatives after that he can press NEXT button to move on to next question and if at all he wants to end up the exam he should press the End Test button

This form is used to display the statement of marks of the candidate, if he qualifies up this exam then the certificate will be issued to him on the same spot otherwise he can go back on to the main screen by pressing on the Exit>>

is form will be used when an administrator wants to add more questions in the existing subject but it can only be done by the administrator
So, It checks for the Administrator identity

If the user identity is correct then he can enter questions in any of the existing subjects by selecting the subject from the combo box and then press enter

Report Design

These reports are used by the administrator as it gives the reports i.e the passing certificates of the candidates

IMPLEMENTATION

Product Specification

The minimum system requirement for optimally installing and running Air Alpha are as follows:
Processor : Pentium III 500 MHz and above
RAM : 128 MB
OS : Windows XP, NT
RDBMS : SQL Server2000 based on Windows XP
Programming language : MS VB 6.0
Hard disk space : The target system should have at least ---- MB of hard disk space to install the setup
Others : The target system should also have a CD-ROM drive to install and run the setup of Exam Simulator provided on CD.

Bibliography


• Mastering in Visual Basic 6.0
• MSDN Manual
• Developing applications through Visual Basic
• Users Guide to SQL Server


Coding

Splash Screen

Option Explicit

Private Sub Form_KeyPress(KeyAscii As Integer)
Unload Me
Form2.Show
End Sub

Private Sub Form_Load()
' lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision
' lblProductName.Caption = App.Title
End Sub

Private Sub Frame1_Click()
Unload Me
End Sub

Main Screen

Dim S, S1 As String
Dim i As Integer

Private Sub Label10_Click()
Label10.ForeColor = &HFF&
reg
subj = "ada"
End Sub

Public Function reg()
'calling registration form
Form1.Show
End Function

Private Sub Label11_Click()
Label11.ForeColor = &HFF&
reg
subj = "se"
End Sub

Private Sub Label14_Click()
Label14.ForeColor = &HFF&
reg
subj = "wt"
End Sub

Private Sub Label15_Click()
Label15.ForeColor = &HFF&
reg
subj = "cpp"
End Sub

Private Sub Label17_Click()
Label17.ForeColor = &HFF&
reg
subj = "java"
End Sub

Private Sub Label18_Click()
Label18.ForeColor = &HFF&
reg
subj = "mis"
End Sub

Private Sub Label25_Click()
Form5.Show
Label25.ForeColor = &HFF&
End Sub

Private Sub Label26_Click()
Unload Me
End Sub

Private Sub Label4_Click()
Label4.ForeColor = &HFF&
reg
subj = "co"
End Sub

Private Sub Label5_Click()
Label5.ForeColor = &HFF&
reg
subj = "mfcs"
End Sub

Private Sub Label7_Click()
Label7.ForeColor = &HFF&
reg
subj = "networks"
End Sub

Private Sub Label9_Click()
Label9.ForeColor = &HFF&
reg
subj = "c"
End Sub

Private Sub Timer1_Timer()
S1 = Left(S, i)
Form2.Caption = S1
i = i + 1
If i >= Len(S) + 3 Then
i = 1
S1 = ""
End If
End Sub


Private Sub Timer2_Timer()
Label1(1).Left = Label1(1).Left + 100
Label1(0).Left = Label1(0).Left + 100
If Label1(1).Left > Me.ScaleWidth Or Label1(0).Left > Me.ScaleWidth Then
Timer2.Enabled = False
Timer4.Enabled = True
Call Timer4_Timer
End If
End Sub

Private Sub Timer3_Timer()
Label22.Visible = False
End Sub

Private Sub Timer4_Timer()
Label22.Visible = True
If Label1(1).Left > Me.ScaleWidth Or Label1(0).Left > Me.ScaleWidth Then
Label1(1).Left = 0
Label1(0).Left = 0
Timer4.Enabled = False
Timer2.Enabled = True
Call Timer2_Timer
End If
Timer3.Enabled = True
Call Timer3_Timer
End Sub

Private Sub Timer5_Timer()
Label22.Visible = True
End Sub

Registeration Form

Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
'Dim str As String
Dim email As String 'used for email id

Private Sub Form_Load()
'connection
Set con = New ADODB.Connection
With con
.ConnectionString = "Provider=SQLOLEDB;" & _
"Data Source=comp60;" & _
"Initial Catalog = ekta;" & _
"UID=sa;PWD=;"
.Open
End With
Set rs = New ADODB.Recordset
With rs
.Source = "reg"
.ActiveConnection = con
.CursorType = adOpenKeyset
.LockType = adLockPessimistic
.Open
End With
Form2.Hide
DTPicker1.Value = DTPicker1.Value - 25500
End Sub

Private Sub Form_Unload(Cancel As Integer)
con.Close
End Sub

Private Sub Command1_Click(Index As Integer)
If Index = 1 Then
' submit button for registration
If Option1.Value = True Then
If txtname = "" Then
MsgBox "Please enter the specified feild"
txtname.SetFocus
Exit Sub
End If
If Txtfname = "" Then
MsgBox "Please enter the specified feild"
Txtfname.SetFocus
Exit Sub
End If
If txtadd = "" Then
MsgBox "Please enter the specified feild"
txtadd.SetFocus
Exit Sub
End If
If Txtnat = "" Then
MsgBox "Please enter the specified feild"
Txtnat.SetFocus
Exit Sub
End If
If Txtemail = "" Or Text2.Text = "" Or Combo1.Text = "" Then
MsgBox "Please enter the Email Id in given format"
Txtemail.SetFocus
Exit Sub
End If
If combqual = "" Then
MsgBox "Please enter the specified feild"
combqual.SetFocus
Exit Sub
End If
If combsex = "" Then
MsgBox "Please enter the specified feild"
combsex.SetFocus
Exit Sub
End If
If Txtccno = "" Then
MsgBox "Please enter the specified feild"
Txtccno.SetFocus
Exit Sub
End If
If Combank = "" Then
MsgBox "Please enter the specified feild"
Combank.SetFocus
Exit Sub
End If
i = MsgBox("Do you want to enter this record?", vbOKCancel, "Add Record")
If i = vbOK Then
If combqual.Text = "High School" Or combqual.Text = "Intermediate" Then
MsgBox "You are not eligible to appear in this exam"
Else
Txtdob.Text = DTPicker1.Value
Call regid1
email = Txtemail.Text & "@" & Text2.Text & "." & Combo1.Text
rs.AddNew
rs.Fields("name") = txtname.Text
rs.Fields("fname") = Txtfname.Text
rs.Fields("dob") = CDate(Txtdob.Text)
rs.Fields("add") = txtadd.Text
rs.Fields("nat") = Txtnat.Text
rs.Fields("phno") = Txtphno.Text
rs.Fields("mobno") = Txtmob.Text
rs.Fields("email") = email
rs.Fields("qual") = combqual.Text
rs.Fields("sex") = combsex.Text
rs.Fields("ccno") = Txtccno.Text
rs.Fields("bname") = Combank.Text
rs.Fields("regno") = id
rs.Update
Call regid1
MsgBox " Your Regestration Id is " & id
Form7.Show
Unload Me
End If
Else
MsgBox "Regestration Cancelled"
End If
ElseIf Option2.Value = True Then
MsgBox "Regestration Cancelled"
End If
End If
If Index = 2 Then
'clear the controls
For Each ctrl In Controls
If TypeOf ctrl Is TextBox Then
ctrl.Text = ""
End If
Next ctrl
If Combank.Text <> Null Then
Combank.Text = ""
End If
If combqual.Text <> Null Then
combqual.Text = ""
End If
If combsex.Text <> Null Then
combsex.Text = ""
End If
End If
If Index = 0 Then
'Moving back on to the previous screen
Form2.Show
Unload Me
End If
End Sub

Private Sub Txtmob_KeyPress(KeyAscii As Integer)
KeyAscii = cnum(KeyAscii)
End Sub

Private Sub Txtphno_KeyPress(KeyAscii As Integer)
KeyAscii = cnum(KeyAscii)
End Sub

Private Sub Txtname_KeyPress(KeyAscii As Integer)
KeyAscii = cchar(KeyAscii)
End Sub

Private Sub Txtfname_KeyPress(KeyAscii As Integer)
KeyAscii = cchar(KeyAscii)
End Sub

Private Sub Txtnat_KeyPress(KeyAscii As Integer)
KeyAscii = cchar(KeyAscii)
End Sub

Question Paper

Private Sub Command2_Click()
'Label7.Caption = Val(Label7.Caption) + 1
cal
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
rs.MoveNext
If rs.EOF = True Then
MsgBox "Questions finished,press End Test for result"
Command2.Enabled = False
Command2.Visible = False
Else
tno = tno + 1
Label7.Caption = tno
Label1.Caption = rs("ques")
Option1.Caption = rs("opta")
Option2.Caption = rs("optb")
Option3.Caption = rs("optc")
Option4.Caption = rs("optd")
End If
End Sub

Private Sub Command3_Click()
results (total)
Form4.Show
Unload Me
End Sub

Private Sub Form_Load()
'connection
Set con = New ADODB.Connection
With con
.ConnectionString = "Provider=SQLOLEDB;" & _
"Data Source=comp60;" & _
"Initial Catalog = ekta;" & _
"UID=sa;PWD=;"
.Open
End With
Set rs = New ADODB.Recordset
With rs
.Source = "select * from " + subj + ";"
.ActiveConnection = con
.CursorType = adOpenKeyset
.LockType = adLockPessimistic
.Open
End With
tno = 1
rs.MoveFirst
Label7.Caption = 1
Dim str As String
str = Form1.txtname.Text
Label5.Caption = "Welcome " + str
Label5.AutoSize = True
Label3.Caption = subj
'FIRST QUESTION WILL APPEAR ON THE SCREEN
Label1.Caption = rs("ques")
Option1.Caption = rs("opta")
Option2.Caption = rs("optb")
Option3.Caption = rs("optc")
Option4.Caption = rs("optd")
Label9.Caption = id
End Sub

Private Sub Form_Unload(Cancel As Integer)
'rs.Close
con.Close
End Sub

Public Function total()
While Not rs.EOF
no = no + 1
rs.MoveNext
total = no
Wend
End Function

Marksheet Form


Private Sub Form_Load()
Set con = New ADODB.Connection
With con
.ConnectionString = "Provider=SQLOLEDB;" & _
"Data Source=comp60;" & _
"Initial Catalog = ekta;" & _
"UID=sa;PWD=;"
.Open
End With
Set rs = New ADODB.Recordset
With rs
.Source = "marks"
.ActiveConnection = con
.CursorType = adOpenKeyset
.LockType = adLockPessimistic
.Open
End With
rs.MoveLast
Label11.Caption = rs.Fields("noq")
Label4.Caption = rs.Fields("ans")
Label5.Caption = rs.Fields("cans")
Label6.Caption = rs.Fields("mar")
Label7.Caption = rs.Fields("grade")
If rs.Fields("grade") = "F" Then
Label8.Caption = "Not Qualified"
Label8.AutoSize = True
Else
Label8.Caption = "Qualified"
Label8.AutoSize = True
Label10.Visible = True
End If
rs.Close
con.Close
End Sub

Private Sub Form_Unload(Cancel As Integer)
Label10.Visible = False
End Sub


Private Sub Label10_Click()
Hide Me
DataReport1.Show
End Sub

Private Sub Label9_Click()
Form2.Show
Unload Form4
End Sub

Login Form


Private Sub Command1_Click()
'MODULE FOR VERIFICATION OF THE ADMINISTRATOR
If Text1.Text = "admin" Or Text1.Text = "ADMIN" Then
If Text2.Text = "pass" Then
Form3.Show
Form2.Hide
Else
MsgBox "Enter correct password", vbOKOnly, "Administrator Login"
End If
Else
MsgBox "Enter correct Username", vbOKOnly, "Administrator Login"
End If
Unload Me
End Sub

Private Sub Command2_Click()
'MOVE BACK ON TO FIRST SCREEN
Form2.Show
Unload Me
End Sub

Adding Questions Form

Private Sub Command1_Click()
Set con = New ADODB.Connection
With con
.ConnectionString = "Provider=SQLOLEDB;" & _
"Data Source=comp60;" & _
"Initial Catalog = ekta;" & _
"UID=sa;PWD=;"
.Open
End With
subj = Combo1.Text
Set rs = New ADODB.Recordset
With rs
.Source = subj
.ActiveConnection = con
.CursorType = adOpenKeyset
.LockType = adLockPessimistic
.Open
End With
If Text2 = "" Then
MsgBox "Please enter the specified feild"
Text2.SetFocus
Exit Sub
End If
If Text3 = "" Then
MsgBox "Please enter the specified feild"
Text3.SetFocus
Exit Sub
End If
If Text4 = "" Then
MsgBox "Please enter the specified feild"
Text4.SetFocus
Exit Sub
End If
If Text5 = "" Then
MsgBox "Please enter the specified feild"
Text5.SetFocus
Exit Sub
End If
If Text6 = "" Then
MsgBox "Please enter the specified feild"
Text6.SetFocus
Exit Sub
End If
If Text7 = "" Then
MsgBox "Please enter the specified feild"
Text7.SetFocus
Exit Sub
End If
rs.AddNew
rs.Fields("ques") = Text2.Text
rs.Fields("opta") = Text3.Text
rs.Fields("optb") = Text4.Text
rs.Fields("optc") = Text5.Text
rs.Fields("optd") = Text6.Text
rs.Fields("result") = Text7.Text
rs.Update
i = MsgBox("Do you want to enter more questions?", vbOKCancel, "Add Question")
If i = vbOK Then
For Each ctrl In Controls
If TypeOf ctrl Is TextBox Then
ctrl.Text = ""
End If
Next ctrl
ElseIf i = vbCancel Then
con.Close
Form2.Show
End If
End Sub

Private Sub Command2_Click()
Form2.Show
Unload Me
End Sub

Private Sub Command3_Click()
For Each ctrl In Controls
If TypeOf ctrl Is TextBox Then
ctrl.Text = ""
End If
Next ctrl
If Combo1.Text <> Null Then
Combo1.Text = ""
End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
'con.Close
End Sub

Module


Global con As ADODB.Connection
Global rs As ADODB.Recordset
Global subj As String 'Subject name
Global num As Integer 'temporary variable used in generation of id
Global tno As Integer 'total no. of questions
Global no As Integer ' no. of questions
Global a As Integer 'no. of questions attempted
Global c As Integer 'No. of correct answers
Global m As Integer 'marks obtained
Global arg As String 'used for the table name in string generation
Global g As String 'Grading
Global id As String 'Regestration id

Public Function cal()
'No. of questions attempted & how many of them are correct
If Form7.Option1.Value = True Then
a = a + 1
If Form7.Option1.Caption = rs.Fields("result") Then
c = c + 1
End If
End If
If Form7.Option2.Value = True Then
a = a + 1
If Form7.Option2.Caption = rs.Fields("result") Then
c = c + 1
End If
End If
If Form7.Option3.Value = True Then
a = a + 1
If Form7.Option3.Caption = rs.Fields("result") Then
c = c + 1
End If
End If
If Form7.Option4.Value = True Then
a = a + 1
If Form7.Option4.Caption = rs.Fields("result") Then
c = c + 1
End If
End If
End Function

Public Function results(no As Integer)
'Calculation of result
Set con = New ADODB.Connection
With con
.ConnectionString = "Provider=SQLOLEDB;" & _
"Data Source=comp60;" & _
"Initial Catalog = ekta;" & _
"UID=sa;PWD=;"
.Open
End With
Set rs = New ADODB.Recordset
With rs
.Source = "marks"
.ActiveConnection = con
.CursorType = adOpenKeyset
.LockType = adLockPessimistic
.Open
End With
m = c * 5
no = 10
If (c / no) * 100 > 79 Then
g = "A"
ElseIf (c / no) * 100 > 59 Then
g = "B"
ElseIf (c / no) * 100 > 39 Then
g = "C"
Else
g = "F"
End If
rs.MoveLast
rs.AddNew
rs.Fields("noq") = no
rs.Fields("ans") = a
rs.Fields("cans") = c
rs.Fields("mar") = m
rs.Fields("grade") = g
rs.Fields("regno") = id
rs.Update
con.Close
End Function

Function cchar(KeyAscii As Integer)
'Constraint for applying alphabets
If KeyAscii >= 48 And KeyAscii <= 57 Then
KeyAscii = 0
MsgBox " Please enter the Alphabets"
End If
cchar = KeyAscii
End Function

Function cnum(KeyAscii As Integer)
'Constraint for applying digits
If (KeyAscii > 64 And KeyAscii < 90) Or (KeyAscii > 94 And KeyAscii < 124) Then
KeyAscii = 0
MsgBox "Please enter the digits"
End If
cnum = KeyAscii
End Function

Function regid1()
'Generation of registeration ID
Dim num As Integer
Set con = New ADODB.Connection
Dim rds As ADODB.Recordset
Set rds = New ADODB.Recordset
With con
.ConnectionString = "Provider=SQLOLEDB;" & _
"Data Source=comp60;" & _
"Initial Catalog = ekta;" & _
"UID=sa;PWD=;"
.Open
End With
Set rs = New ADODB.Recordset
arg = subj & "reg"
With rs
.Source = " select * from " + arg + " ;"
.ActiveConnection = con
.CursorType = adOpenKeyset
.LockType = adLockPessimistic
.Open
End With
num = rs.Fields("value")
id = subj & " \00" & num
rs.Fields("value") = num + 1
rs.Update
rs.Close
con.Close
End Function



rodrigoBR
Posts: 1
Joined: Mon Sep 15, 2008 11:41 pm

Post by rodrigoBR »

u can make a .exe?
WhiteKnight
Posts: 276
Joined: Fri Aug 15, 2008 8:21 am

Post by WhiteKnight »

rodrigoBR wrote:u can make a .exe?
Do you have windows?

If so then do this way(Long way):

Copy the selection of codes and save it into Code.txt on your desktop.

Open up Command Prompt.

Type in the command without quotes, "cd Desktop"

Now type in the command without quotes, "C:\Windows\Microsoft.NET\Framework\v2.0.50727\vbc.exe Compiled.exe"

Now you'll see a compiled program on your desktop.
User avatar
anicoolrocks
Posts: 29
Joined: Tue Jul 01, 2008 5:03 am

Post by anicoolrocks »

HEY BRO THNX I WILL DEFINATELY TO EXPERIMENT YOUR PROCESS..!!!!!
canine
Posts: 190
Joined: Sun Sep 14, 2008 5:38 am

well...

Post by canine »

That implies you have the .Net framework installed.

I'm not familiar with it personally, as it kinda sucks, but I think the binary it produces isn't native and won't run on someone's computer unless they have the .Net framework as well.

I could be mistaken though.
Post Reply