際際滷

際際滷Share a Scribd company logo
A
REPORT
on
ONLINE TEST APPLICATION
Submitted by
Umang Talpara
BACHELOR OF ENGINEERING
IN
COMPUTER SCIENCE & ENGINEERING
:::ABSTRACT:::
This projectis based on the online test examination model,
such as RTO exam,Quize, Entrance Exam.In this there is an
series of question thatyou have to answer,on clicking the next
button will take you to the nextquestion.At last the resultwill be
displayedby clicking on the resultbutton, and the resultwill be
displayedby the message box.
:::CODE:::
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import
javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import
javax.swing.JOptionPane;
import
javax.swing.JRadioButton;
import javax.swing.*;
class OnlineTestextends JFrame implements ActionListener{
JLabellabel;
JRadioButtonradioButton[] = new JRadioButton[5];
JButton btnNext, btnBookmark,extra,bk[] = new JButton[9];
ButtonGroup bg;
int count = 0, current = 0, x = 1, y = 1, now =
0,z=0; int m[] = new int[10];
OnlineTest(String
s) { super(s);
label = new
JLabel(); add(label);
bg = new ButtonGroup();
for (int i = 0; i < 5; i++) {
radioButton[i] = new
JRadioButton();
add(radioButton[i]);
bg.add(radioButton[i]);
}
btnNext = new JButton("Next");
btnBookmark = new
JButton("Bookmark");extra =new
JButton();
extra.setBounds(500,40,100,20);
extra.setVisible(false);
add(extra);
btnNext.addActionListener(this);
btnBookmark.addActionListener(this);
add(btnNext);
add(btnBookmark);
set();
label.setBounds(30,40,450, 20);
radioButton[0].setBounds(50,80,200, 20);
radioButton[1].setBounds(50,110,200,20);
radioButton[2].setBounds(50,140,200, 20);
radioButton[3].setBounds(50,170,200,20);
btnNext.setBounds(100,240,100, 30);
btnBookmark.setBounds(270,240,100,30);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(null);
setLocation(250,100);
setVisible(true);
setSize(1000,1000);
}
public void actionPerformed(ActionEvent
e) { if (e.getSource()== btnNext) {
if (check())
count = count +
1;current++;
set();
if (current == 9) {
btnNext.setEnabled(false);
btnBookmark.setText("Result");
}
}
if (e.getActionCommand().equals("Bookmark")){
bk[z] = new JButton("Bookmark" + x);
bk[z].setBounds(500,20 + 40 * x, 100,30);
extra.setText("jay");
//extra.setVisible(true);
//getContentPane().add(bk);
bk[z].addActionListener(this);
getContentPane().add(bk[z]);
z++;
m[x] =
current; x++;
current++;
set();
if (current == 9)
btnBookmark.setText("Result")
; repaint();
}
for (int i = 0, y = 1; i < x; i++, y++) {
if (e.getActionCommand().equals("Bookmark" +
y)) { if (check())
count = count + 1;
now =
current;
current =
m[y]; set();
((JButton)
e.getSource()).setEnabled(false);
current = now;
}
}
if
(e.getActionCommand().equals("R
esult")){ if (check())
count = count +
1;current++;
JOptionPane.showMessageDialog(this, "correct
answers= " + count);
System.exit(0);
}
}
void set() {
radioButton[4].setSelected(true)
; if (current == 0) {
label.setText("Que1:Where is Bose Institute ?");
radioButton[0].setText("gujrat");
radioButton[1].setText("Kolkata");
radioButton[2].setText("NewDelhi");
radioButton[3].setText("Dispur");
}
if (current == 1) {
label.setText("Que2:World Tourism Day is
celebrated
on-");
radioButton[0].setText(" September 27");
radioButton[1].setText("September 12");
radioButton[2].setText("September
25");
radioButton[3].setText("September
29t");
}
if (current == 2) {
label.setText("Que3:When is the International Yoga
Day
celebrated ?");
radioButton[0].setText("June 20");
radioButton[1].setText("June 21");
radioButton[2].setText(" April 22");
radioButton[3].setText("May 31");
}
if (current == 3) {
label.setText("Que4:'Line of Blood' is a book written
by
whom?");
radioButton[1].setText("BairajKhanna");
radioButton[0].setText("Ursula Vernon");
radioButton[2].setText("AmalEI-Mohtar");
radioButton[3].setText("DikshaBasu");
}
if (current == 4) {
label.setText("Que5: .........is the first woman to head
a
public sectorbank?");
radioButton[0].setText(" Usha
Ananthasubramanyan");
radioButton[1].setText("BairajKhanna");
radioButton[2].setText("Shikha Sharma");
radioButton[3].setText("Arundhati Bhattacharya");
}
if (current == 5) {
label.setText("Que6:Indian Army celebrated the
Poonch Link-up Day on which date?");
radioButton[0].setText("November21");
radioButton[1].setText("November25");
radioButton[2].setText("November24");
radioButton[3].setText("November 23");
}
if (current == 6) {
label.setText("Que7:The first Indian State to go
wholley
organic is -?");
radioButton[0].setText(" Sikkim");
radioButton[1].setText("Meghalaya");
radioButton[2].setText("Manipur");
radioButton[3].setText("Kerala");
}
if (current == 7) {
label.setText("Que8:What is the name of Indira
Gandhi's Samadhi?");
radioButton[0].setText("Shakti Sthal");
radioButton[1].setText(" Shanti Van");
radioButton[2].setText(" Shanti Sthal");
radioButton[3].setText(" Shanti Sthal");
}
if (current == 8) {
label.setText("Que9:Dallol GeothermalField belongs
to
which country?");
radioButton[0].setText("Ethiopia");
radioButton[1].setText(" Sudan");
radioButton[2].setText("Norway");
radioButton[3].setText("Russia");
}
if (current == 9) {
label.setText("Que10:In which state living root
bridges
are found?");
radioButton[0].setText("Meghalaya");
radioButton[1].setText("Assam");
radioButton[2].setText("Manipur");
radioButton[3].setText(" Odisha");
}
}
boolean check() {
if (current == 0)
return
(radioButton[1].isSelected());if (current
== 1)
return
(radioButton[0].isSelected());if (current
== 2)
return
(radioButton[1].isSelected());if (current
== 3)
return
(radioButton[1].isSelected());if (current
== 4)
return
(radioButton[3].isSelected());if (current
== 5)
return
(radioButton[0].isSelected());if (current
== 6)
return (radioButton[1].isSelected());
if (current == 7)
return
(radioButton[2].isSelected());if (current
== 8)
return
(radioButton[0].isSelected());if (current
== 9)
return (radioButton[0].isSelected());
return false;
}
public static void main(String s[]) {
new OnlineTest("Online TestApp");
}
}
:::OUTPUT:::
Online Test App
Oue3: When is the International Yoga Day celebrated ?
June 20
June 21
≒ Apnl22
May 31
Next BooKnJark
 O X
Online test App
Oue4: 'Line of Blood' is a book written by whom?
Ursula Vernon
. Bairaj Khanna
Annal E I-Mohtar
9 Diksha Bas u
Next Bookmark
 O X
Online Test App
Oue5: .........is thefirst wom antohead a public sector bank?
'4? U sha A nanthasu bra manyan
f /J Bairaj K hanna
fiJ Shikha Sharma
f? Amndhati Bhattachary a
Next Bookmark
 O X
Online Test App
Que6: Indian Army celebrated the Poonch Link-up Day on which date?
! November 21
'! November 25
November 24
NovemDera3
Ne*+ Bookmark
 O X
: Online Test App
Oue8: Mat is thename ofIndira Gandhi's Samadhi?
q Shanti Sthal
Next Bookmark
Bookmark
Manipur
Oue7: The first Indian Statetogowholley organieis -?
OnlineTestApp
Result
Oue10: Inwhich statelivingroot bridges arefound?
Meghalay a
'≒ Assam
Manipur
Ddisha
BookmarkNect
Oue9: Dallol Geothermal Fieldbelongstowhichcountry?
Ethiopia
. Sudan
Russia
Oue10: In which state living root bridges are found?
Me ghalay d
Manipur
Odisha
Result
@UMANG TALPARA (BE/BTECH)
Mesh age
".. I .." correci answers - 2
OF

More Related Content

Online test (java)

  • 1. A REPORT on ONLINE TEST APPLICATION Submitted by Umang Talpara BACHELOR OF ENGINEERING IN COMPUTER SCIENCE & ENGINEERING
  • 2. :::ABSTRACT::: This projectis based on the online test examination model, such as RTO exam,Quize, Entrance Exam.In this there is an series of question thatyou have to answer,on clicking the next button will take you to the nextquestion.At last the resultwill be displayedby clicking on the resultbutton, and the resultwill be displayedby the message box.
  • 3. :::CODE::: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JRadioButton; import javax.swing.*; class OnlineTestextends JFrame implements ActionListener{ JLabellabel; JRadioButtonradioButton[] = new JRadioButton[5]; JButton btnNext, btnBookmark,extra,bk[] = new JButton[9]; ButtonGroup bg; int count = 0, current = 0, x = 1, y = 1, now = 0,z=0; int m[] = new int[10];
  • 4. OnlineTest(String s) { super(s); label = new JLabel(); add(label); bg = new ButtonGroup(); for (int i = 0; i < 5; i++) { radioButton[i] = new JRadioButton(); add(radioButton[i]); bg.add(radioButton[i]); } btnNext = new JButton("Next"); btnBookmark = new JButton("Bookmark");extra =new JButton(); extra.setBounds(500,40,100,20); extra.setVisible(false); add(extra); btnNext.addActionListener(this); btnBookmark.addActionListener(this); add(btnNext); add(btnBookmark); set(); label.setBounds(30,40,450, 20);
  • 5. radioButton[0].setBounds(50,80,200, 20); radioButton[1].setBounds(50,110,200,20); radioButton[2].setBounds(50,140,200, 20); radioButton[3].setBounds(50,170,200,20); btnNext.setBounds(100,240,100, 30); btnBookmark.setBounds(270,240,100,30); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(null); setLocation(250,100); setVisible(true); setSize(1000,1000); } public void actionPerformed(ActionEvent e) { if (e.getSource()== btnNext) { if (check()) count = count + 1;current++; set(); if (current == 9) { btnNext.setEnabled(false); btnBookmark.setText("Result"); }
  • 6. } if (e.getActionCommand().equals("Bookmark")){ bk[z] = new JButton("Bookmark" + x); bk[z].setBounds(500,20 + 40 * x, 100,30); extra.setText("jay"); //extra.setVisible(true); //getContentPane().add(bk); bk[z].addActionListener(this); getContentPane().add(bk[z]); z++; m[x] = current; x++; current++; set(); if (current == 9) btnBookmark.setText("Result") ; repaint(); } for (int i = 0, y = 1; i < x; i++, y++) { if (e.getActionCommand().equals("Bookmark" + y)) { if (check()) count = count + 1;
  • 7. now = current; current = m[y]; set(); ((JButton) e.getSource()).setEnabled(false); current = now; } } if (e.getActionCommand().equals("R esult")){ if (check()) count = count + 1;current++; JOptionPane.showMessageDialog(this, "correct answers= " + count); System.exit(0); } } void set() { radioButton[4].setSelected(true) ; if (current == 0) { label.setText("Que1:Where is Bose Institute ?"); radioButton[0].setText("gujrat"); radioButton[1].setText("Kolkata");
  • 8. radioButton[2].setText("NewDelhi"); radioButton[3].setText("Dispur"); } if (current == 1) { label.setText("Que2:World Tourism Day is celebrated on-"); radioButton[0].setText(" September 27"); radioButton[1].setText("September 12"); radioButton[2].setText("September 25"); radioButton[3].setText("September 29t"); } if (current == 2) { label.setText("Que3:When is the International Yoga Day celebrated ?"); radioButton[0].setText("June 20"); radioButton[1].setText("June 21"); radioButton[2].setText(" April 22"); radioButton[3].setText("May 31"); } if (current == 3) { label.setText("Que4:'Line of Blood' is a book written by whom?"); radioButton[1].setText("BairajKhanna"); radioButton[0].setText("Ursula Vernon");
  • 9. radioButton[2].setText("AmalEI-Mohtar"); radioButton[3].setText("DikshaBasu"); } if (current == 4) { label.setText("Que5: .........is the first woman to head a public sectorbank?"); radioButton[0].setText(" Usha Ananthasubramanyan"); radioButton[1].setText("BairajKhanna"); radioButton[2].setText("Shikha Sharma"); radioButton[3].setText("Arundhati Bhattacharya"); } if (current == 5) { label.setText("Que6:Indian Army celebrated the Poonch Link-up Day on which date?"); radioButton[0].setText("November21"); radioButton[1].setText("November25"); radioButton[2].setText("November24"); radioButton[3].setText("November 23"); } if (current == 6) { label.setText("Que7:The first Indian State to go wholley organic is -?"); radioButton[0].setText(" Sikkim"); radioButton[1].setText("Meghalaya");
  • 10. radioButton[2].setText("Manipur"); radioButton[3].setText("Kerala"); } if (current == 7) { label.setText("Que8:What is the name of Indira Gandhi's Samadhi?"); radioButton[0].setText("Shakti Sthal"); radioButton[1].setText(" Shanti Van"); radioButton[2].setText(" Shanti Sthal"); radioButton[3].setText(" Shanti Sthal"); } if (current == 8) { label.setText("Que9:Dallol GeothermalField belongs to which country?"); radioButton[0].setText("Ethiopia"); radioButton[1].setText(" Sudan"); radioButton[2].setText("Norway"); radioButton[3].setText("Russia"); } if (current == 9) { label.setText("Que10:In which state living root bridges are found?"); radioButton[0].setText("Meghalaya"); radioButton[1].setText("Assam");
  • 11. radioButton[2].setText("Manipur"); radioButton[3].setText(" Odisha"); } } boolean check() { if (current == 0) return (radioButton[1].isSelected());if (current == 1) return (radioButton[0].isSelected());if (current == 2) return (radioButton[1].isSelected());if (current == 3) return (radioButton[1].isSelected());if (current == 4) return (radioButton[3].isSelected());if (current == 5) return (radioButton[0].isSelected());if (current
  • 13. if (current == 7) return (radioButton[2].isSelected());if (current == 8) return (radioButton[0].isSelected());if (current == 9) return (radioButton[0].isSelected()); return false; } public static void main(String s[]) { new OnlineTest("Online TestApp"); } }
  • 15. Online Test App Oue3: When is the International Yoga Day celebrated ? June 20 June 21 ≒ Apnl22 May 31 Next BooKnJark O X Online test App Oue4: 'Line of Blood' is a book written by whom? Ursula Vernon . Bairaj Khanna Annal E I-Mohtar 9 Diksha Bas u Next Bookmark O X
  • 16. Online Test App Oue5: .........is thefirst wom antohead a public sector bank? '4? U sha A nanthasu bra manyan f /J Bairaj K hanna fiJ Shikha Sharma f? Amndhati Bhattachary a Next Bookmark O X Online Test App Que6: Indian Army celebrated the Poonch Link-up Day on which date? ! November 21 '! November 25 November 24 NovemDera3 Ne*+ Bookmark O X
  • 17. : Online Test App Oue8: Mat is thename ofIndira Gandhi's Samadhi? q Shanti Sthal Next Bookmark Bookmark Manipur Oue7: The first Indian Statetogowholley organieis -? OnlineTestApp
  • 18. Result Oue10: Inwhich statelivingroot bridges arefound? Meghalay a '≒ Assam Manipur Ddisha BookmarkNect Oue9: Dallol Geothermal Fieldbelongstowhichcountry? Ethiopia . Sudan Russia
  • 19. Oue10: In which state living root bridges are found? Me ghalay d Manipur Odisha Result @UMANG TALPARA (BE/BTECH) Mesh age ".. I .." correci answers - 2 OF