- What is the protocol used by server and client ?
- Can I modify an object in CORBA ?
- What is the functionality stubs and skeletons ?
- What is the mapping mechanism used by Java to identify IDL language ?
- Diff between Application and Applet ?
- What is serializable Interface ?
- What is the difference between CGI and Servlet ?
- What is the use of Interface ?
- Why Java is not fully objective oriented ?
- Why does not support multiple Inheritance ?
- What it the root class for all Java classes ?
- What is polymorphism ?
- Suppose If we have variable ‘ I ‘ in run method, If I can create one or more thread each thread will occupy a separate copy or same variable will be shared ?
- In servlets, we are having a web page that is invoking servlets username and password ? which is checked in the database ? Suppose the second page also If we want to verify the same information whether it will connect to the database or it will be used previous information?
- What are virtual functions ?
- Write down how will you create a binary Tree ?
- What are the traverses in Binary Tree ?
- Write a program for recursive Traverse ?
- What are session variable in Servlets ?
- What is client server computing ?
- What is Constructor and Virtual function? Can we call Virtual function in a constructor ?
- Why we use OOPS concepts? What is its advantage ?
- What is the middleware ? What is the functionality of Webserver ?
- Why Java is not 100 % pure OOPS ? ( EcomServer )
- When we will use an Interface and Abstract class ?
- What is an RMI?
- How will you pass parameters in RMI ? Why u serialize?
- What is the exact difference in between Unicast and Multicast object ? Where we will use ?
- What is the main functionality of the Remote Reference Layer ?
- How do you download stubs from a Remote place ?
- What is the difference in between C++ and Java ? can u explain in detail ?
- I want to store more than 10 objects in a remote server ? Which methodology will follow ?
- What is the main functionality of the Prepared Statement ?
- What is meant by static query and dynamic query ?
- What are the Normalization Rules ? Define the Normalization ?
- What is meant by Servlet? What are the parameters of the service method ?
- What is meant by Session ? Tell me something about HTTPSession Class ?
- How do you invoke a Servlet? What is the difference in between doPost and doGet methods ?
- What is the difference in between the HTTPServlet and Generic Servlet ? Explain their methods ? Tell me their parameter names also ?
- Have you used threads in Servlet ?
- Write a program on RMI and JDBC using StoredProcedure ?
- How do you sing an Applet ?
- In a Container there are 5 components. I want to display the all the components names, how will you do that one ?
- Why there are some null interface in java ? What does it mean ? Give me some null interfaces in JAVA ?
- Tell me the latest versions in JAVA related areas ?
- What is meant by class loader ? How many types are there? When will we use them ?
- How do you load an Image in a Servlet ?
- What is meant by flickering ?
- What is meant by distributed Application ? Why we are using that in our applications ?
- What is the functionality of the stub ?
- Have you used any version control ?
- What is the latest version of JDBC ? What are the new features are added in that ?
- Explain 2 tier and 3 -tier Architecture ?
- What is the role of the webserver ?
- How have you done validation of the fields in your project ?
- What is the main difficulties that you are faced in your project ?
- What is meant by cookies ? Explain ?
>

11 Comments on Java networking and algoritms interview questions
I need to advertise for a web Java developer and these questions would certainly assist me to screen out applicants with basic web and Java knowledge. I currently have no one on my programming staff with this knowledge, so would you please provide me the answers to these questions? Thanks.
I like the questions on this site. I am providing answer for some of the questions: (Hope that they will help you all)
What is the protocol used by server and client?
Ans: The protocol that is mainly used in java is HTTP and UDP.
Diff between Application and Applet?
Ans: An application is a program that can be run on the client only. On the other hand Applets are the small programs that are transferred through internet, automatically installed and run as a part of web browser. We can also test the applet using appletviewer utility provided by the jdk.
What is the difference between CGI and Servlet?
Ans: The main difference between the two is first process the client requests (to the server) one at a time where as in second requests are lined up and send to the server as a collection. The main advantage of using servlets is its security features. [Servlets are small programs that are executed on the server side of the connection]
What is the use of Interface?
Ans: Interface are used when we know the functionality of a program but its implementation is not known to us. This way we can declare the constants and functions in the interface and later on they can be implemented by any program. [We can fully abstract a class from its implementation using this way. Thats why they are called interface]
Why Java is not fully object oriented?
Ans: Because it doesn’t support many features of OO paradigm like operater overloading. But it to some extent is better than C++ as it has the main function in the class itself thus providing a extra security to a program.
Why java does not support multiple Inheritance?
Ans: Java do support a multiple inheritance but not in a way as C++ support. Instead it support by the means of interfaces. [The main reason why java doesn’t support Multiple Inheritance is it allows same features to be inherited again and again and java being a secure language didn’t allow anything that will lead to insecurity.
Answer to some questions again:
What it the root class for all Java classes?
Ans: This the Object class which is the root of all classes in java.
What is polymorphism?
Ans: As name suggest polymorphism consist of 2 words ‘poly’ means many and ‘morphism’ means form. Polymorphism is ability to take more than one form. In java one way to implement polymorphism is function overloading and other way is dynamic method dispatch (in which methods for the appropriate class are called at runtime).
Suppose If we have variable ‘I‘ in run method, If I can create one or more thread each thread will occupy a separate copy or same variable will be shared?
Ans: I think this copy must be shared for each thread.
What are virtual functions?
Ans: Virtual function is a way to achieve run time polymorphism in C++. It is defined in the base class with a keyword virtual and we need to override the same function in the derived class also. When called the function is called based on the object reference rather than object itself.
Write down how will you create a binary Tree?
Ans: There is class in java that provides binary tree features using which we can create an empty binary tree and later on we can add, delete the elements into it. In C++ first we have to define a structure
struct tree
{
int element;
struct tree *left;
struct tree *right;
}
After that we can contruct the tree using tree algorithm.
What are the traverses in Binary Tree?
Ans: There are 3 ways to traverese a binary tree:
1. Pre-order
2. In-order
3. Post-order
Write a program for recursive Traverse?
Ans: I am writing the code snippet for inorder:
void inorder(node *tree)
{
if (tree!=NULL)
{
inorder(tree->left);
printf(”%d “,tree->element); //process the root
inorder(tree->right);
}
}
The procedure for pre and post orders are same.
What is client server computing?
Ans: Its a technology where one machine known as client request the service from another machine (called server) and server returns the appropriate response to client.
What is Constructor and Virtual function? Can we call Virtual function in a constructor?
Ans: Constructor is a special method that used for initializing variables of the class. This is special as its name is same as the name of the class.
Why we use OOPS concepts? What is its advantage?
Ans: OOPS defines real world entities called object which has data and methods to operate on that data. Its advantages are:
1. Being a real world entity object can define a problem in well defined manner which leads to a ease in programming.
2. It follows a bottom up approach.
3. Encapsulation is one of the key feature of OOPS i.e wrapping up data and functions in a single unit called class.
4. Data hiding: Data is hidden from the external world.
What is the middleware ? What is the functionality of Webserver?
Middleware is a component that sits between client and server and allows every request from client to server through it. This not only increases performance but also reduces trafic between client and server as many request may be handled by the middleware itself.
Java implements middleware using Servlets at the lower level and using J2ee at the higher level.
When we will use an Interface and Abstract class ?
Ans: Abstract class is used whenever we are having one or more methods in a class that are not abstract (means their implementation is given or think of). On the other hand interface is used when we don’t know anything about the implementation of methods to be defined in the class.
What is an RMI?
Ans: Remote Method Invocation (RMI) is a java Mechanism that allows a program to invoke a method that is being executed on a remote machine. [The important thing to rememeber here remote object whose method is being invoked must be executing on the remote machine)
Hi Sachin Again,
Here are answers of some more questions:
What is the difference in between C++ and Java ? can u explain in detail?
Ans: The main difference between the 2 are following:
1. C++ supports pointers, java doesn’t.
2. C++ supports mutiple inheritance direclty, java supports the same but by way of implementing the interface.
3. C++ supports operator overloading, java doesn’t.
What is the main functionality of the Prepared Statement?
Ans: If you want to execute a Statement object many times, it will normally reduce execution time to use a PreparedStatement object instead. The following code snippet will give a better idea
PreparedStatement updateSales = con.prepareStatement(
“UPDATE EMP SET SAL = ? WHERE EMP_NO LIKE ? “);
updateSales.setInt(1, 10000);
updateSales.setString(2, “E%”);
updateSales.executeUpdate():
What is meant by static query and dynamic query?
Ans: Static query is a query that is fixed and doesn’t varry at the run time. Where as Dynamic query varries with the change in the values at the run time.
For example:
“select * from emp where name = ’sachin’” is a static query and always returns the same result.
“select * from emp where name = ‘” + vName + “‘” is a dynamic query as the result of this query will be based on the value of vName.
What are the Normalization Rules? Define the Normalization?
Ans: Normalization is the process of putting things right, making them normal. This is needed for:
1. Avoid Redundancy
2. Data Integrity
There are many forms in which a relation can be normalized:
1. INF
2. 2NF
3. 3NF
4. BCNF
5. 4NF
6. 5NF
What is meant by Servlet? What are the parameters of the service method?
Ans: Servlet is a small prgram that is executed at server end of the network connection. Two parameters of service methods are:
service(ServletRequest req, ServletResponse res)
ServletRequest : for service request
ServletResponse : for response from the server
How do you invoke a Servlet? What is the difference in between doPost and doGet methods?
Ans: Servlet is always invoked through the browser either through url string or by pressing a button through action tag in html.
doGet method: is used when we use get attribute in the form tag in the html page calling the servlet. When used doGet, the parameters from the client to the server are passed as a part of url string. The main limitations here the size and number of parameters may create some problem.
doPost method: is used when we use post attribute in the form tag in the html page calling the servlet. When used doPost, the parameters from the client to the server are passed as encoded string not as a part of url string.
What is the difference in between the HTTPServlet and Generic Servlet? Explain their methods? Tell me their parameter names also ?
Have you used threads in Servlet?
Ans: The main difference between the HTTPServlet and Generic Servlet is first is used whenever there is an client and server communicate using HTTP protocol where as second is used for normal communication.
Have you used any version control?
Ans: Version contorl is a process of keeping many versions of a project so that whenever any error occurs due to some addtion/deletion/modification of the code the problem can be sorted out easily.
Explain 2 tier and 3 -tier Architecture?
Ans: 2 tier means communication between 2 components client and server. 3 tier means all the requests/responses from/to client to/from the server are done through middleware that contains the business logic.
How have you done validation of the fields in your project?
Ans: Its a simple technique in which whether the inputs provided by the users are valid or invalid.
What is the main difficulties that you are faced in your project?
Ans: The main difficult and time consuming phase of any project is testing. But if we spend more time on previous 2 phases (analysis and design) then we won’t face any problem in coding and so in testing.
Any body can tell me that what is the difference between jdk1.1.,jdk1.2 and jdk1.3 soon relpy m at rajeshabc9@yahoo.com plz
Hi Rajesh,
I don’t think apart from the security features added in each of the new version, there is any major differences. These differences are given below:
JDK 1.02 - Sandbox Security model: remote Java code is untrusted and runs in the sandbox.
JDK 1.1 - Digital signatures are used to distinguish trusted code from untrusted code; trusted applets can be given access to system resources.
JDK1.2 - Java Protection Domains Security model; sets of permissions are created and attached to “domains” that can be made available to Java program based on the programs based on the program’s origin and digital signature.
JDK1.3 - New classes for security added.
Hope that this will help you.
Good work Sachin Rastogi. Great. Thank you for providing answers for the questions.
Hey all.
With regards to what a serializable interface is. Serializable interface is implemented by those objects that need to communicate across networks. The process of serialization is something that converts an object in to BitBlob so that transportation across environments without loss of features and with minimal overhead of transmission.
In other words, by implementing this interface the serializability feature of a class gets enabled. So data storage can be done even this way apart from the conventional databases.
Sorry Sachin Rastogi (rsachin@krify.com), I dont agree with u r answer for the following questions…….
Why Java is not fully object oriented?
Ans by (Sachin Rastogi): Because it doesn\’t support many features of OO paradigm like operater overloading. But it to some extent is better than C++ as it has the main function in the class itself thus providing a extra security to a program.
————————————————————-
How could u say that java doesnt support Operator overloading? u can user + symbol for adding strings also. It means that java supports operator overloading, but the user is not given facility to define his own methods for operators. So I say java supports operator overloading.
Java is not fully object Oriented becoz all the premitive data types ie., integer, long, float all these are not objects. Thats why java is not fully object oriented. If java treats primitive types as objects then we can say java is 100% Object oriented. And OOPs doesnt say to facilitate operator overloading.
why java doesn’t support operator overloading and pointers?
With regards serialization…. why cant static variables be serialized?