Wednesday, January 4, 2012

JAVA INTERVIEW QUESTIONS


OOPS
  1. Concepts

Differences
  1. aggregation and composition
  2. Abstraction and Encapsulation

Java
  1. What is static variable. transient variable. volatile variable, final variable.
  2. What are the kinds of variables in Java? (Instance, Class, Local)
  3. What is method overloading and s method overriding?

  1. What is final method, native method. abstract method ?
  2. synchronization is to be applied only for?
  3. What is anonymous class.
  4. What is Adapter classes
  5. What are wrapper classes
  6. What are different types of inner classes?

  1. Can you instantiate the Math class?
  2. Can the abstract class be final?
  3. Can a top level class be private or protected?
  4. Is null a keyword?
  5. What is JVM?
  6. What is a Tagged interface Interface? Examples ?
  7. What do you mean by a Classloader?
  8. How will you execute any method of the superclass from the subclass?
  9. What is the purpose of the File class?
  10. What is the life cycle of an applet.
  11. What is Reflection. Uses of Reflection.
  12. How do I access environment variables?
  13. What does autoboxing and unboxing mean?
  14. What are annotations in Java?
  15. can you force garbage collection?
  16. What is the purpose of finalization?

  1. Access Modifiers and access Specifiers ?

  1. Hierarchy of exception
  2. What are Checked and UnChecked Exception?
  3. What are runtime exceptions?
  4. What are the different ways to handle exceptions?
  5. What is the purpose of the finally clause of a try-catch-finally statement?
  6. Does the code in finally block get executed if there is an exception and a return statement in a catch block?
  7. What is User defined exception?

  1. What are different ways in which a thread can enter the waiting state?
  2. What are the various ways of creating a thread
  3. Three types of priority? (MAX_PRIORITY which is 10, MIN_PRIORITY which is 1, NORM_PRIORITY which is 5)
  4. What is deadlock?
  5. Algorithm used in Thread scheduling? (Fixed priority scheduling.)
  6. Usually where we use the methods wait(), notify(), and notifyAll() methods?
  7. What is the common usage of serialization?
  8. How many methods in the Serializable interface and it's package is?
  9. What is Externalizable?
  10. How many methods in the Externalizable interface?

  1. How do I synchronize a collection
  2. What interface do you implement to do the sorting?
  3. What is a hashCode and where will you use it ?
  4. What is HashMap and Map?

Differences
  1. JVM and JDK and JRE
  2. Abstract class and Interface.
  3. Hashmap and Hashtable.
  4. Vector, Array and Arraylist.
  5. Final, finally and finalized.
  6. String and StringBuffer.
  7. Exception and error.
  8. List, Set and Map.
  9. this() & super().
  10. Iterator and Enumeration.
  11. wait(), join(), sleep(), notify() & notifyall()
  12. File and RandomFileAccess classes.
  13. paint() and repaint() methods.
  14. yielding and sleeping.
  15. .equals and ==
  16. URL & URI
  17. & operator and the && operator?

JDBC
  1. What are the classes you used in JDBC ?
  2. ACID properties
  3. What is the purpose of setAutoCommit().
  4. What are batch updates and how you will write it?
  5. What are the steps for connecting to the database using JDBC.
  6. What is Connection Pooling? How do you implement Connection Pooling?
  7. What Class.forName() method will do.?
  8. What happens if I close the connection twice?
  9. What are the standard isolation levels defined by JDBC? (TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE)
  10. How do I receive a ResultSet from a stored procedure?
  11. Types of Drivers
Differences
  1. Statement, PreparedStatement, Callable Statement
  2. execute, executeQuery, executeUpdate
  3. Resultset and Rowset
  4. JDBC 2.0 and JDBC 2.1
  5. Why cannot java.util.Date match with java.sql.Date?

JSP
  1. Life cycle of JSP.
  2. What are Custom tags? And how will implement the custom Tags and how do you configure it.
  3. What are the implicit objects in JSP
  4. What are the scope attributes & difference between them(level hierarchy of scopes) ?
  5. What is difference between scriptlet and expression?
  6. How do you handle exception handling in JSP
  7. How do you implement thread safe in JSP
  8. Tell some of the attributes of Page
  9. Can we implement an interface in a JSP?
  10. If I want to upload a file what attribute am I going to use in form tag (ENCTYPE="multipart/form-data")
  11. How can I display different currencies in my JSP pages according to the location of the client. (request.getLocale() and passing it to a NumberFormat object).
  12. What is a translation unit?
  13. What is Expression ,is Declaration and Scriptlet?
  14. What are Standard Actions in JSP ?
  15. Attributes of <jsp:useBean> tag
  16. How do I prevent the output of my JSP or Servlet pages from being cached by the browser?

Differences
  1. include directive & jsp:include action
  2. page vs pagecontext?

Servlets
  1. What are Servlets
  2. What is the Life cycle of Servlet?
  3. Can destroy() be called from inside the service() method
  4. Can I make service() method synchronized? if I do so then what will happen if ten user access that Servlet
  5. Preinitializtion of Servlet
  6. Servlet Aliasing
  7. How to redirect from one servlet to another servlet present in another container ?
  8. How do you implement SingleThreadModel in Servlets?
  9. Server side include ?
  10. Servlet Realms
  11. How do you invoke the the servlet using the Basic authentication
  12. How do restrict access to the servlets package.

  13. How to you pass parameter using HtppUrlConnection
  14. How can I send user authentication information while making URLConnection? (HttpURLConnection.setRequestProperty)

  1. How to get the url of the current request
  2. What is filter? Why do we need filter and how do you configure filter
  3. What is Listener Why do we need listener and how do you configure listener

  1. What is Session Tracking? various ways for achieving SessionTracking
  2. Various ways of specifying Session Time out ? Mention all the mechanisms?
  3. How you will achieve Servlet collabaration ?
  4. What is the tag used for specifying the datasource

  1. How many cookies can one set in the response object of the Servlet
  2. hot many ways a Servlet to Servlet communication ?
  3. What is HTTP tunneling
  4. Explain the directory structure of a web application.


Differences
  1. Servlet and JSP
  2. sendRedirect() & forward() method.
  3. doGet() and doPost()
  4. HTTPServlet and GenericServlet.
  5. rd.forward(); or rd.include();
  6. request.getAttribute() and request.getParameter()?
  7. ServletContext and PageContext
  8. ServletContext and ServletConfig?
  9. ServletContext.getInitParameter() and HttpServlet.getInitParameter() ?

EJB

  1. What is EJB
  2. Key Benefits of uisng EJB
  3. Different kinds of EJB
  4. What is Session Bean
  5. What is Entity Bean
  6. What is Message driven Bean
  7. What are the methods of Entity Bean?
  8. What are the callback methods in Entity beans?
  9. Can Entity Beans have no create() methods?
  10. How EJB Invocation happens?
  11. Is it possible to specify multiple JNDI names when deploying an EJB?
  12. How many types of protocol implementations does RMI have?

  1. Life cycle of EJB's
  2. Procedure for writing EJB's
  3. what are the call back methods in Session bean
  4. What are the call back methods in Entity bean

  1. Transaction models
  2. Transaction attributes?
  3. What is the default transaction attribute for an EJB?

  1. Can you create thread in EJB
  2. which one do you prefer to use HTTPSession or Stateful Session Bean
  3. Without looking at the deployment descriptor how can you say that ejb is stateful or stateless
  4. How can I pass init parameters to enterprise beans?
  5. Can I invoke Runtime.gc() in an EJB?
  6. Can a Session Bean be defined without ejbCreate() method?
  7. Marshalling and unmarshalling?
  8. What is lazy loading
  9. <ejb-link>
  10. Explain the directory structure of a enterprise application
  11. What are the various services provided by the EJB Container
  12. EJB QL

  1. How is Stateful Session bean maintain their states with client
  2. Architecture used by the passivation
  3. Architecture used by the activation
  4. Can you control when passivation occurs?
  5. what are the methods available in session synchronization
  6. Does Stateful Session bean support instance pooling?
  7. In Session Beans can I use BM and CM transaction at a time (NO)
  8. What is abstract schema
  9. Can I map more than one table in a CMP?
  10. Is it possible to update the Primary key of the entity bean
  11. What is a cmr-field. How can I differentiate between a cmr-field and a cmp-field?
  12. What is an ejbSelect() method?
    1. ejbSelect method(s) are not exposed to the client and the ejbSelect method(s) can return values that are defined as cmp-types or cmr-types.
  13. ejbSelect & find

Differences
  1. Instance Pooling & Instance Swapping
  2. ejbActivate & ejbPassivate
  3. ejbLoad & ejbStore
  4. EJB 1.1 and EJB 2.0
  5. CMP1.1 & 2.0
  6. local interface and remote interface
  7. Coarse grained & Fine grained
  8. BMP & CMP
  9. EJB Container & Web Container
  10. Application Server & Web Server
  11. sessioncontext and entitycontext
  12. optimistic locking and pessimistic locking
  13. ejbCreate() and ejbPostCreate().
  14. Servlet Sesison & EJB Session
  15. Container Managed Persitence 1.1 and 2.0
  16. ejbSelect vs finder methods
  17. Context, InitialContext and Session Context?
    1. Context is an interface that provides methods for binding a name to an object
    2. InitialContext is a Context and provides implementation for methods available in the Context interface
    3. SessionContext is an EJBContext object that is provided by the EJB container to a SessionBean in order for the SessionBean to access the information and/or services or the container
  18. Context, InitialContext and Session Context?

Struts
  1. Explain Struts Architecture ?
  2. how will you Internalization
  3. Validation Framework
  4. How do you display validation Errors to the client ?
  5. What is Request Processor ?
  6. Various design patterns used by the Struts Framework
  7. Tell me what all you mention in Struts-config.xml sequentially ?
  8. What are the various Struts tag libraries you used ?
  9. Explain about token feature in Struts ?
  10. Multibox and checkbox ?
  11. purpose of LabelValueBean?
  12. How many ways you can handle the exception/errors?
  13. Calling a Action Class from another Action class

Difference
  1. Action Errors & Action Messages
  2. bean:write vs bean:message ?
  3. DispatchAction & Action, LookupDispatchAction
  4. ActionForm & DynaActionForm
  5. MVC1 & MVC2

Design Patterns

  1. DAO Patterns ,Singleton pattern, Value Object pattern, Session facade pattern , Business delegate pattern, decorator pattern, Factory pattern ,Service Locator pattern ,MVC Architecture
Difference
  1. Pattern & Framework and API & Framework

XML
  1. What is the difference between SAX parser and DOM parser.
  2. What is the difference between Schema and DTD.
  3. How do you parse/validate the XML document.
  4. What is XML Namespace.
  5. What is Xpath.
  6. How would you produce PDF output using XSL's.
  7. What are the steps to transform XML into HTML using XSL.
  8. What is XSL and XSLT.

HTML and Js:
window.history()
form vs document
Types of dialog boxes?
<Html:link>
<html:base>
purpose of <iframe>

how you will return all the objects of a specific element to return ?
SQL

  1. How to create a table (including data) with selected columns of another table?
  2. DDL ,DML and DCL?
  3. Order of order by , group by. Where, having ?
  4. Materialized view ?
  5. Write a query to display n maximum salaries
  6. What are the pseudo columns in oracle? (rowid, rownum)
  7. Difference between procedure and function?
  8. Difference between varchar and varchar2?
  9. Can a table have more than one primary key?
  10. Difference between IN and EXISTS
  11. truncate , drop and delete?
  12. How can we handle exceptions in PL/SQL
  13. Join, Inner joins, Outer Joins
  14. How do you create Index. Advantages of Index
  15. View is physical Database Object or Logical Database object. Can we modify the View ?
  16. What are triggers and types of triggers ?
  17. What is cursor and types?
**********************************************************************************************
**********************************************************************************************
Can we override a constructor if yes, what will happend?
Difference b/w instanceOf and isInstance ?
How can you restrict finally block to not to execute ?
How to make a class immutable ?
Where you will use inner classes ?
In thread creation which mechanism is good and why ?
equals() vs hashCode() ?
Collection vs Collecions ?
Can we serialize static data ?
Can i add duplicate keys/values into hashmap, what will happen ?
I have to do many insert/delete operation on a collection, which one you will use?

.can we have multiple struts-config.xml, how ?

How to configure log4j in your application?
How to configure ResourceBundle in your application?
Levels of loggers?
What all you mention in logger properties?
How to set class level logger ?
ANT means ? Alternatives to ANT ?
Web container and app server ?
Jboss vs Weblogic ?

Authentication vs authorization ?
Tell me Authentication mechanisms by the container ?
What all you will mention in Deployment Descriptor ?
If i have 100 requests hitting a servlet, this scenario how many instances will be created and how ?
How you will count the no.of users accessing an application ?
JAR vs WAR vs RAR ?
Purpose of filters and listeners ?
How to restrict browser cashing ?
How a make a particular JSP to refresh continuously?
Types of comments in JSP(output and hidden) ?
Jspwriter vs Printwriter ?
How to send a mail ?
JNDI ?
What is Ripple Effect?
Post a Comment

Receive All Free Updates Via Facebook.