Friday

Computer Associates Placement Papers

Test Pattern:
Paper1: 40 J2EE Questions (50 minutes)
Paper2: 40 JAVA Questions (50 minutes)

All questions are multiple-choice !

J2EE PAPER:
1. What exception is thrown when Servlet initialization fails ?

(a) IOException
(b) ServletException
(c) RemoteException

ANS: (b)

2. 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.

ANS: (c)

3. What is the key difference between using a <jsp:forward> and HttpServletResponse.sendRedirect()?

(a) forward executes on the client while sendRedirect() executes on the server.
(b) forward executes on the server while sendRedirect() executes on the client.
(c) The two methods perform identically.

ANS: (b)

4. 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

ANS: (a)

5. 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)

ANS: I think answer is (e). I am not sure whether response from database is slow just because we include the database access code in JSP page.

6. How multiple EJB instances are managed ?

(a) Connection Pooling
(b) Caching of EJB instances
(c) EJB Passivation
(d) All the above

ANS: I think answer is (d)

7. 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()

8. Lot of Questions on "EJB Transactions" and how to manage them.

9. In JSP, how can you know what HTTP method (GET or POST) is used by client request ?

(a) by using request.getMethod()
(b) by using request.setMethod()
(c) impossible to know

ANS: (a)

10. What is legal about JSP scriplets

(a) A loop can begin in one Scriptlet and end in another
(b) Statements in Scriptlets should follow Java Syntax
(c) Semicolon is needed at the end of each statement in a Scriptlet
(d) All the above

ANS: (d)

No comments: