SRI SRI RAVISHANKAR VIDYA MANDIR
COMPUTER SCIENCE INVESTIGATORY PROJECT
Name : Bharathwaj S
Class : XII
Roll No :
Page 1 of 26
ACKNOWLEDGEMENT
I would like to express my sincere gratitude to the management for providing me the lab facilities which has helped me to gain experience and excel in computers. I would also like to express my heartiest thanks to my respected principal Mrs. Mamatha Raviprakash and my computer teacher Mrs. Sajeetha Kumari N V for providing me an oppurtunity to carry out the project on “ Online Examination System “ which has helped me to aquire a lot of knowledge about the same.
I would also like to thank my parents without whom completing this project wouldn’t be possible. Last but not the least I would like to thank my friends who have helped me a lot in finalizing this project within the limited time frame.
- Bharathwaj S
Page 2 of 26
INDEX
Contents Page No.
1. Abstract……………………………..22. Introduction……………...........33. System Requirements………..44. Coding………………………………..55. Output Screenshots……………206. Conclusion………………………….247. Bibliography……………………….25
Page 3 of 26
ABSTRACT
The project entitled “Online Examination System” is developed using the programming language C++.
The teacher can manage the examinations details present for the students.
The project aims at simplifying a teacher’s job of creating and checking the results of th students. It also helps students access tests easily and get immediate test reports.
INTRODUCTION
Page 4 of 26
This project entitled “Online Examination System” is developed using the programming language C++.
Computers have made student’s preperation for exams as well as a teacher’s 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 diplaying the result appears on screen
Page 5 of 26
SYSTEM REQUIREMENTS
Hardware:
1. Processor : Intel®Core™2 Duo CPU E4500@ 2.20 GHz2. RAM : 1024 MB3. Hard Disk : 150GB
Software:
1. Windows XP Operating system 2. Turbo C++
CODINGPage 6 of 26
#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];
char pass[20];
Page 7 of 26
}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();
}
void EXAM::changepassword()
Page 8 of 26
{
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();
}
int EXAM::checkpassword()
{
Page 9 of 26
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;
}
void EXAM::writequestion()
{
file.open("exam.txt",ios::binary|ios::in|ios::out);
file.seekp(0L,ios::end);
Page 10 of 26
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)
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];
Page 11 of 26
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:"<<" ";
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)
Page 12 of 26
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];
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)
Page 13 of 26
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";
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;
Page 14 of 26
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);
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;
Page 15 of 26
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;
}
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();
}
Page 16 of 26
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;
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)
Page 17 of 26
{
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;
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();
Page 18 of 26
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;
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();
Page 19 of 26
break;
case 6:
clrscr();
cout<<" \t\t|| ONLINE EXAMINATION SYSTEM || "<<endl;
cout<<" \t\t\t-------------------------------"<<endl;
clrscr();
break;
}
}while(ch1!=6);
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);
}
Page 20 of 26
CONCLUSION
The online examination system has many advantages of which some are :
Eco – Friendly Efficient Quick results Reduces manual labour Security
Page 25 of 26
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.
BIBLIOGRAPHY
1.Computer Science with C++ by Sumita Arora
Page 26 of 26