File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Mock questions required answers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply locked New topic
Author

Mock questions required answers

junaid rehman
Greenhorn

Joined: Jun 17, 2001
Posts: 16
Asalam O Alikum
I need the response in terms of answers and reasons .
1) When designing a distributed system, remote access to fine-grained objects should be avoided. Why?

a) Thinner clients are possible with coarse-grained objects.

*b) Fine-grained objects result in increased network traffic.

*c) Fine-grained objects are hard to develop and maintain.

Multiple Select - Please select all of the correct answers (this question has 2 correct choices).


2) Which one of the following statements describes the design that BEST leverages the J2EE architecture?

a) Clients install Swing components on their system which interact via RMI with EJBs on the server, EJBs interact with backend services such as databases.

b) Clients view applets in web browsers, servlets service the client requests on the server and interact with backend services such as databases.

* c) Clients view HTML in web browsers, JSP pages service the client requests and interact with EJBs on the server, EJBs interact with backend services such as databases.

d) Clients view HTML in web browsers, CGI scripts service the client requests on the server and interact with EJBs on the server, EJBs interact with backend services such as databases.

Single Select - Please select the best answer (one and only one choice must be selected).

3) A Proxy design pattern is one where a surrogate or placeholder for an object is used to communicate with an object that is not locally available. Which of the following J2EE technologies use proxies that are visible to a developer?

* a) JNDI

* b) RMI

c) JSP

d) EJB

Multiple Select - Please select all of the correct answers (this question has 2 correct choices).

4) Which of the following statements accurately describe the J2EE architecture?


a) Web components provide presentation logic that works well with anonymous clients over the Internet.

b) EJBs provide business logic within the context of transactions and persistence.

c) Web components access EJBs through the same APIs as application clients.

d) Application servers provide the infrastructure for the J2EE architecture.


Multiple Select - Please select all of the correct answers.

5) A servlet counts the number of times it has been called using an incrementCount() method. During testing, the developer verifies that the servlet accurately counts the requests from a number of clients. Which of the following BEST explains this fact?

a) The web or application server supports activation and passivation of the servlet.

b) The HttpServlet class is designed to share state data across all its instances.

*c) The same servlet instance services all the requests.

d) The servlet doGet( ) method has been marked as synchronized.

Single Select - Please select the best answer (one and only one choice must be selected).

6) Which of the following are true with respect to state management in a web application?

a) Type of database ( DB2 UDB, Oracle, Sybase, or InstantDB )

*b) URL Rewriting is an alternative to using cookies.

*c) URL Rewriting does not require any client side configuration.

d) HttpSession information is available to JavaScript code in a web page.
Multiple Select - Please select all of the correct answers (this question has 2 correct choices).

7) Implementing the SingleThreadModel interface :
a) requires all servlet methods be declared as synchronized.

b) guarantees that synchronization problems will never occur.

* c) may have a negative impact on performance.

* d) prevents multiple HTTP request threads from accessing a single servlet instance concurrently.
Multiple Select - Please select all of the correct answers (this question has 2 correct choices).

8) Which of the following implicit page objects are available for a JSP error page, that is, one with an "isErrorPage=true" page directive?

* a) application

* b) throwable

c) exception

* d) config

Multiple Select - Please select all of the correct answers (this question has 3 correct choices).

9) When comparing servlets and JSPs, which of the following are true?

a) JSPs provide better performance than servlets.

* b) JSPs may call servlets and servlets may also call JSPs.

* c) A JSP must be compiled into a servlet before it can be used.

d) Initialization and destruction behavior is supported in both servlets and JSPs.

Multiple Select - Please select all of the correct answers (this question has 2 correct choices).

10) Most web applications require logic for validating form input and determining the next page to display. Given long term maintenance and reuse objectives, what is the BEST design to implement this logic?

a) A JSP that both validates form input and determines the next page.

* b) Validate form input in a JSP and determine the next page in a servlet.

c) Validate form input in a servlet and determine the next page in a JSP.

d) A servlet both validates form input and determines the next page.

Single Select - Please select the best answer (one and only one choice must be selected).

11) Whose responsibility is it for providing an implementation for the home interface of an EJB?

a) The application assembler.

b) The bean developer.

* c) The container and its tools.

d) The bean deployer.

Single Select - Please select the best answer (one and only one choice must be selected).

12) An EJB client has no current transaction. It invokes the business method of an EJB using container-managed transaction demarcation. The business method executes within the scope of a transaction. Which of the following are possible values for the bean method's transaction attribute?
a) NotSupported

b) Supports

c) Required

d) RequiresNew

e) Mandatory

Multiple Select - Please select all of the correct answers (this question has 2 correct choices).

13) Which of the following are true regarding BMP Entity beans?

* a) Persistent fields can be declared private.

b) The ejbFindByPrimaryKey() method returns void.

c) Finder methods are implemented at deployment time.

* d) A record should be inserted into the database during ejbCreate().

Multiple Select - Please select all of the correct answers (this question has 2 correct choices

14) Which of the following is true concerning CMP Entity bean activation and passivation?

* a) Storage of persistent state to the database is handled automatically by the EJB container during passivation.

b) A client must explicitly activate a bean that has been passivated.

c) Clients do not directly communicate with a bean and are unaware of activation and passivation.

Single Select - Please select the best answer (one and only one choice must be selected

15) A stateful Session bean is to be created. Which of the following objects are necessary?

a) A primary key.

*b) A home interface.

*c) A bean class.

d) A passivation class.

Multiple Select - Please select all of the correct answers (this question has 2 correct choices).

16) A stateful Session bean is being passivated by its container. Assuming all fields are non-transient, which of the following values will still exist following passivation?

*a) null.

b) A JDBC Connection.

* c) An Entity bean.

* d) A SessionContext.

* e) A UserTransaction.

Multiple Select - Please select all of the correct answers (this question has 4 correct choices).

17) An EJB business method performs an operation that throws a checked exception. The bean cannot recover from this checked exception and should rollback. The bean will be deployed using container-managed transaction demarcation. Which implementation is the BEST?

a) public void businessMethod() { try { // operation throwing SomeCheckedException goes here } catch (SomeCheckedException ae) { throw new EJBException(ae); } }

b) public void businessMethod() { try { // operation throwing SomeCheckedException goes here } catch (SomeCheckedException ae) { context.setRollbackOnly(); throw new EJBException(ae); } }

c) public void businessMethod() throws EJBException { try { // operation throwing SomeCheckedException goes here } catch (SomeCheckedException ae) { throw new EJBException(ae); } }

* d) public void businessMethod() throws EJBException { try { // operation throwing SomeCheckedException goes here } catch (SomeCheckedException ae) { context.setRollbackOnly(); throw new EJBException(ae); } } }

Single Select - Please select the best answer (one and only one choice must be selected).

18) In what manner is a reference to an Entity Bean obtained by a client?

a) Invoking the zero-argument public constructor of the bean.

* b) Invoking the appropriate create() method of the home interface.

c) Invoking the newInstance() method of the home interface.

d) Invoking the newInstance() method of the bean class.

Single Select - Please select the best answer (one and only one choice must be selected).

19) What steps does a J2EE developer need to use to get a reference to an existing EJB's home?

* a) Get a remote reference to the EJB home by using the JNDI Context lookup() method, passing the name of the EJB's home.

b) Use the RMIRegistry lookup() method to get a remote reference to the EJB home.

* c) Cast the EJB home remote reference to the right type by using the PortableRemoteObject.narrow() static method, passing the remote reference and the class of the EJB home.

* d) Cast the remote object reference to the right type within Java.

Multiple Select - Please select all of the correct answers (this question has 3 correct choices).

20) Which of the following is true concerning the use of UserTransaction?

* a) Stateless Session beans must start and end a UserTransaction within one method, since they service multiple clients.

b) Stateful Session beans must start and end a UserTransaction within one method, since they service multiple clients.

c) A UserTransaction for stateless Session beans can span methods, since they service only one client.

* d) A UserTransaction for stateful Session beans can span methods, since they service only one client.

Multiple Select - Please select all of the correct answers (this question has 2 correct choices).

21) A JMS Message is composed of which of the following parts?
*a) Header

* b) Properties

* c) Body

d)Footer
Multiple Select - Please select all of the correct answers (this question has 3 correct choices).

22) A developer is using a DBConnectionPool to work with a database. While running, a DBException is thrown. What are possible causes?

a) The pool has reached its maximum number of connections and cannot create more.

b) No maximum was specified for the pool

*c) The pool needs to be reinitialized

d) The pool was not initialized

Single Select - Please select the best answer (one and only one choice must be selected).

23) An instance of the Person class, whose definition is given below, is returned from a remote method invocation in RMI. An exception is thrown. Why? public class Person extends Object { private String name; public String getName() { return name; } public String setName(String newName) { name = newName; } }

a) Person does not implement the java.io.Serializable interface

b) Person does not implement the RemotePerson interface

c) The class was not precompiled with rmic

d) The class does not extend java.rmi.server.UnicastRemoteObject}

Single Select - Please select the best answer (one and only one choice must be selected).

24) An application accepts input from a user and invokes a function on a server. The client knows where the server resides and the client can be implemented on any platform. The client cannot continue processing until the server has returned. Application development productivity is more of a concern than end user application performance. The server code is implemented in C. What middleware solution BEST fits this situation?

a) Servlets

* b) CORBA

c) RMI

d) EJBs

25) A JMS session:

* a) can implement the QueueSession interface to support the publish-subscribe model.

b) can implement the TopicSession interface to support the publish-subscribe model.

c) can implement the QueueSession interface to support the point-to-point model.

* d) can implement the TopicSession interface to support the point-to-point model.

Multiple Select - Please select all of the correct answers (this question has 2 correct choices).

26) Which one of the following Statement class' methods is BEST used when deleting a row from a database?

a) execute()

b) executeUpdate()

c) executeDelete()

* d) executeQuery()}

Single Select - Please select the best answer (one and only one choice must be selected).

27) Deployment-specific information for an EJB is located in:

a) the bean class's BeanInfo class.

b) the properties variable of the home interface.

*c) an XML deployment descriptor.

d) the server's ejb.properties file.
Single Select - Please select the best answer (one and only one choice must be selected).

28) Which of the following MUST be declared for a CMP Entity Bean in its deployment descriptor?

*a) Bean class.

b) Database connection factory reference.

* c) Home and remote interfaces.
* d) Primary key class.

Multiple Select - Please select all of the correct answers (this question has 3 correct choices).

29) A developer buys a set of third party EJBs. Which of the following are included in the EJB .jar file?

* a) Bean classes.

* b) Remote interfaces.

* c) Home interfaces.

d) Source code.

Multiple Select - Please select all of the correct answers (this question has 3 correct choices).

30) Transaction isolation levels in EJBs are:

* a) set by the bean developer for bean-managed transactions.

* b) set by the deployer for container-managed transactions.

c) specified to the method level.

d) specified to the class level only.

Multiple Select - Please select all of the correct answers (this question has 3 correct choices).

31) In deployment descriptors, security roles and method permissions:

a) can be shared across EJBs.

b) can utilize wildcard characters to authorize multiple methods at one time.

c) can be defined during deployment.

d) are mapped to actual user groups during deployment.


Multiple Select - Please select all of the correct answers (this question has 3 correct choices).
Allah Hafiz
Ram Dhan Yadav K
Ranch Hand

Joined: Aug 13, 2001
Posts: 321
Hi Hafiz,
Javaranch policy is to post one question for one post. If you have 31 questions you should post 31 posts. That would be easy for the answers. Any bartender!!


Ram Dhan Yadav (SCJP, SCWCD, SCJA-I, IBM EC(483))
"We are what we repeatedly do. Excellence, then, is not an act, but a habit."
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Posting 31 questions is getting a little carried away. Unless the questions are really closely related, they should be in separate threads. I would also suggest that flooding the forum with questions isn't a good idea either. Why not start with the question you are most confused about and post that one. See how the answers go and then post another.
Meanwhile I am closing this thread because I was getting dizzy just scrolling through your post.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
Don't get me started about those stupid light bulbs.
 
subject: Mock questions required answers