- PLEASE SHARE TO HELP OTHERS
Here are few J2EE questions (from our website) asked in various companies. These questions are compiled by me (from interviews attended by my friends) and then efficiently copied by all other job sites as if it's their own.
1) Difference between DataElement & DTD ?
2) Difference between Entity beans in EJB 1.1 & EJB 2.0 ?
3) If there are 100 beans in JNDI & the context.lookup() method takes time to lookup. How do you handle the situation to make it easy retrieval of the bean ?
4) Servlet is Java class. Then why there is no constructor in Servlet ? Can we write the constructor in Servlet ?
5) What is a Singleton class. How do you write it ? Tell examples ?
6) Can a JSP be used as controllor in MVC architecture ? If NO, why ?
7) What is the difference between using a HttpSession & a Stateful Session bean ? Why can't HttpSession be used instead of Session bean ?
8) Can we override init() method of a Servlet ?
9) Can we call destroy() method forcefully ?
10)In WebLogic 5.1, how can you make a JSP application work
( a ) By changing the root directory
( b ) By creating a vitual directory in Server console
( c ) By creating a vitual directory in client console
11)Why DB connections are not written directly in JSPs ?
( a ) Response is slow
( b ) Not a standard J2EE architecture
( c ) Load Balancing is not possible
( d ) All the above
( e ) Both ( b ) and ( c )
12)How multiple EJB instances are managed ?
( a ) Connection Pooling
( b ) Caching of EJB instances
( c ) EJB Passivation
( d ) All the above
13)At what stage, the life cycle of a CMP bean can be assumed to be started ?
( a ) before ejbCreate() method is executed
( b ) after ejbCreate() method is executed
( c ) in postCreate() method
( d ) after executing ejbStore()
14)Why beans are used in J2EE architecture in stead of writing all the code in JSPs ?
( a ) Allows separation of roles between web developers and application developers
( b ) Allows integration with Content Management tools
15)How can a Servlet call a JSP error page ?
( a ) This capability is not supported.
( b ) When the servlet throws the exception, it will automatically be caught by the calling JSP page.
( c ) The servlet needs to forward the request to the specific error page URL. The exception is passed along as an attribute named "javax.servlet.jsp.jspException".
( d ) The servlet needs to redirect the response to the specific error page, saving the exception off in a cookie.
16)What is 'Open System' and 'Closed System' in Computer terminology ?
17)What is meant by Open Source ? Is Java Open Source or not ?
18)What are design patterns ? Explain 'FACADE Design Pattern' ?
19)What's the difference between CMM and CMMI ?
20)What is 'Requirements Development' in CMMI ?
21)How do you capture requirements ? Using what method you make sure that requirements are properly captured?
22)What is UseCase ? What is the template to write UseCases ?
23)I have a Web Server, Application Server, Servlet Engine, Database - all located on separate systems behind firewalls. How will you design an application using 3-tier architecture in this case?
24)What is 2-Phase Commit and 3-Phase Commit in database terminology ?
25) Will the 'View' get refreshed immediately when you update a database table. If it doesn't get refreshed immediately, what method you use to refresh it ?
26)How do you implement TREE in Java ? How do you implement the same using C or C++ ?
27) What is the difference between Application and Web servers ?
28)Why native methods are used ?
29)How do you declare a page as Error Page. What tag you include in a JSP page so that it goes to specified error page in case of an exception ?
30)Difference between Include Directive & Include Tag ?
31)Servlet is a java class. So, can there be a constructor in Servlet class or not ? Why ?
32)What's the difference between forward & include tags? What URL (absolute or relative) is used in RequestDispatcher forward ?
33)Is it possible to write methods in JSP ? If so, how ?
34)Difference between JSP & Servlets ?
35)Difference between Hashtable & HashMap ?
36)By default, Hashtable is unordered. Then, how can you retrieve Hashtable elements in the same order as they are put inside?
37)ejbActivate() Vs ejbPassivate()
38)ejbCreate() Vs ejbPostCreate()
39)ejbLoad() Vs ejbStore()
40)Which type of EJB can use bean pooling ?
41)How can you call an EJB from a JSP/Servlet ?
42)How to configure Data Source in WebSphere server ?
43)Oracle Thin Driver comes under which type of Driver ?
44)I have a file of very very large file size at client side, and I have a JSP page. Using this JSP page, if I want to send the file to a servlet (this servlet will store it somewhere), what is the best method to do it ?
45)What is the difference between normal beans and EJBs ?
46)How system level services in EJBs are managed ? And tell about Deployment Descriptor ?
47)What are various types of EJBs ?
48)Can a JSP be converted to SERVLET and the vice versa always ?
49)To denote distributed applications, What is the tag used in Deployment Descriptor ?
( a ) distributable
( d ) distributed="true"
( c ) both a & b
50)In EJB, which of the following is an application level Exception ?
( a ) NullPointerException
( b ) ArrayOutOfBoundsException
( c ) CreateException
( d ) ObjectNotFoundException
( e ) All the above
( f ) None of the above
51)CMP bean provides
( a ) Empty implementation of ejbLoad() and ejbStore()
( a ) Concrete implementation of ejbLoad() and ejbStore()
52)Which bean can be called as Multi-Threaded bean ?
( a ) Entity beans
( b ) Stateless Session beans
( c ) Stateful Session beans
( d ) Pooled Stateless Session beans
53)A question on Threads in Java, whether we need to mention the word "Daemon" explicitly to make a thread as Daemon.
54)What is the difference between Server and Container
( a ) A Container can have multiple Servers
( b ) A Server can have multiple Containers
( c ) A Server can have only one Container
55)ejbStore() method is equivalent to
( a ) SELECT
( b ) INSERT
( c ) UPDATE
( d ) DELETE
56)What are the methods of authorization in jsp or servlets?
57)What is webapplication?
58)What are the various methods of declaring a TLD in a taglib directive in jsp?
59)What is TLD?
60)Implicit objects of jsp are available in destroy() method or not?
61)What is translation unit in jsp?
62)What is context in webapplication?
63)What are multiple and single processor servers? How session is handled When the server is multi processor server?
64)If server crashes the threads will continue running or will they stop? what happens to the sevlet?
65)If we want to change the entire path of the server ,where should we touch in a application server?
66)What are the types of servlet containers?
67)What is web.xml?
68)What is pooling of sevlets?
69)What is SAX?
70)What is the difference between SAX and DOM?
71)What is the difference between RequestDispatcher.forward(request req,response res)
72)What are implicit objects in jsp?
73)Why cocoon ?why not struts?what is cocoon?
74)If u have a single table in database how to normalize it?
75)What is the difference between checked exception an runtime exception?
76)Difference between Vector and ArrayList other than Synchronization?
77)Difference between HashMap and HashTable?
78)What is context?
79)Difference between application server and webserver ?
80)Can we have a try without catch and with a finally?
81)What is the use of having finally?
82)If there is
Then finally will execute or not?
83)what is the superclass of an exception?
84)Is servlet threadsafe?
85)Sleep() throws which exception?
86)When JSP code changes, how the Servlet is reloaded ?
87) Which is effective in SAX & DOM parsers ?