Sahil Java Project
Sahil Java Project
Sahil Java Project
Micro-Project
On
Online Paper Test
Submitted To
MSBTE
In Partial Fulfilment of Requirement of Diploma Of
Computer Engineering
Under I Scheme
Submitted By
Principles:
There were five primary goals in the creation of the Java language
It should be "simple, object-oriented and familiar".
It should be "robust and secure".
It should be "architecture-neutral and portable".
It should execute with "high performance".
It should be "interpreted, threaded, and dynamic".
Java is a fully Object Oriented language because object is at the outer most level of
data structure in Java. No stand alone methods, constants, and
Variables are there in Java. Everything in Java is object even the primitive data
types can also be converted into object by using the wrapper class.
Java Technology
As a development environment, Java technology provides you with large suits of tools:
• A compiler (javac)
• A interpreter(java)
Object and Methods
Java is an object-oriented programming language, abbreviated OOP.
Oops is a programming methodology that views a program as similarly consisting of objects
that interacts with each other by means of action.
Object oriented programming has its own specialized terminology. The objects are called,
appropriately enough, objects. The actions that an object can take are called methods.
A java application program is a class with a method named main, and when you run the java
program the run-time system automatically invokes the method named main.
FEATURES OF JAVA:
Platform Independent:
The concept of Write-once-run-anywhere (known as the Platform independent) is one of
the important key feature of java language that makes java as the most powerful language.
Not even a single language is idle to this feature but java is closer to this feature. The
programs written on one platform can run on any platform provided the platform must have
the JVM.
Simple:
There are various features that make the java as a simple language. Programs are easy to
write and debug because java does not use the pointers explicitly. It is much harder to write
the java programs that can crash the system but we cannot say about the other programming
languages. Java provides the bug free system due to the strong memory management. It also
has the automatic memory allocation and deallocation system.
Object Oriented:
To be an Object Oriented language, any language must follow at least the four
characteristics.
Inheritance : It is the process of creating the new classes and using the behavior of the
existing classes by extending them just to reuse the existing code and adding the additional
features as needed.
Polymorphism : As the name suggest one name multiple form, Polymorphism is the way of
providing the different functionality by the functions having the same name based on the
signatures of the methods.
Dynamic binding : Sometimes we don't have the knowledge of objects about their specific
types while writing our code. It is the way of providing the maximum functionality to a
program about the specific type at runtime.
As the languages like Objective C, C++ fulfills the above four characteristics yet they are not
fully object oriented languages because they are structured as well as object oriented
languages. But in case of java, it is a fully Object Oriented language because object is at the
outer most level of data structure in java. No stand alone methods, constants, and variables
are there in java. Everything in java is object even the primitive data types can also be
converted into object by using the wrapper class.
Robust:
Java has the strong memory allocation and automatic garbage collection mechanism. It
provides the powerful exception handling and type checking mechanism as compare to other
programming languages. Compiler checks the program whether there any error and
interpreter checks any run time error and makes the system secure from crash. All of the
above features make the java language robust.
Distributed :
The widely used protocols like HTTP and FTP are developed in java. Internet
programmers can call functions on these protocols and can get access the files from any
remote machine on the internet rather than writing codes on their local system.
Portable:
The feature Write-once-run-anywhere makes the java language portable provided that the
system must have interpreter for the JVM. Java also has the standard data size irrespective of
operating system or the processor. These features make the java as a portable language.
Dynamic:
While executing the java program the user can get the required files dynamically from a
local drive or from a computer thousands of miles away from the user just by connecting with
the Internet.
Multithreaded:
As we all know several features of Java like Secure, Robust, Portable, dynamic etc; you
will be more delighted to know another feature of Java which is Multithreaded. Java is also
a multithreaded programming language. Multithreading means a single program having
different threads executing independently at the same time. Multiple threads execute
instructions according to the program code in a process or a program. Multithreading works
the similar way as multiple processes run on one computer.
Compiler/Interpreter Combo:
Code is compiled to byte codes that are interpreted by a Java virtual machines (JVM)
This provides portability to any machine for which a virtual machine has been written. The
two steps of compilation and interpretation allow for extensive code checking and improved
security.
Security:
No memory pointers
Programs run inside the virtual machine sandbox.
Array index limit checking
Code pathologies reduced by
• byte code verifier - checks classes after loading
• Class loader - confines objects to unique namespaces. Prevents loading a hacked
"java.lang.SecurityManager" class, for example.
• Security manager - determines what resources a class can access such as reading and
writing to the local disk.
Good Performance:
Interpretation of byte codes slowed performance in early versions, but advanced virtual
machines with adaptive and just-in-time compilation and other techniques now typically
provide performance up to 50% to 100% the speed of C++ programs.
Built-in Networking:
Java was designed with networking in mind and comes with many classes to develop
sophisticated Internet communications. Features such as eliminating memory pointers and by
checking array limits greatly help to remove program bugs.
Purpose:
The purpose of Java Programming On-line Test is to take online test on JAVA
Programming Language in an efficient manner and no time wasting for checking the
paper. The main objective of on-line test 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.
Scope:
Scope of this project is very broad in terms of other manually taking exams.
Few of them are:-
• This can be used in educational institutions Specially in Java Training Center as well
as in corporate world to test Student’s Java Basic Skills in Only 10 minutes.
• 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.
Features:
• Secure
• Easy to use
• Reliable and accurate
• No need of examiner
• Basic Overview of Java Programming Language.
The Java Programming Online test created for taking online test for Java Language
has following stages:-
• Login
• Test
• Result
Login/Input:
There is a quality login window because this is more secure than other login forms as in a
normal login window there is only one logins available so that only one person can access to
test with his/her individual login. The User has to fill up only His/her name to start the Java
Programming On-line Test. After Filling Name on textbox Press ok to see the instructions to
start the Test. Hence by Single Login Window it is more secure and reliable than previously
used on-line tests.
Test:
Test page is the most creative and important page in this project. It
Consists of 2 modules namely:
• Instructions.
• Questions with 4 Options.
Instructions:
The Following Instructions will appear will on the left Hand side of the Test Frame which
specifies all the rules & process to Start and complete the online Test efficiently.
1. There are 25 questions in this test and 10 minutes to complete them all.
2. The finish button is highlighted in blue when you reach the end of the test.
3. Clicking the finish button will display the results with the correct answers marked in
light red.
4. The time counter begins when you click on the 'start' button.
5. Best of luck!
5. Four options on the Right side also displaying no of Options to be chosen with
Radio Buttons to fill the answer of the user.
Result:
After pressing on Finish Button One more Pop up Window will appear on the Screen
Displaying the Result of the User with
1. Total Marks of the User out of 10 as Each Correct Answer contains 1 mark.
2. Percentage
3. Over All Result of the On-line Test showing Whether the User is PASS or FAIL. If
the Total Marks >=9 then the User is PASS otherwise FAIL.
Program code:
/*Online Java Paper Test*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
JLabel l;
JButton b1,b2;
ButtonGroup bg;
int count=0,current=0,x=1,y=1,now=0;
OnlineTest(String s)
super(s);
l=new JLabel();
add(l);
bg=new ButtonGroup();
for(int i=0;i<5;i++)
{
jb[i]=new JRadioButton();
add(jb[i]);
bg.add(jb[i]);
b1=new JButton("Next");
b2=new JButton("Bookmark");
b1.addActionListener(this);
b2.addActionListener(this);
add(b1);add(b2);
set();
l.setBounds(30,40,450,20);
jb[0].setBounds(50,80,100,20);
jb[1].setBounds(50,110,100,20);
jb[2].setBounds(50,140,100,20);
jb[3].setBounds(50,170,100,20);
b1.setBounds(100,240,100,30);
b2.setBounds(270,240,100,30);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(null);
setLocation(250,100);
setVisible(true);
setSize(600,350);
if(e.getSource()==b1)
{
if(check())
count=count+1;
current++;
set();
if(current==9)
b1.setEnabled(false);
b2.setText("Result");
if(e.getActionCommand().equals("Bookmark"))
bk.setBounds(480,20+30*x,100,30);
add(bk);
bk.addActionListener(this);
m[x]=current;
x++;
current++;
set();
if(current==9)
b2.setText("Result");
setVisible(false);
setVisible(true);
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("Result"))
if(check())
count=count+1;
current++;
//System.out.println("correct ans="+count);
JOptionPane.showMessageDialog(this,"correct ans="+count);
System.exit(0);
void set()
jb[4].setSelected(true);
if(current==0)
{
l.setText("Que1: Which one among these is not a datatype");
jb[0].setText("int");jb[1].setText("Float");jb[2].setText("boolean");jb[3].setText("char");
if(current==1)
jb[0].setText("Swing");jb[1].setText("Applet");jb[2].setText("Object");jb[3].setText("ActionEv
ent");
if(current==2)
jb[0].setText("swing");jb[1].setText("applet");jb[2].setText("net");jb[3].setText("lang");
if(current==3)
jb[0].setText("lang");jb[1].setText("Swing");jb[2].setText("Applet");jb[3].setText("awt");
if(current==4)
jb[0].setText("Utek");jb[1].setText("Aptech");jb[2].setText("SSS
IT");jb[3].setText("jtek");
}
if(current==5)
jb[0].setText("class");jb[1].setText("int");jb[2].setText("get");jb[3].setText("if");
if(current==6)
jb[0].setText("Swing");jb[1].setText("Actionperformed");jb[2].setText("ActionEvent");jb[3].se
tText("Button");
if(current==7)
jb[0].setText("toString");jb[1].setText("finalize");jb[2].setText("equals");jb[3].setText("getDo
cumentBase");
if(current==8)
jb[0].setText("init");jb[1].setText("main");jb[2].setText("start");jb[3].setText("destroy");
if(current==9)
l.setBounds(30,40,450,20);
for(int i=0,j=0;i<=90;i+=30,j++)
jb[j].setBounds(50,80+i,200,20);
boolean check()
if(current==0)
return(jb[1].isSelected());
if(current==1)
return(jb[2].isSelected());
if(current==2)
return(jb[3].isSelected());
if(current==3)
return(jb[0].isSelected());
if(current==4)
return(jb[2].isSelected());
if(current==5)
return(jb[2].isSelected());
if(current==6)
return(jb[1].isSelected());
if(current==7)
return(jb[3].isSelected());
if(current==8)
return(jb[1].isSelected());
if(current==9)
return(jb[2].isSelected());
return false;
}
CONCLUSION:-
The Java Programming On line Test System is developed using Core Java
which fully meets the
Objectives of the system for which it has been developed. The system has
reached a steady
State where all bugs have been eliminated. The system is operated at a high
level of efficiency
and all the teachers and user associated with the system understands its
advantage. The
system solves the problem. It was intended to solve as requirement
specification.