Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Sample Interview Questions for Core Java

Why Java is not 100% pure object oriented language?

Explain working of Java Virtual Machine (JVM)

Why java does not support Multiple Inheritance?

When we are sending the serialized array object thro the network, what is being
passed? is the value or the reference ?

JVM is platform independent/dependent? Why? 2) Which one is faster in execution


Array List or Array? Why?

When you have an object passed to a method and when the object is reassigned to
a different one, then is the original reference lost

What is heap in Java

Can a method be static and synchronized?

Will there be a performance penalty if you make a method synchronized? If so, can
you make any design changes to improve the performance

What is MVC architecture ?

What are interfaces? Or How to support multiple inheritance in Java?

Difference: Java Beans, Servlets

Why java does not support Multiple Inheritance? Why java is not pure Object
Oriented?

What is the Difference between Design Pattern and Architecture?

How a Hashtable can change the iterator? Can a HashMap change the iterator?

What is phantom memory

In Java, how are objects / values passed around

What is EJB

How would you implement a thread pool

What design patterns have you used

How to use C++ code in Java Program?

Difference: AWT, Swing

How do i upload a file from client side to server side using servlet and jsp this will
happen when I click upload button on web-page?

How can we take various inputs from user as int,char,string,float etc ?


What are the different kinds of exceptions? How do you catch a Runtime exception

Do primitive types have a class representation

What are the differences between C++ and Java

How does serialization work

What are the differences between ArrayList and a Vector

Difference between "APPLET" and "APPLICATION"

Disadvantages of Java

Explain the importance of "static"keyword

It is a saying that static methods in JAVA programs should be minimised. What is the
reason for this? any problems arise or there is any performance measures to be
looked into it.

Why multiple inheritance using classes is disadvantage in java

What are the differences between JIT and HotSpot

How all can you free memory

How can you do multiple inheritance in Java

How does garbage collection work

How would you declare a SingleThreaded servlet

What is the interface of thread?

What is BYTE Code?

Whether a Class,Method can be garbage collected or not?How?

Give example of : High severity & Low priority

Write a program that singleton objects returns two instances?

What is a memory footprint? How can you specify the lower and upper limits of the
RAM used by the JVM? What happens when the JVM needs more memory

Does java do reference counting

What is data encapsulation? What does it buy you

What are the differences between AWT and Swing

How are memory leaks possible in Java

How can you swap two variables without using a third variable?

Whether private,protected method can be overloaded,overrided or not?


What do you meant by private constructor? why somebody declare only private
constructor.

Does JVM maintain a cache by itself? Does the JVM allocate objects in heap? Is this
the OS heap or the heap maintained by the JVM? Why

What does a static inner class mean? How is it different from any other static
member

How would you pass a java integer by reference to another function

What are the differences between EJB and Java beans

How can u move/drag a component placed in Swing Container?

Does Java have "goto"?

Why ArrayList is faster than Vector?

Is java a fully object oriented programming or not? if not why?

Whether we can set the time implicitly for the garbage collection?

What are the disadvantages of reference counting in garbage collection

How do you declare constant values in java

What is reflection API? How are they implemented

How would you keep track of a session

What are STRUTS

What is the purpose of interface? And tell the difference between the class and
interface?

What is the meaning of "final" keyword?

Meaning - Abstract classes, abstract methods

What is the basic difference between Java and .Net

Write program for single objects returns two instances?

Is it advisable to depend on finalize for all cleanups

How all can you instantiate final members

What is the primary advantage of XML driven Java Beans

Explain the keywords - native, transient, volatile, finally

Explain Servlet and JSP life cycle

Can I create final executable from Java?


Difference – Java, C++

What is the difference between an object and an instance? And give me a real time
example to differentiate these two?

When you use a struts framework, where would you place your business logic

How is serialization implemented in Java

What are the primitive types in Java

Differences between HashList and HashMap, Set and List

What would happen if you say this = null

Explain Garbage collection mechanism in Java

Explain Java security model

How hashtable is synchronized?why hashmap is not synchronized?Can we make


hashmap synchronized?

Can we declare multiple main() methods in multiple classes.ie can we have each
main method in its class in our program?

Is there a separate stack for each thread in Java

What is the sweep and paint algorithm

What do you like most with Ant


Sample Interview Questions for Enterprise Java Bean

What is EJB?

How statefull session bean remembers it's client state?

When two entity beans are said to be identical?Which method is used to compare identical
or not?

With EJB 1.1 specs, why is unsetSessionContext() not provided in Session Beans, like
unsetEntityContext() in Entity Beans.

How to implement an entity bean which the PrimaryKey is an autonumeric?

How will you propagate exception thrown inside session bean to JSP or Servlet client ?

What is handle in EJB ?

What is EJB Query Language ?

What is the difference between CMP and BMP ?

What is the difference between normal Java object and EJB ?

Can we use instance variables in Stateless session beans? If yes, Why and How? If the
answer is no , explain why and how?

Why CMP beans are abstract classes?

What is the difference between ejbStore() and ejbLoad() ?

How many EJB Objects are created for a Bean ?

If session has thrown ApplicaitonException would you use EJBContext.setRollBackOnly


method

What is the difference between JNDI context, Initial context, session context and ejb
context?

What is ACID?

What is the lifecycle of Entity Bean?

What is the difference between JavaBean and EJB ?

How to insert new row and link like Edit and Delete ?

Is instance pooling necessary for entity beans?

What is the difference between ejbCreate() and ejbPostCreate() ?


What is abstract schema ?

Is Decorator an EJB design pattern ?

What is the difference between sessioncontext and entitycontext ?

What are the various isolation levels in a transaction and differences between them ?

What are the call back methods in Entity bean ?

What is Session Bean. What are the various types of Session Bean ?

Give a scenario where you have used stateless session beans and why was it necessary?

How can we call cmp?

Is stateless Sessiob bean create() method contains any parameters ?

What is re-entrant. Is session beans reentrant. Is entity beans reentrant ?

Can i map more than one table in a CMP ?

What is the difference between EAR, JAR and WAR file ?

What are the various transaction attributes and differences between them ?

When you will chose CMP and BMP ?

What is the difference between Stateful session bean and Stateless session bean ?

what is design pattern ? use ?

How can we call java beans in jsp?

Can I develop an Entity Bean without implementing the create() method in the home
interface ?

Why an onMessage call in Message-driven bean is always a seperate transaction ?

What are simple rules that a Primary key class has to follow ?

What is deployment descriptor ?

What is the difference between activation and passivation ?

What are advantages and disadvantages of CMP and BMP ?

What is the life cycle of Stateful session bean ?

What is business delicate ? Use ? and what is session faced ? use ?


What happens while we interacting with page and immediately database fails?

What is EJB architecture(components) ?

Does Stateful Session bean support instance pooling ?

How is Stateful Session bean maintain their states with client ?

What is CMR ?

What is Instance pooling ?

What is difference between EJB 1.1 and EJB 2.0 ?

What are the call back methods in Session bean ?

what is requestdespatcher?

What is the difference b/w sendRedirect() and ?

Can undefined primary keys are possible with Entity beans?If so, what type is defined?

Why does EJB needs two interfaces(Home and Remote Interface) ?

Is it possible to invoke multiple Session beans from one Session bean using Reflection ?

What is the difference between CMP 1.1 and CMP 2.0 ?

What is the difference between HTTPSession and Stateful Session Bean ?

What is Message Driven Bean ?

When you will chose Stateful session bean and Stateless session bean ?

what is difference between servlet and jsp ?

What is the main use of using interface?

Can I invoke Runtime.gc() in an EJB ?

What is clustering. What are the different algorithms used for clustering ?

What is the difference between optimistic locking and pessimistic locking ?

How do you check whether the session is active in Stateful session bean ?

What is the life cycle of MDB ?

What is Entity Bean. What are the various types of Entity Bean ?

What is the difference between distributed transactions and Flat transactions in EJB?
Can a Session Bean be defined without ejbCreate() method ?

What is lazy loading ?

What is the difference between find and select methods in EJB ?

What is local interface. How values will be passed ?

What are the services provided by container ?

What are the optional clauses in EJB QL ?

What is the difference between local interface and remote interface ?


Sample Interview Questions For Java Server Page – JSP

What is JSP?

How do you restrict page errors display in the JSP page ?

How do I prevent the output of my JSP or Servlet pages from being cached by the browser?

How do I include static files within a JSP page?

What is the servlet?

How HTTP Servlet handles client requests?

Can I invoke a JSP error page from a servlet?

What are advantages of JSP ?

How do you pass control from one JSP page to another ?

How do I use comments within a JSP page?

How do I include static files within a JSP page?

Can I just abort processing a JSP?

What are the uses of Servlets?

Difference between single thread and multi thread model servlet

What is the difference between include directive & jsp:include action

How do I have the JSP-generated servlet subclass my own custom servlet class, instead of
the default?

Can I stop JSP execution while in the midst of processing a request?

How do you prevent the Creation of a Session in a JSP Page and why?

If you want a servlet to take the same action for both GET and POST request, what should
you do?

What is the difference between GenericServlet and HttpServlet?

When a servlet accepts a call from a client, it receives two objects. What are they?

What are Custom tags. Why do you need Custom tags. How do you create Custom tag ?

How does a servlet communicate with a JSP page?


Is there a way to reference the "this" variable within a JSP page?

Is it possible to share an HttpSession between a JSP and EJB? What happens when I change
a value in the HttpSession from inside an EJB?

What is the servlet life cycle?

What are the differences between GET and POST service methods?

What information that the ServletRequest interface allows the servlet access to?

What are the implicit objects in JSP & differences between them

Is there a way I can set the inactivity lease period on a per-session basis?

How do I perform browser redirection from a JSP page?

Can a JSP page instantiate a serialized bean?

Which code line must be set before any of the lines that use the PrintWriter?

What is the difference between ServletContext and ServletConfig?

What information that the ServletResponse interface gives the servlet methods for replying
to the client?

What is jsp:usebean. What are the scope attributes & difference between these attributes ?

How can I set a cookie and delete a cookie from within a JSP page?

How do I include static files within a JSP page?

Can you make use of a ServletOutputStream object from within a JSP page?

How HTTP Servlet handles client requests?

Can I invoke a JSP error page from a servlet?

What is the servlet?

What is difference between scriptlet and expression ?

How can I declare methods within my JSP page?

What JSP lifecycle methods can I override?

What is the difference between GenericServlet and HttpServlet?

Difference between single thread and multi thread model servlet


Can I just abort processing a JSP?

What are the uses of Servlets?

What is Declaration ?

How can I enable session tracking for JSP pages if the browser has disabled cookies?

Can a JSP page process HTML FORM data?

What are the differences between GET and POST service methods?

When a servlet accepts a call from a client, it receives two objects. What are they?

If you want a servlet to take the same action for both GET and POST request, what should
you do?

What is the difference between GenericServlet and HttpServlet?

How do you connect to the database from JSP ?

How do I use a scriptlet to initialize a newly instantiated bean?

How do I mix JSP and SSI #include?

What is the difference between ServletContext and ServletConfig?

What information that the ServletRequest interface allows the servlet access to?

What is the servlet life cycle?

What are the differences between GET and POST service methods?

How do you call stored procedures from JSP ?

How does JSP handle run-time exceptions?

How can I implement a thread-safe JSP page?

What information that the ServletResponse interface gives the servlet methods for replying
to the client?

Which code line must be set before any of the lines that use the PrintWriter?

What is the difference between ServletContext and ServletConfig?


Sample Interview Questions For JDBC

What is JDBC?

Difference between Type-2 and Type-3 driver

How can you make the connection?

What is a transaction ?

How to get the resultset of stroedProcedure ?

How can you create JDBC statements?

What is the difference between JDBC 1.0 and JDBC 2.0 ?

What is the purpose of setAutoCommit( ) ?

How can store images in a data base?

How can you retrieve data from the ResultSet ?

What are the two major components of JDBC ?

What are the three statements in JDBC & differences between them ?

Why do we use prepared statement when already statement is present ?

What are the different types of Statements?

What is JDBC Driver interface ?

What is stored procedure. How do you create stored procedure ?

How can you use PreparedStatement ?

What are the common tasks of JDBC ?

What are batch updates ?

How to call a Stored Procedure from JDBC ?

What packages are used by JDBC ?

What is the difference between Resultset and Rowset ?

How to Retrieve Warnings ?

What are the flow statements of JDBC ?


What are the steps for connecting to the database using JDBC ?

How to Make Updates to Updatable Result Sets ?

What are the steps involved in establishing a connection ?

What is Connection Pooling ?

"select * from user" .what are the steps to take for execution of query in JDBC ?

How can you load the drivers ?

How do you implement Connection Pooling ?

What Class.forName will do while loading drivers ?

What Class.forName( ) method will do ?

Sample Interview Questions For Servlets

What is the servlet ?

What are the JSP atrributes?

What is the need of super.init(config) in servlets ?

How to know whether we have to use jsp or servlet in our project ?

Can we call destroy() method on servlets from service method ?

What is the Servlet Interface?

What is the difference between GenericServlet and HttpServlet?

How we can check in particular page the session will be alive or not?

What is the importance of deployment descriptor in servlet?

When we increase the buffer size in our project using page directive attribute 'buffer' what
changes we observe?

What is the difference between ServetConfig and ServletContext..?

When a servlet accepts a call from a client, it receives two objects. What are they?

What are the differences between GET and POST service methods?

In which conditions we have to use the ServletContext ?

What methods will be called in which order?((i.e)service(),doget(),dopost())


Servlet is Java class. Then why there is no constructor in Servlet ? Can we write the
constructor in Servlet

What is the use of ServletConfig and ServletContext..?

What information that the ServletRequest interface allows the servlet access to?

What is the difference between ServletContext and ServletConfig?

When you have action=get?

What is a Singleton class. How do you write it ?

What is difference between sendRedirect() and forward()..? Which one is faster then other
and which works on server?

What information that the ServletResponse interface gives the servlet methods for replying
to the client?

Can I invoke a JSP error page from a servlet?

Can a init(ServletConfig config) method be overrided in servlets?

How many ServletConfig and servlet context objects are present in one application?

Do we have a constructor in servlet ? can we explictly provide a constructor in servlet


programme as in java program ?

What are the uses of Servlets?

Can I just abort processing a JSP?

Is servlet is used to create a dynamic webpage or Static webpage or both?

If you want a servlet to take the same action for both GET and POST request, what should
you do?

What is the difference between JSP and SERVLETS ?

What are the advantages using servlets than using CGI?

What is a better approach for enabling thread-safe servlets and JSPs? SingleThreadModel
Interface or Synchronization?

We have two applications in that we have two servlets each.How they(servlets)


communicate with each other ?

How the server will know (i.e) when it can invoke init, service,destroy methods of servlet life
cycle?
How to communicate between two servlets?

What is the difference between servlets and applets?

How will u pass the argument from one servlet to another servlet?

what method used to add a jsp to the servlet ?

How HTTP Servlet handles client requests?

How to get one Servlet's Context Information in another Servlet?

Difference between single thread and multi thread model servlet

What is the super class of All servlets?

How Servlet Applet communication achieved?

What is servlet context and what it takes actually as parameters?

What is the servlet life cycle?

Types of Servlets?

Why is that we deploy servlets in a webserver.What exactly is a webserver?

Which code line must be set before any of the lines that use the PrintWriter?

You might also like