Professional Documents
Culture Documents
It is good source of interactivities among students and between the teacher and students. It is
done in order to improve student‘s comprehension levels and learning motivation. As one of
their tools, online test tools are quite effective. However, in order to use the online test tool, a
teacher is generally required a great deal of labor.
For example, a teacher needs to create quizzes and input them in the online test tool.
In order to solve these problems, we have developed a Web-based online test system which can
create quizzes competitively and collaboratively by students for the purpose of reducing the load
required for a teacher and promoting interactions among students and between the teacher and
students.
ABOUT THE PROJECT
The ONLINE QUIZ is a web application for to take online test in an efficient manner and no
time wasting for checking the paper. The main objective of ONLINE QUIZ is to efficiently
evaluate the candidate thoroughly through a fully automated system that not only saves lot of
time but also gives fast results. For students they give papers according to their convenience and
time and there is no need of using extra thing like paper, pen etc. This can be used in educational
institutions as well as in corporate world. Can be used anywhere any time as it is a web based
application(user location doesn’t matter). No restriction that examiner has to be present when the
candidate takes the test.
EXISTING SYSTEM:
The first problem is that there are loads of hard copied documents being generated. This brings
us to the age-old discussion of keeping information in the form databases versus keeping the
same on sheets of paper. Keeping the information in the form of hard-copied documents leads to
the following problems.
PERFORMANCE LEVEL: The scope of this project gives immense opportunity for the
students to know their levels in quiz. It provides effective software so as to help the students as
well as the evaluators who are involved in evaluating the student’s performance.
DATA STRUCTURES: The data in this project are maintained in the tabular form using
MYSQL in the form of database. It provides easy access to the user. Easy category questions are
maintained in the database which provides easy for the user to access and choose the category.
1. It is very much protected in such a way that it gives permission to the students to access only
when the username and password is correct.
2. The results are produced electronically so that nobody is prone to mistakes.
RELIABILITY: We assure that the project is completely authenticated in order to enhance
security and corruptions of database as well as the software. The person is given access only if
he/she has a valid username and password.
QUALITY: The project is developed with the help of visual basic 6.0 software which meets
the requirement of the user, the project is checked whether the phases individually have a served
its purpose.
import java.awt. *;
import javax.swing.*;
class QuestionSeries{
static String info ="Java Online Test Week \n \nINSTRUCTIONS:\nThere are 25 questions in this
test and 25 minutes to complete them all.\nThe finish button is highlighted in blue when you
reach the end of the test. \nClicking the finish button will display the results with the correct
answers marked in light red. \n \nThe timecounter begins when you click on the 'start'
button \n \nBest of luck!\n";
static String []question ={"Question 1:\nWhat is the result of attempting to compile and run the
following program?\n\npublic class JavaAppclass{\npublic static void main(String args){\n
String myString = \"javaprograms\";\n System.out.println(myString);\n }\n}\n",
"Question 2:\nWhat is the result of attempting to compile and run the following program with \
n\n>javac JavaApp.java\n>java JavaApp\n\nclass TryFirst{\n String myString = \"javatest\";\n}\
n\nclass JavaApp{\n\npublic static void main(String[] arg){\n System.out.println(new
TryFirst().myString);\n}\n}\n",
"Question 3: \nWhat is the result of attempting to compile and run the following program
with \n>javac JavaApp.java\n>java JavaApp\n\nclass MyJavaApp{ \n String myString
= \"elephants\"; \npublic static void main(String[] arg){ \n System.out.println(myString); \n }
\n}\n",
"Question 4:\nWhat is the result?\n\nclass JavaApp{ \n public static void main(String[] a){ \n
String textstr = \"hello\";\n for (int i=4; i<5; i++)\n System.out.println(str); \n } \n}\n",
"Question 5:\nWhat is the result here?\n\nclass MyJavaApp{ \n public static void main(String[]
a){ \n int j=0;\n for (int i=0; i<3; i++) j=j+i;\n System.out.println(j); \n } \n}\n",
"Question 6:\nWhat is the result?\n\nclass MyJavaApp{ \n public static void main(String[] a){ \
n int num1;\n int num2 = 7;\n num2= num1 * 2 +3;\n System.out.println(num2); \n } \
n}\n",
"Question 7:\nWhat is the result?\n\nclass MyJavaApp{ \n int num1;\n public static void
main(String[] a){ \n number1=2;\n int number2 = 7;\n number2= number1 * 2 +3;\n
System.out.println(number2); \n } \n}\n",
"Question 8:\nWhat is the result?\n\nclass JavaApp{ \n static int number1 = 4;\n public static
void main(String[] a){ \n number1=2;\n int number2 = 7;\n number2= number1 * 2 +3;\n
System.out.println(number2); \n } \n}\n",
"Question 9:\nWhat is the result?\n\nclass JavaApp{ \n static int number1 = 3;\n public static
void main(String[] arg)\n int number2 = 7;\n number2= number2 + number1 * 2 +3;\n
System.out.println(number2); \n } \n}\n",
"Question 10:\nWhat is the result of compiling and running the following code?\n\nclass
JavaApp{ \n public static void main(String[] a){\n int x = (int) (Math.random());\n
System.out.println(x); \n } \n}\n",
"Question 11:\nWhat is the result?\n\nclass Tryclass{ \n static String text = \"rabbit\";\n public
static void main(String[] a){\n int num = text.length;\n System.out.println(num); \n } \n}\n",
"Question 12:\nWhat would be the result here?\n\nclass Myclass{ \n public static void
main(String[] a){\n char []rabbit={'a','b','c','d'};\n int num = rabbit.length;\n
System.out.println(num); \n } \n}\n",
"Question 13:\nWhat is the result here?\n\nclass JavaApp{ \n public static void main(String[] a)
{\n int number = 10;\n String mystr = Integer.toBinaryString(number);\n
System.out.println(mystr); \n } \n}\n",
"Question 14:\nWhat would be the result if we were to run this program with\n>java
MyJavaApp hello java world ?\n\nclass MyJavaApp{ \npublic static void main(String[] args){\n
System.out.println(args[1]); \n } \n}\n",
"Question 15:\nWhat is the result of this program?\n\nclass MyJavaApp{ \n public static void
main(String[] a){\n double d =1.75;\n int i = d;\n System.out.println(i++); \n } \n}\n",
"Question 16:\nWhat is the result of this program?\n\nclass MyJavaApp{ \n public static void
main(String[] a){\n int 1stNum = 5;\n int 2ndNum = 3;\n double d =1.25
+1stNum/2ndNum;\n System.out.println(d); \n } \n}\n",
"Question 17:\nWhat is the result of this program?\n\nclass MyJavaApp{ \n public static void
main(String[] arg){\n int Num1 = 5;\n int Num2 = 4;\n double d =1.25 +Num1/Num2;\n
System.out.println(d); \n } \n}\n",
"Question 18:\nWhat is the result of this program?\n\nclass TryJavaApp{ \n static float f;\n
public static void main(String[] ar){\n int Number = 5;\n f = 1.25; \n
System.out.println(f*4); \n } \n}\n",
"Question 19:\nWhat is the result of this program?\n\nclass JavaApp{ \n static float f;\n public
static void main(String[] ar){\n int Num = 2;\n f = (float)1.25 * 2; \n System.out.println(f *
Num); \n } \n}\n",
"Question 20:\nWhat is the result of this program?\n\nclass HelloJavaApp{ \n public static void
main(String[] ar){\n byte num = 64;\n num += num;\n System.out.println(num); \n } \n}\
n",
"Question 21:\nWhat is the result of this program?\n\nclass JavaApp{ \n public static void
main(String[] a){\n double d = 1.56789;\n long num = Math.round(d);\n
System.out.println(num); \n } \n}\n",
"Question 22:\nWhat is the result of this program?\n\nclass JavaApp{ \n public static void
main(String[] a){\n double d = 1.56789;\n int num = (int)Math.round(d * d);\n
System.out.println(num); \n } \n}\n",
"Question 24:\nWhat is the result of this program?\n\nclass TryApp{ \npublic static void
main(String[] arg){\n int num = 4;\n num = (num + 4/2) % num+1;\n
System.out.println(num); \n } \n}\n",
"Question 25:\nWhat is the result?\n\nclass MyApp{ \n public static void main(String[] ar){\n
for(int i=0; i<3; i++)\n for(int j=1; j<3; j++)\n System.out.print(j+i+\",\"); \n } \n}\n"
};
static String [][]answers ={{"It will not compile as the main method String is not an array\n","It
will compile but there will be a runtime error if we try to run it with:- \n>java JavaApp\n","The
program is fine, but we will need another program to run it and get the output.\n","It will
compile and run and output \"java\" to the screen\n"},{"It will not compile as you cannot have
2 java source files on the same page\n"," \nIt will output \"javatest","It will not compile as the
String myString is not-static and it is being accessed from a static method\n"," \nIt compiles but
there is no output at runtime\n"},{" \nFine - it will output elephants\n","Runtime error
MyJavaApp is not public\n","Compiler error myString is a non-static variable being accessed in a
static method\n","Compile error in the main() method\n"},{" \nIt will output hello\n","The out
put will be \nhello\nhello\n"," \nNo output the for loop needs a ' ; ' at the end\n"," \
nCompilation error for loops have to start with a zero\n"},{" \n3\n"," \n6\n"," \n4\n"," \n2\n"},
{" \n17\n"," \n5\n"," \n3\n","It won't compile\n"},{" \n14\n"," \n7\n"," \n17\n"," \nError.\n"},
{" \n16\n"," \n14\n"," \n7\n"," \nError\n"},{" \n15\n"," \n23\n"," \n50\n"," \nError\n"},{" \n1\
n"," \nYou cannot predict the random result\n"," \n0\n"," \nError\n"},{" \n6\n"," \n5\n"," \n0\
n"," \nError\n"},{" \n4\n"," \n3\n"," \n0\n"," \nError\n"},{" \n00001010\n"," \n10\n"," \n1010\
n"," \nError\n"},{"hello java world\n"," \nhello\n"," \njava\n"," \nworld\n"},{" \n1.75\n"," \n2\
n"," \n3\n"," \nError\n"},{" \n3.25\n"," \n2.25\n"," \n2.2... and a very long number\n"," \nThe
code will not compile\n"},{" \n2.5\n"," \n2.25\n"," \n2.2 ... -something and a very long number\
n"," \nThe code will not compile\n"},{" \nError float f is not initialised\n"," \noutput: 5\n"," \
noutput: 5.0\n"," \nError, this is not a valid way to initialise a float type variable\n"},{" \n4.0\
n"," \n5\n"," \n5.0\n"," \nError, it will not compile\n"},{" \n128\n"," \n-128\n"," \n1\n"," \
nError, number is out of range\n"},{" \n1\n"," \n2\n"," \n1.0\n"," \nError\n"},{"3. - and to 15
decimal places\n"," \n2\n"," \n3\n"," \nError\n"},{" 2 \n-2\n"," 1\n-2\n"," 2\n-1\n"," 1\n-1\n"},
{" \n1\n"," \n3\n"," \n4\n"," \n6\n"},{"1,2,2,3,3,4\n","1,2,3,3,4,6\n","1,2,3,4\n"," \
n0,1,1,2,2,3,3,4\n"} };
/* OnlineTest class */
try{
TOTAL = QuestionSeries.tally;
/* OnlineTest Constructor */
protected OnlineTest(){
getContentPane().setLayout(new BorderLayout() );
getContentPane().add("North", panelNorth);
getContentPane().add("South", panelSouth);
getContentPane().add("Center", panelCenter);
if(java.awt.Toolkit.getDefaultToolkit().getScreenSize().getWidth()<799){width=
640; height=460; }
setSize(width,height);
setLocation((dim.width-width)/2, (dim.height-height)/2);
/**
** Northwindow class
**/
** Northwindow constructor
**/
public Northwindow(){
setLayout(new GridLayout(2,2));
student.setFont(new Font("",Font.BOLD,16) );
message.setForeground(Color.blue);
add(student);
add(message);
setBorder(BorderFactory.createEtchedBorder() );
/**
** Southwindow class
**/
public Southwindow(){
choice_button[i].addActionListener(new ActionHandler() );
if(i !=0)add(choice_button[i]);
setBorder(BorderFactory.createEtchedBorder() );
/**
** Centerwindow class
**/
public Centerwindow(){
setLayout(new GridLayout(1,2) );
pane.setForeground(Color.red);
pane.setText(QuestionSeries.info);
pane.setEditable(false);
east.setLayout(new BorderLayout() );
JPanel northEast = new JPanel();
east.add("North", northEast);
westEast.setLayout(new GridLayout(6,1) );
east.add("West", westEast);
centerEast.setLayout(new GridLayout(6,1) );
centerEast.setBackground(new Color(255,255,200));
east.add("Center", centerEast);
timecounter.setForeground(new Color(0,90,20) );
northEast.add(timecounter);
String []boxs = {" A ", " B ", " C ", " D "};
boxes[i].addItemListener(new ItemHandler() );
westEast.add(boxes[i]);
westEast.add(new JLabel() );
choose.setBorder(BorderFactory.createEtchedBorder() );
centerEast.add(choose);
answerboxes[i].setBorder(BorderFactory.createEtchedBorder() );
answerboxes[i].setEditable(false);
answerboxes[i].setBackground(Color.white);
answerboxes[i].setFont(new Font("",0,12) );
answerboxes[i].setLineWrap(true);
answerboxes[i].setWrapStyleWord(true);
centerEast.add(panes[i]);
else testresult = new JLabel(" There is no time limit for this test");
testresult.setBorder(BorderFactory.createEtchedBorder() );
centerEast.add(testresult);
add(west);
add(east);
/**
** ActionHandler class to handle all the action events from the buttons.
**/
/* actionPerformed method */
if(source.equals("start:")){
choice_button[1].setVisible(false);
start_test=true;
allowRestart=true;
panelSouth.remove(choice_button[1]); //start
displayquestion();
if(start_test){
if(source.equals("previous:")) {
recordanswer();
quesnum--;
checkteststatus();
displayquestion();
if(source.equals("next:")) {
recordanswer();
quesnum++;
checkteststatus();
displayquestion();
if(source.equals("finish:")) {
if (finishtest){
recordanswer();
quesnum = 0;
choice_button[4].setBackground(Color.lightGray);
timecounter.setForeground(Color.blue);
start_test=false;
check_answer=true;
panelSouth.add(choice_button[0]);
mark_ques();
displayquestion();
checkteststatus();
calculateResult();
if (check_answer){
if(source.equals("check next:")) {
quesnum++;
mark_ques();
displayquestion();
checkteststatus();
if(source.equals("check previous:")) {
quesnum--;
mark_ques();
displayquestion();
checkteststatus();
validate();
/* Timer class */
class Timer extends Thread implements Runnable{
public Timer(){
new Thread(this).start();
while(start_test){
try {
Thread.sleep(1000);
seconds++;
seconds -= 60;
minutes++;
if(minutes==TIMELIMIT){
start_test=false;
endTest();
}
}
/* checkteststatus method */
if((quesnum == TOTAL-
1)&&(start_test))choice_button[3].setBackground(Color.green);
else choice_button[4].setBackground(Color.lightGray);
if(answers[quesnum].length() >0){
boxes[Integer.parseInt(answers[quesnum].substring(i,i+1) )-
1].setSelected (true);
/* displayquestion method */
int j = quesnum+1;
pane.setText(QuestionSeries.question[quesnum]);
if(start_test){
String temp="";
if(QuestionSeries.n[quesnum]==1)
temp="<html> Choose only <b>ONE</b> Option</html>";
else if(QuestionSeries.n[quesnum]==2)
temp="<html> Choose <b>TWO </b> Options</html>";
choose.setText(temp);
else {
answers[quesnum] = tmp;
/* endTest method */
public void endTest(){
choice_button[2].setEnabled(false);
choice_button[3].setEnabled(false);
choice_button[4].setEnabled(true);
answerboxes[Integer.parseInt(QuestionSeries.choice[quesnum].substring(i,i+1))-
1].setBackground(Color.red);
if(QuestionSeries.choice[quesnum].equals(answers[quesnum]))
message.setText("Answer correct, well done!");
mark=0;
double temp=0.0;
temp=(double)mark;
new Resultwindow().show();
/* Resultwindow class */
Resultwindow() {
cont.setLayout(new GridLayout(TOTAL/2+3,5,2,5) );
cont.setBackground(new Color(255,220,255) );
if(QuestionSeries.choice[i].equals(answers[i])) temp[i]="correct";
else temp[i]="wrong";
pack();
setLocation(200,200);
/* ItemHandler class */
if(start_test){
java.awt.Toolkit.getDefaultToolkit().beep();
if(QuestionSeries.n[quesnum]==1)
JOptionPane.showMessageDialog(null,"<html><font size='4'
color='00308a'><center>"+
itemCheck=0;
/* main method */
frame.setTitle(" "+QuestionSeries.testtitle);
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
frame.setVisible(true);
}}