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 please answer these sun j2ee test questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "please answer these sun j2ee test questions" Watch "please answer these sun j2ee test questions" New topic
Author

please answer these sun j2ee test questions

pareshan sunny
Greenhorn

Joined: Feb 23, 2003
Posts: 1
Guys,
I am new to this forum, heard a lot about it.
I am preparing for j2ee exam from sun, would really appreciate if you expert guys can answer these questions for me.
I have answers for most of them, just want to double check where i stand.
would really appreciate help from experts like you.

i will also appreciate if you can give me more tips to face the exam.

Thanks.

*****Questionnaire****
Q 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.

select 2 choices



Q 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

select 1

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

select 3

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

select 1

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


select 1


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

select 3

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


Select 1

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

Select 1

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

select 3


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

select 1


Q. Which of the following are TRUE with respect to state management in a web application?

A. It is impossible to determine whether cookies have been enabled on a client browser.

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.

select 2



Q. An 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.

select 2

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

select 1

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

select 3


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

select 2


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


select 2



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

select 1


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

select 2

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

select 3

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

select 2

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

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

select 3
Q. 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.

select 2


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

select 4


Q. 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); } } }}

select 1.

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

select 2
Debashish Chakrabarty
Ranch Hand

Joined: May 14, 2002
Posts: 230

Hi,
Wouldn't it be better if you use you real name Sunny? You would be less pareshaan with a non-fictitious name . Just an advice..why not edit your post to mark the answers you think are correct..
Regards,


Debashish
SCJP2, SCWCD 1.4, PMP, ITIL Foundation
Naveen Sharma
Ranch Hand

Joined: Mar 23, 2001
Posts: 65
hi sunny
thanks for questionnair
Navi
Debashish Chakrabarty
Ranch Hand

Joined: May 14, 2002
Posts: 230

Hi Sunny,
May I suggest editing your post and allot a number to each question so that folks can answer without quoting the whole questions. I start with few of my answers.

Q (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.
select 2 choices

The basic idea is -- network hops are expensive and hence these should be minimised. My bet on B & C.

Q (2) 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
select 1

Who else but (B) the EJB Developer

Q (3) 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.
select 3

Option B is incorrect.

Q4 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.
select 1

Though Option A is luring, my bet on Option C

Q5 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.
select 1

ummm..I would go for Option B
Debashish Chakrabarty
Ranch Hand

Joined: May 14, 2002
Posts: 230

Folks I couldn't do better than this. Awaiting comments, corrections and answers to the questions left out...

Q6 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.
select 3

All except the source code??

Q7 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
Select 1

My vote for A..but I am not at all sure about this.

Q8 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
Select 1

I would go for C. Point A seems irrelevent, B is incorrect and D is wrong too since we donot know whether the incrementCount() method is written inside doGet().

Q9 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
select 3

A & B seem correct. And D is certainly true.

Q10 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.
select 1

Answer is C

Q11 Which of the following are TRUE with respect to state management in a web application?
A. It is impossible to determine whether cookies have been enabled on a client browser.
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.
select 2

A & D are obviously wrong and B is obviously correct. So I go for B & C.

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

B & C are correct..right?

Q13 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.
select 1

D seems to be the best choice since there is no "presentation" logic involved in validating form data and in navigating to appropriate page after validation.

Q14 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
select 3

All except B

Q15 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
select 2

(B)RMI certainly follows the pattern as does (D)EJB..ok?

Q19. 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.
select 3

A, C and D

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

D is obviously correct and A is not. Option B is luring but I would rather go with C. My answers C & D.

Q22. 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
select 3

application and config implicit objcets are available to any JSP page. When "isErrorPage=true" the exception object is also made available to the JSP. So my answer: A,C & D.

Q 24. 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.
select 4

Option B can be safely knocked out
Regards,
[ February 25, 2003: Message edited by: Debashish Chakrabarty ]
Michael Arndt
Greenhorn

Joined: Feb 25, 2003
Posts: 21

Q (2) 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
select 1
Who else but (B) the EJB Developer

Hmmm, you sound quite sure, but did you really ever write a home interface implementation? Or a remote interface implementation? My guess would be the CONTAINER (C).
Regards, Michael
Rufus BugleWeed
Ranch Hand

Joined: Feb 22, 2002
Posts: 1551
Where did you get these question from?
james edwin
Ranch Hand

Joined: Nov 22, 2001
Posts: 393
Hi,
I think above questions are from IBM sample test for exam number 483.(I am 100 % sure on this from my side)
No need to put questions like this.If any one has any problem,he/she can raise a discussion on that topic,but it should not be direct questions..?


Regards,
James
Debashish Chakrabarty
Ranch Hand

Joined: May 14, 2002
Posts: 230

Originally posted by Michael Arndt:

Hmmm, you sound quite sure, but did you really ever write a home interface implementation? Or a remote interface implementation?

You're right Michael . A bit of over-confidence from my side, I suppose
We simply define the methods in the home interface. The EJB container provides the implementation. On the other hand, the remote interface requires an implementation and this is supplied by the EJB programmer. So the correct answer to Q(2) should really be C.
And apropos the last 2 posts I wonder if my decision to try answer these questions was wrong If the questions are sample questions why such a hue and cry.
[ February 25, 2003: Message edited by: Debashish Chakrabarty ]
Dana Hanna
Ranch Hand

Joined: Feb 28, 2003
Posts: 227
pareshan sunny - this isn't exactly the way to learn anything. If I want to take a test, I'd go take a sample test myself.
If you have trouble with a specific question, let us know!
[ March 01, 2003: Message edited by: Dana Hanna ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: please answer these sun j2ee test questions