Computer Associates Placement Question Papers
Computer Associates Placement Question Papers
J2EE PAPER:
——————————————————————-
1. What exception is thrown when Servlet initialization fails ?
(a) IOException
(b) ServletException
© 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.
© 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: ©
——————————————————————-
3. What is the key difference between using a
(a) forward executes on the client while sendRedirect() executes on the server.
(b) forward executes on the server while sendRedirect() executes on the client.
© 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
© Load Balancing is not possible
(d) All the above
(e) Both (b) and ©
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
© 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
© 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()
© 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
© Semicolon is needed at the end of each statement in a Scriptlet
(d) All the above
ANS: (d)
——————————————————————-
11. Which method is called first each time a Servlet is invoked ?
(a) Start()
(b) Run()
© Servive()
(d) init()
ANS: (d)
12. The time between Command Execution and Response is called ______
(a) Granularity
(b) Latency
© Lag time
ANS: ©
13. 2 Questions on RMI and EJB related (I don’t reemember them)
——————————————————————-
14. Purpose of
(a) used to incorporate Java applets into a Web page.
(b) Downloads a plugin to the client Web browser to execute an applet or Bean.
© Both (a) & (b)
ANS: ©
15. Difference between
ANS:
——————————————————————-
16. Which of the following is true ?
(a) Unlimited data transfer can be done using POST method
(b) Data is visible in Browser URL when using POST method
© When large amounts of data transfer is to be done, GET method is used.
ANS: (a)
——————————————————————-
17. EJB class should implement
(a) javax.ejb.EntityBean
(b) javax.ejb.rmi
© javax.ejb.EJBHome
(d) javax.ejb.EJBObject
ANS: I think the answer is (a)
——————————————————————-
18. Generally Servlets are used for complete HTML generation. If you want to generate partial HTMLs that include some static text (This should not be hard coded in Servlets) as well as some dynamic text, what method do you use ?
(a) Serverside includes
(b) JSP code in HTML
© Not possible to generate incomplete HTMLs using Servlets
(Note: I don’t remember the question word to word. But it is similar to what I have given)
——————————————————————-
19. Which of the following can not be used as the scope when using a JavaBean with JSP?
(a) session
(b) application
© request
(d) response
ANS: (d)
——————————————————————-
20. Which is true about Servlets
(a) Only one instance of Servlet is created in memory
(b) Multi-Threading is used to service multiple requests
© Both (a) & (b)
ANS: I think the answer is ©
——————————————————————-
21. What is Temporary Servlet ?
(a) Servlet that is destroyed at run time
(b) Servlet that exists for a session
© Servlet that is started and stopped for each request
ANS: ©
22. Although it is not commonly done, what will you do if you want to have multiple instances of Servlet in memory and if they have to share the execution of a user request ?
(a) Defnie Single Thread model
(b) Cannot be done
(Note: I don’t remember the question & answers word to word. But it is similar to what I have given)
23. 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
© By creating a vitual directory in client console
JAVA PAPER:
I don’t remember Java questions because most of them are programs and the outputs are asked.
I should say question are very difficult and confusing when compared to J2EE questions.
You should be thorough with following topics, as most of the questions & programs are from these.
* Threads, Synchronization, Thread Monitors
* AWT & SWING Layouts (Border Layout)
* Try, Catch, Finally
* Switch statements (Some question on “default” option of Switch)
* Java Exceptions
* Scope (Public, Private, protected)
* Inner & Outer classes
* Strings & StringBuffers
* Serialization
* Applets
* Abstract Classes & Interfaces
* Static classes & methods