Sei sulla pagina 1di 25

INDEX

Contents

Page

No.
1.
2.
3.
4.
5.
6.
7.

Abstract...2
Introduction.....................3
System Requirements 4
Coding5
Output Screenshots20
Conclusion.24
Bibliography. 25

Computer science investigatory projectPage 1

ABSTRACT
The project entitled Online Examination System is developed
using the programming language C++.
The project aims at simplifying a teachers job of creating and
checking the results of the students. The teacher can manage the examinations
details present for the students. The teacher can set the Questions with five
choices and the questions will be displayed to the students at the time of
examination. The number of correct answers is displayed at the last. It also
helps students to access tests easily and get immediate test reports.

Computer science investigatory projectPage 2

INTRODUCTION

This project entitled Online Examination System is developed


using the programming language C++.
Computers have made students preparation for exams as well as
a teachers job of analyzing the performance of students. This online
examination system provides a common platform for teachers and students.
The program proceeds as follows: An Introduction Screen is shown with the title proceeding which the
program requests for user type : Teacher
Student
If user is a teacher, the following functions are available : Want to add question
Read question
Make new exam
Update existing Teacher ID
Create new Teacher ID
If user is a student, a test page is directly displayed on screen. The user is
expected to answer the given questions. After the completion of the test, a
page displaying the result appears on screen

Computer science investigatory projectPage 3

SYSTEM REQUIREMENTS
Hardware:
1. Processor : IntelCore2 Duo CPU E4500@ 2.20 GHz
2. RAM : 1024 MB
3. Hard Disk : 150GB

Software:
1. Windows XP Operating system
2. Turbo C++

Computer science investigatory projectPage 4

CODING
#include<fstream.h>
#include<dos.h>
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
class EXAM
{
struct QUESTION
{
char que[500];
char fians[100];
char sans[100];
char tans[100];
char foans[100];
char nans[100];
int ans[5],anss;
}question;
struct SECURITY
{
char uname[20];
Computer science investigatory projectPage 5

char pass[20];
}security;
fstream file;
public:
void writequestion();
void readdata();
void takeexam();
void writenewexam();
void makeusername();
void changepassword();
int checkpassword();
int returnminute();
};
void EXAM::makeusername()
{
file.open("examsecurity.txt",ios::binary|ios::in|ios::out);
file.seekp(0L,ios::beg);
cout<<"\n ENTER THE USERNAME :"<<" ";
gets(security.uname);
cout<<"\n ENTER THE PASSWORD :"<<" ";
gets(security.pass);
file.write((char *)&security,sizeof(security));
file.close();
Computer science investigatory projectPage 6

}
void EXAM::changepassword()
{
char ouname[20],opass[20];
file.open("examsecurity.txt",ios::binary|ios::in|ios::out);
file.seekg(0L,ios::beg);
cout<<"\n ENTER THE OLD USERNAME :"<<" ";
gets(ouname);
cout<<"\n ENTER OLD PASSWORD :" <<" ";
gets(opass);
file.read((char *)&security,sizeof(security));
if((strcmp(ouname,security.uname)==0)&&(strcmp(opass,security.pass)==0))
{
file.seekp(0L,ios::beg);
cout<<"\n ENTER NEW USERNAME :"<<" ";
gets(security.uname);
cout<<"\n ENTER THE PASSWORD :"<<" ";
gets(security.pass);
file.write((char *)&security,sizeof(security));
}
else
cout<<"\n USER DOES NOT EXIST ";
file.close();
Computer science investigatory projectPage 7

}
int EXAM::checkpassword()
{
int flag;
char ouname[20],opass[20];
file.open("examsecurity.txt",ios::binary|ios::in|ios::out);
file.seekg(0L,ios::beg);
cout<<"\n ENTER THE USERNAME :"<<" ";
gets(ouname);
cout<<"\n ENTER PASSWORD :" <<" ";
gets(opass);
file.read((char *)&security,sizeof(security));
if((strcmp(ouname,security.uname)==0)&&(strcmp(opass,security.pass)==0))
flag=1;
else
flag=0;
file.close();
if(flag==1)
return 1;
else
return 0;
}

Computer science investigatory projectPage 8

void EXAM::writequestion()
{
file.open("exam.txt",ios::binary|ios::in|ios::out);
file.seekp(0L,ios::end);
cout<<"\n Enter the question:"<<" ";
gets(question.que);
cout<<"\n Enter the first option:"<<" ";
gets(question.fians);
cout<<"\n Is it correct answer? \n if yes press 1 else 2"<<" ";
cin>>question.ans[0];
if(question.ans[0]==1)
question.anss=question.ans[0];
cout<<"\n Enter the second option:"<<" ";
gets(question.sans);
cout<<"\n Is it correct answer? \n if yes press 1 else 2"<<" ";
cin>>question.ans[1];
if(question.ans[1]==1)
question.anss=question.ans[1];
cout<<"\n Enter the third option:"<<" ";
gets(question.tans);
cout<<"\n Is it correct answer? \n if yes press 1 else 2"<<" ";
cin>>question.ans[2];
if(question.ans[2]==1)
Computer science investigatory projectPage 9

question.anss=question.ans[2];
cout<<"\n Enter the fourth option:"<<" ";
gets(question.foans);
cout<<"\n Is it correct answer? \n if yes press 1 else 2"<<" ";
cin>>question.ans[3];
if(question.ans[3]==1)
question.anss=question.ans[3];
cout<<"\n Enter last option:"<<" ";
gets(question.nans);
cout<<"\n Is it correct answer? \n if yes press 1 else 2"<<" ";
cin>>question.ans[4];
if(question.ans[4]==1)
question.anss=question.ans[4];
file.write((char *)&question,sizeof(question));
cout<<"\n Questions Created Successfully... ";
file.close();
clrscr();
}
void EXAM::writenewexam()
{
file.open("exam.txt",ios::binary|ios::in|ios::out);
file.seekp(0L,ios::beg);
cout<<"\n Enter the question:"<<" ";
Computer science investigatory projectPage 10

gets(question.que);
cout<<"\n Enter the first option:"<<" ";
gets(question.fians);
cout<<"\n Is it correct answer? \n if yes press 1 else 2"<<" ";
cin>>question.ans[0];
if(question.ans[0]==1)
question.anss=question.ans[0];
cout<<"\n Enter the second option:"<<" ";
gets(question.sans);
cout<<"\n Is it correct answer? \n if yes press 1 else 2"<<" ";
cin>>question.ans[1];
if(question.ans[1]==1)
question.anss=question.ans[1];
cout<<"\n Enter the third option:"<<" ";
gets(question.tans);
cout<<"\n Is it correct answer? \n if yes press 1 else 2"<<" ";
cin>>question.ans[2];
if(question.ans[2]==1)
question.anss=question.ans[2];
cout<<"\n Enter the fourth option:"<<" ";
gets(question.foans);
cout<<"\n Is it correct answer? \n if yes press 1 else 2"<<" ";
cin>>question.ans[3];
Computer science investigatory projectPage 11

if(question.ans[3]==1)
question.anss=question.ans[3];
cout<<"\n Enter last option:"<<" ";
gets(question.nans);
cout<<"\n Is it correct answer? \n if yes press 1 else 2"<<" ";
cin>>question.ans[4];
if(question.ans[4]==1)
question.anss=question.ans[4];
file.write((char *)&question,sizeof(question));
cout<<"\n New Exam Created Successfully... ";
file.close();
clrscr();
}

void EXAM::readdata()
{
int count;
file.open("exam.txt",ios::binary|ios::in|ios::out);
file.seekg(0L,ios::beg);
while(file.read((char *)&question,sizeof(question)))
{
count=0;
cout<<"\n"<<question.que<<"\n";
Computer science investigatory projectPage 12

cout<<"1)"<<question.fians;
cout<<"\n2)"<<question.sans;
cout<<"\n3)"<<question.tans;
cout<<"\n4)"<<question.foans;
cout<<"\n5)"<<question.nans;
for(int i=0;i<5;i++)
{
++count;
if(question.ans[i]==1)
cout<<"\n Answer is option "<<count;
}
cout<<"\n--------\n";
}
file.close();
}

void EXAM::takeexam()
{
int min;
int ch,p=0,count,c;
min=returnminute();
file.open("exam.txt",ios::binary|ios::in|ios::out);
file.seekg(0L,ios::beg);
Computer science investigatory projectPage 13

while(file.read((char *)&question,sizeof(question)))
{
count=0;
cout<<"\n"<<question.que<<"\n";
cout<<"1)"<<question.fians;
cout<<"\n2)"<<question.sans;
cout<<"\n3)"<<question.tans;
cout<<"\n4)"<<question.foans;
cout<<"\n5)"<<question.nans;
for(int i=0;i<5;i++)
{
++count;
if(question.ans[i]==1)
{
c=count;
}
}
cout<<"\n Enter your answer number:"<<" ";
cin>>ch;
if(ch==c)
{
++p;
}
Computer science investigatory projectPage 14

cout<<"\n--------";
clrscr();
cout<<"

\t\t\t|| ONLINE EXAMINATION SYSTEM ||\n ";

cout<<"\n Next question : ";


cout<<"\n--------";
}
cout<<"\n You have "<< p <<" correct answer(s)\n\n";
file.close();
}

int EXAM::returnminute()
{
struct time t;

gettime(&t);
printf("Time is: %2d:%02d:%02d.%02d\n",
t.ti_hour, t.ti_min, t.ti_sec, t.ti_hund);
return(t.ti_min);
}

void main()
{
int ch,ch1;
Computer science investigatory projectPage 15

EXAM exam;
clrscr();
cout<<"

\n\t\t\t|| ONLINE EXAMINATION SYSTEM || "<<endl;

cout<<" \t\t\t-------------------------------"<<endl;
cout<<" \t\t\t|| WELCOME TO YOUR DASHBOARD || ";
do
{
cout<<"\n 1.Teacher \n 2.Student \n 3.Exit";
cout<<"\n Enter your choice:"<<" ";
cin>>ch;
switch(ch)
{
case 1:
clrscr();
cout<<"

\n\t\t

|| ONLINE EXAMINATION SYSTEM || "<<endl;

cout<<" \t\t\t-------------------------------"<<endl;
if(exam.checkpassword())
clrscr();
cout<<" \n\n\t";
do
{
cout<<"\t\t|| ONLINE EXAMINATION SYSTEM ||"<<endl;
cout<<"\t\t\t-------------------------------"<<endl;
Computer science investigatory projectPage 16

cout<<"\n\t\t\t TEACHER HUB"<<endl;


cout<<"\t\t\t --------------";
cout<<"\n1.Want to add question\n2.Read questions\n3.Create new
exam\n4.Create new Teacher ID\n5.Update existing Teacher ID\n6.Exit";
cout<<"\nEnter your choice:"<<" ";
cin>>ch1;
switch(ch1)
{
case 1:
clrscr();
cout<<"

\t\t|| ONLINE EXAMINATION SYSTEM || "<<endl;

cout<<" \t\t\t-------------------------------"<<endl;
exam.writequestion();
break;
case 2:
clrscr();
cout<<"

\t\t|| ONLINE EXAMINATION SYSTEM ||"<<endl;

cout<<" \t\t\t-------------------------------"<<endl;
exam.readdata();
break;
case 3:
clrscr();
cout<<"

\t\t|| ONLINE EXAMINATION SYSTEM || "<<endl;

Computer science investigatory projectPage 17

cout<<" \t\t\t-------------------------------"<<endl;
exam.writenewexam();
break;
case 4:
clrscr();
cout<<"

\t\t|| ONLINE EXAMINATION SYSTEM || "<<endl;

cout<<" \t\t\t-------------------------------"<<endl;
exam.makeusername();
break;
case 5:
clrscr();
cout<<"

\t\t|| ONLINE EXAMINATION SYSTEM ||"<<endl;

cout<<" \t\t\t-------------------------------"<<endl;
exam.changepassword();
break;
case 6:
clrscr();
cout<<"

\t\t|| ONLINE EXAMINATION SYSTEM || "<<endl;

cout<<" \t\t\t-------------------------------"<<endl;
clrscr();
break;
}
}while(ch1!=6);
Computer science investigatory projectPage 18

break;
case 2:
clrscr();
cout<<"

\t\t|| ONLINE EXAMINATION SYSTEM || "<<endl;

cout<<" \t\t\t-------------------------------"<<endl;
cout<<"\n EXAM STARTS ...\n ALL THE BEST !! "<<" "<<endl;
exam.takeexam();
cout<<" \n END OF EXAM ... "<<endl;
break;
case 3:
break;
}
}while(ch!=3);
}

Computer science investigatory projectPage 19

Output screens
Home Page:

Dash board:

Teacher hub:
Computer science investigatory projectPage 20

Login screen(for teachers):

Exam portal(for students)1:

Computer science investigatory projectPage 21

Exam portal(for students) 2:

Exam portal(for students) 3:

Computer science investigatory projectPage 22

Exam portal(for students) 4:

CONCLUSION

Computer science investigatory projectPage 23

The online examination system has many advantages of which some are :

Eco Friendly
Efficient
Quick results
Reduces manual labour
Security

The Online Examination System has opened a large number of oppurtunities


for students and teachers alike. With the advent of net cafes, students from
rural areas are able to take advantage of this system. It has changed the way
students prepare for competetive exams

Computer science investigatory projectPage 24

BIBLIOGRAPHY

1.Computer Science with C++ by Sumita Arora.


2.

The C++ programming language by Bjarne


Stroustrup

Computer science investigatory projectPage 25

Potrebbero piacerti anche