Wednesday, 14 December 2011

java interview question

OOPS
  • Concepts
Differences
  • aggregation and composition
  • Abstraction and Encapsulation
Java
  • What is static variable. transient variable. volatile variable, final variable.
  • What are the kinds of variables in Java? (Instance, Class, Local)
  • What is method overloading and s method overriding?
  • What is final method, native method. abstract method ?
  • synchronization is to be applied only for?
  • What is anonymous class.
  • What is Adapter classes
  • What are wrapper classes
  • What are different types of inner classes?
  • Can you instantiate the Math class?
  • Can the abstract class be final?
  • Can a top level class be private or protected?
  • Is null a keyword?
  • What is JVM?
  • What is a Tagged interface Interface? Examples ?
  • What do you mean by a Classloader?
  • How will you execute any method of the superclass from the subclass?
  • What is the purpose of the File class?
  • What is the life cycle of an applet.
  • What is Reflection. Uses of Reflection.
  • How do I access environment variables?
  • What does autoboxing and unboxing mean?
  • What are annotations in Java?
  • can you force garbage collection?
  • What is the purpose of finalization?
  • Access Modifiers and access Specifiers ?
  • Hierarchy of exception
  • What are Checked and UnChecked Exception?
  • What are runtime exceptions?
  • What are the different ways to handle exceptions?
  • What is the purpose of the finally clause of a try-catch-finally statement?
  • Does the code in finally block get executed if there is an exception and a return statement in a catch block?
  • What is User defined exception?
  • What are different ways in which a thread can enter the waiting state?
  • What are the various ways of creating a thread
  • Three types of priority? (MAX_PRIORITY which is 10, MIN_PRIORITY which is 1, NORM_PRIORITY which is 5)
  • What is deadlock?
  • Algorithm used in Thread scheduling? (Fixed priority scheduling.)
  • Usually where we use the methods wait(), notify(), and notifyAll() methods?
  • What is the common usage of serialization?
  • How many methods in the Serializable interface and it's package is?
  • What is Externalizable?
  • How many methods in the Externalizable interface?
  • How do I synchronize a collection
  • What interface do you implement to do the sorting?
  • What is a hashCode and where will you use it ?
  • What is HashMap and Map?

Differences
  • JVM and JDK and JRE
  • Abstract class and Interface.
  • Hashmap and Hashtable.
  • Vector, Array and Arraylist.
  • Final, finally and finalized.
  • String and StringBuffer.
  • Exception and error.
  • List, Set and Map.
  • this() & super().
  • Iterator and Enumeration.
  • wait(), join(), sleep(), notify() & notifyall()
  • File and RandomFileAccess classes.
  • paint() and repaint() methods.
  • yielding and sleeping.
  • .equals and ==
  • URL & URI
  • & operator and the && operator?
  • JDBC
  • What are the classes you used in JDBC ?
  • ACID properties
  • What is the purpose of setAutoCommit().
  • What are batch updates and how you will write it?
  • What are the steps for connecting to the database using JDBC.
  • What is Connection Pooling? How do you implement Connection Pooling?
  • What Class.forName() method will do.?
  • What happens if I close the connection twice?
  • What are the standard isolation levels defined by JDBC? (TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE)
  • How do I receive a ResultSet from a stored procedure?
  • Types of Drivers
Differences
  • Statement, PreparedStatement, Callable Statement
  • execute, executeQuery, executeUpdate
  • Resultset and Rowset
  • JDBC 2.0 and JDBC 2.1
  • Why cannot java.util.Date match with java.sql.Date?
JSP
  • Life cycle of JSP.
  • What are Custom tags? And how will implement the custom Tags and how do you configure it.
  • What are the implicit objects in JSP
  • What are the scope attributes & difference between them(level hierarchy of scopes) ?
  • What is difference between scriptlet and expression?
  • How do you handle exception handling in JSP
  • How do you implement thread safe in JSP
  • Tell some of the attributes of Page
  • Can we implement an interface in a JSP?
  • If I want to upload a file what attribute am I going to use in form tag (ENCTYPE="multipart/form-data")
  • 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).
  • What is a translation unit?
  • What is Expression ,is Declaration and Scriptlet?
  • What are Standard Actions in JSP ?
  • Attributes of <jsp:useBean> tag
  • How do I prevent the output of my JSP or Servlet pages from being cached by the browser?
Differences
  • include directive & jsp:include action
  • page vs pagecontext?

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

  • How to you pass parameter using HtppUrlConnection
  • How can I send user authentication information while making URLConnection? (HttpURLConnection.setRequestProperty)
  • How to get the url of the current request
  • What is filter? Why do we need filter and how do you configure filter
  • What is Listener Why do we need listener and how do you configure listener
  • What is Session Tracking? various ways for achieving SessionTracking
  • Various ways of specifying Session Time out ? Mention all the mechanisms?
  • How you will achieve Servlet collabaration ?
  • What is the tag used for specifying the datasource
  • How many cookies can one set in the response object of the Servlet
  • hot many ways a Servlet to Servlet communication ?
  • What is HTTP tunneling
  • Explain the directory structure of a web application.


Differences
  • Servlet and JSP
  • sendRedirect() & forward() method.
  • doGet() and doPost()
  • HTTPServlet and GenericServlet.
  • rd.forward(); or rd.include();
  • request.getAttribute() and request.getParameter()?
  • ServletContext and PageContext
  • ServletContext and ServletConfig?
  • ServletContext.getInitParameter() and HttpServlet.getInitParameter() ?

EJB

  • What is EJB
  • Key Benefits of uisng EJB
  • Different kinds of EJB
  • What is Session Bean
  • What is Entity Bean
  • What is Message driven Bean
  • What are the methods of Entity Bean?
  • What are the callback methods in Entity beans?
  • Can Entity Beans have no create() methods?
  • How EJB Invocation happens?
  • Is it possible to specify multiple JNDI names when deploying an EJB?
  • How many types of protocol implementations does RMI have?
  • Life cycle of EJB's
  • Procedure for writing EJB's
  • what are the call back methods in Session bean
  • What are the call back methods in Entity bean
  • Transaction models
  • Transaction attributes?
  • What is the default transaction attribute for an EJB?
  • Can you create thread in EJB
  • which one do you prefer to use HTTPSession or Stateful Session Bean
  • Without looking at the deployment descriptor how can you say that ejb is stateful or stateless
  • How can I pass init parameters to enterprise beans?
  • Can I invoke Runtime.gc() in an EJB?
  • Can a Session Bean be defined without ejbCreate() method?
  • Marshalling and unmarshalling?
  • What is lazy loading
  • <ejb-link>
  • Explain the directory structure of a enterprise application
  • What are the various services provided by the EJB Container
  • EJB QL
  • How is Stateful Session bean maintain their states with client
  • Architecture used by the passivation
  • Architecture used by the activation
  • Can you control when passivation occurs?
  • what are the methods available in session synchronization
  • Does Stateful Session bean support instance pooling?
  • In Session Beans can I use BM and CM transaction at a time (NO)
  • What is abstract schema
  • Can I map more than one table in a CMP?
  • Is it possible to update the Primary key of the entity bean
  • What is a cmr-field. How can I differentiate between a cmr-field and a cmp-field?
  • 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.
  • ejbSelect & find

Differences
  • Instance Pooling & Instance Swapping
  • ejbActivate & ejbPassivate
  • ejbLoad & ejbStore
  • EJB 1.1 and EJB 2.0
  • CMP1.1 & 2.0
  • local interface and remote interface
  • Coarse grained & Fine grained
  • BMP & CMP
  • EJB Container & Web Container
  • Application Server & Web Server
  • sessioncontext and entitycontext
  • optimistic locking and pessimistic locking
  • ejbCreate() and ejbPostCreate().
  • Servlet Sesison & EJB Session
  • Container Managed Persitence 1.1 and 2.0
  • ejbSelect vs finder methods
  • 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
  • Context, InitialContext and Session Context?

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

Difference
  • Action Errors & Action Messages
  • bean:write vs bean:message ?
  • DispatchAction & Action, LookupDispatchAction
  • ActionForm & DynaActionForm
  • MVC1 & MVC2
Design Patterns
  • DAO Patterns ,Singleton pattern, Value Object pattern, Session facade pattern , Business delegate pattern, decorator pattern, Factory pattern ,Service Locator pattern ,MVC Architecture
Difference
Pattern & Framework and API & Framework

XML
  • What is the difference between SAX parser and DOM parser.
  • What is the difference between Schema and DTD.
  • How do you parse/validate the XML document.
  • What is XML Namespace.
  • What is Xpath.
  • How would you produce PDF output using XSL's.
  • What are the steps to transform XML into HTML using XSL.
  • 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
  • How to create a table (including data) with selected columns of another table?
  • DDL ,DML and DCL?
  • Order of order by , group by. Where, having ?
  • Materialized view ?
  • Write a query to display n maximum salaries
  • What are the pseudo columns in oracle? (rowid, rownum)
  • Difference between procedure and function?
  • Difference between varchar and varchar2?
  • Can a table have more than one primary key?
  • Difference between IN and EXISTS
  • truncate , drop and delete?
  • How can we handle exceptions in PL/SQL
  • Join, Inner joins, Outer Joins
  • How do you create Index. Advantages of Index
  • View is physical Database Object or Logical Database object. Can we modify the View ?
  • What are triggers and types of triggers ?
  • 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?

No comments:

Post a Comment