You are on page 1of 32

ADVANCE JAVA – J2EE ARCHITECTURE

1. Which of the following does the J2EE platform consist of?

a) Services
b) APIs
c) Protocols
d) All of the listed options
2. Where does enterprise components run in J2EE multitiered Applications?(Choose 2)

a) Client tier
b) J2EE server
c) EIS server
d) IIS
e) None of the listed options
3. Which of the following gives the services provided by container?

a) lifecycle management

b) deployment

c) security

d) threading

e) All of the listed options

4. Where does web tier components run in J2EE multitiered Applications?

a) Client tier

b) J2EE server

c) EIS server

d) IIS

e) None of the listed options

5. Which of the following Transaction interface allows operations to be performed
against the transaction in the target Transaction object and to start a transaction
explicitly?

a) Use package javax.transaction

b) Use interface javax.transaction.TransactionManager
c) Use interface javax.transaction.Transaction

d) User interface javax.transaction.UserTransaction

6. In J2EE packaging and deployment process, which of the role below creates and
modifies the deployment descriptor?

a) Application component provider

b) Application assembler

c) Application deployer

d) System administrator

7. What object will the component create to look up the environment naming context in
InitialContext under the name java:comp/env?

a) java.naming.InitialContext

b) javax.naming.Context

c) javax.naming.InitialContext

d) javax.naming.Namingcontext

8. J2EE, the Java 2 Enterprise Edition, is __________________________________.

a) an improved version of the Java 2 Standard Edition for business professionals.

b) a development environment, designed for creating enterprise applications.

c) a platform for enterprise class level, distributed applications.

d) a replacement of the Java Virtual Machine for running internet applications.

9. Which of the following HttpServlet class method provides a way to determine when a
resource has been last modified?

a) POST

b) HEAD

c) GET

d) DATE

10. Which of the following can be considered as types of J2EE clients?
a) Applets

b) Application clients

c) Java Web Start-enabled rich clients

d) Wireless clients

e) All of the listed options

11. Consider the following scenario:

Server A does not have graphical display options so that the installation has to happen
as command-line installation.

Which of the following is used by installer to run from the command line, to specify the
configuration set, during the installation?
a) installGroup and installpath options

b) installType and installpath options

c) installGroup and installLocation options

d) installGroup and installsite options

e) installState and installsite options

12. Consider the following scenerio about the the JBoss top-level directory structure:

Statement A: bin directory specifies all the entry point JARs and start scripts included
with the JBoss distribution.
Statement B: The lib directory contains startup JARs used by JBoss.

Which of the following is applicable for the above?

a) Statement A and B both are true

b) Statement A is true and B is false

c) Statement A is false and B is true

d) Statement A and B both are false

13. Which of the following element is used to specify useful information about
initialization parameter of a servlet in the deployment descriptor and is also an optional
tag?

a) param-description

b) description

c) info

d) param-info
e) init-param-info

14. Which of the following is the deployment descriptor file of a web application?

Assuming that the name of the Web application is BankApp.

a) BankApp.xml

b) WebApp.xml

c) server.xml

d) deployment.xml

e) web.xml

15. Which of the following best represents the sequence of events in a servlet lifecycle?

a) class instantiation,
class loading,
service method,
init method,
delete method

b) class loading,
class instantiation,
service method,
init method,
delete method

c) class loading,
class instantiation,
service method,
init method,
destroy method

d) class loading,
class instantiation,
init method,
service method,
delete method

e) class loading,
class instantiation,
init method,
service method,
destroy method

16. Which of the following JSP tags can be used to print the value of an expression to
the output stream? (Choose 2)
a) <%@ %>

b) <%! %>

c) <% %>

d) <%= %>

e) <%-- --%>

17. Assuming that a JSP page has never been called or loaded before, which of the
following will not occur before the first time the _jspService method is executed?

a) jspInit(); will be called

b) translation from JSP to servlet source.

c) the container supplies a ServletConfig reference

d) execution of the doJsp method

e) class instantiation

18. Which of the following is a correct JSP declaration for a variable of class
java.util.Date?

a) <%! Date d = new Date() %>

b) < %@Date d=new Date()% >

c) <%! Date d = new Date(); %>

d) <%$ Date d = new Date() %>

19. Consider the following steps:

1. Restore view phase
2. Apply request values phase
3. Process validations phase
4. Update application values phase
5. Invoke application phase
6. Render request phase
Select two answers:

Which of the above steps are NOT part of the lifecycle steps of JSF framework?
Choose from the following options.

a) 1 and 2

b) 2 and 3

c) 1 and 4
d) 4 and 6

e) 2 and 6

20. Consider the following statements:

Statement A: A backing bean is any bean that is referenced by a form
Statement B: Backing Beans should be defined only in the session scope
Statement C: A managed bean is a backing bean that has been registered with JSF (in
faces-config.xml) and it automatically created (and optionally initialized) by JSF when it
is needed.
Statement D: The managed beans that are created by JSF can be stored within the
request, session, or application scopes

Which of the above statement is NOT true about Backing Beans and Managed Bean in
JSF framework?
Choose from the following options.

a) Statement A is false

b) Statement B is false

c) Statement C is false

d) Statement D is false

21. In the process of Installation of Jboss Server, starting configuration determines
which sets of packages are available for installation.
User wants to install a package with the description given below:
“An EJB3 profile supporting the full EJB3 specification with Tomcat”

Which server configuration set the user has to select from the following at the time of
installation to fullfil the above stated specification?

a) ejb3

b) ejb3-clustered

c) tomcat

d) minimal

e) portal

22.Consider the following scenerio:

If, at the time of starting the Jboss server, the user wants to start the server with an
minimal configuration file set instead of default server configuration file set, what
command will the user need to type on the command line to achieve the desired result?

a) $ ./run.sh -c minimal

b) $ ./run.sh -d minimal
c) $ ./run.sh -b minimal

d) $ ./run -c minimal

23. Consider the following HTML page code:

<html><body>
<a href="/servlet/HelloServlet">POST</a>
</body></html>
Assume that there is a HelloServlet servlet Class defined.

Which method of HelloServlet class will be invoked when the hyperlink displayed by the
above page is clicked?

a) doGet

b) doPost

c) doForm

d) doHref

e) serviceGet

24. Consider the following code for an HTML form.

<form action=”/servlet/Login”>
<input type=”text” name=”username” value=”enter username”/>
<input type=”submit” name=”sbbutton” value=”signin!..”/>
</form>

Which of the following happens upon pressing the submit button in the above HTML
form?(Choose 2)

a) a request is sent with the HTTP method GET

b) a request is sent with the HTTP method POST

c) The parameter username is the only parameter passed to the web server in the request

d) The parameters username and sbbutton are passed to the web server in the
request URL

e) The parameters username and sbbutton are passed to the web server as part of the
request body.

25.What will be the output of the following partial servlet code?(Choose 2)

public void doGet(HttpServletRequest request,HttpServletResponse)throws
ServleException,IOException
{
response.setContentType(“text/plain;charset-UTF-8”);
printWriter out=response.getWriter();
out.flust();
out.close();
System.out.println(response.isCommitted());
Response.setContentType(“illegal/value”);

}
a) An illegalArgumentException is thrown

b) A blank page is returned to the client

c) A 500 error is reported to the client

d) “true” is output on the servlets console

e) “false” is output on the server’s console

26. Consider the following JSP page code:

<html>
<body>
<%! int aNum=5 %>
The value of aNum is <%= aNum %>
</body>
</html>

What will be the output of the above code?

a) It will print "The value of aNum is 5" to the output

b) It will flag a compile-time error because of an incorrect declaration.

c) It will throw a runtime exception while executing the expression.

d) It will not flag any compile time or runtime errors and will not print anything to the output

27.Consider the following JSP page code:

<HTML>
<HEAD></HEAD>
<BODY>
<%
for(int i=0; i<3; ++i){
%>
out.print(i);
<%
}
%>
</BODY>
</HTML>
What will be the output of above code?

a) Does not compile

b) 1 2 3

c) 2 3 4

d) out.print(i);out.print(i);out.print(i);

e) 0 1 2

28. In JSF framework, which of the following Standard Converters have their own tags?
(Choose 2)

a) CharacterConverter

b) DateTimeConverter

c) DoubleConverter

d) FloatConverter

e) NumberConverter

29. Consider the scenario:

“A login page, after the login gets successful, it should go to Main page, else to return
on the same login page”

Which of the following declaration of navigation rule in JSF fulfils the above?

a) <navigation-rule>

<fromview-id>/login.jsp</fromview-id>
<navigation-case>
<from-outcome>login</from-outcome>
<toview-id>/main.jsp<toview-id>
</navigation-case>

<navigation-case>
<from-outcome>fail</from-outcome>
<toview-id>/login.jsp<toview-id>
</navigation-case>
</navigation-rule>

b) <navigation-rule>

<from-viewid>/login.jsp</from-viewid>
<navigation-case>
<from-outcome>login</from-outcome>
<to-viewid>/main.jsp<to-viewid>
</navigation-case>

<navigation-case>
<from-outcome>fail</from-outcome>
<to-viewid>/login.jsp<to-viewid>
</navigation-case>
</navigation-rule>

c) <navigation-rule>

<from-view-id>/login.jsp</from-view-id>
<navigation-case>
<from-outcome>login</from-outcome>
<to-view-id>/main.jsp<to-view-id>
</navigation-case>

<navigation-case>
<from-outcome>fail</from-outcome>
<to-view-id>/login.jsp<to-view-id>
</navigation-case>
</navigation-rule>

d) <navigation-rule>

<from-view-id>/login.jsp</from-view-id>
<navigation-case>
<from-outcome>login</from-outcome>
<to-view-id>/main.jsp<to-view-id>
<from-outcome>fail</from-outcome>
<to-view-id>/login.jsp<to-view-id>
</navigation-case>
</navigation-rule>

30. Consider the following statement about JSF framework:

While using JSF framework to create an application, error messages for all the
components can be displayed at a place using "messages" tag. It supports two
layouts___(1)___and ___(2)_____ and ___(3)___ is the default layout for the messages
tag.

Select one of the following options which will replace the positions (1),(2) and (3) in the
above statement.

(1) singleline (2) list (3) list
(2) table (2) multiline (3) multiline

(1) table (2) list (3) list

(1) table (2) border (3) list

31. Raju and his team are creating an Enterprise level application.

Which of the following driver should they use to get connected to the database?

a) Type 1 Driver

b) Type 2 Driver

c) Type 3 Driver

d) Type 4 Driver

32.From the following given options select a correct way to load the driver, register the
driver and get the connection object using system properties.

a) Load the driver:
java –L jdbc.drivers=sun.jdbc.odbc.JdbcOdbcDriver SampleApplication

Get Connection:

String url = "jdbc:odbc:MyDataSource";
Properties p = new Properties();
p.addProperty("user","NewUser");
p.addProperty("password","NewPassword");
Connection con = DriverManager.getConnection(url,p);

b) Load the driver:
java –Djdbc.drivers=sun.jdbc.odbc.JdbcOdbcDriver SampleApplication

Get Connection:

String url = "jdbc:odbc:MyDataSource";
Properties p = new Properties();
p.setProperty("user","NewUser");
p.setProperty("password","NewPassword");
Connection con = DriverManager.getConnection(url,p);

c) Load the driver:
java –Djdbc.drivers=sun.jdbc.odbc.JdbcOdbcDriver SampleApplication

Get Connection:

String url = "jdbc:odbc:MyDataSource";
Properties p = new Properties();
p.addProperty("user","NewUser");
p.addProperty("password","NewPassword");
Connection con = DriverManager.getConnection(url,p);

d) Load the driver:
java –Ljdbc.drivers=sun.jdbc.odbc.JdbcOdbcDriver SampleApplication

Get Connection:

String url = "jdbc:odbc:MyDataSource";
Properties p = new Properties();
p.setProperty("user","NewUser");
p.setProperty("password","NewPassword");
Connection con = DriverManager.getConnection(url,p);

33. In the code given below, what does the executeBatch method return?
try
{
con.setAutoCommit( false );
boolFlag = false;
stmt.clearBatch();
stmt.addBatch( s1 );
stmt.addBatch( s2 );
stmt.addBatch( s3 );
updateCounts = stmt.executeBatch();
}
catch( BatchUpdateException be )
{
System.out.println("Exception"+be);
}

a) returns an integer with number of rows affected

b) returns a long with number of rows effected

c) returns a boolean whether the batch update was successful

d) an integer array that stores the values of the updated rows

34. Select, from the following, all callbacks that are defined in the
javax.jdo.InstanceCallbacks interface.(Choose 3)

a) jdoPreLoad

b) jdoPostLoad
c) jdoPostClear

d) jdoPreClear

e) jdoPreStore

35. What are the main forms of transactions which JDO supports?(Choose 2)

a) Pessimistic transactions

b) Void transactions

c) One to one transactions

d) Optimistic transactions

e) Narrow transactions

36. The __________ tag in the deployment descriptor specifies the type of persistence in
entity beans.

a) <persistence-type>

b) <persistence>

c) <persistancetype>

d) <entity-persistence-type>

37. Consider the following statements:

Statement A: In CMP entity bean, you need to provide the logic to implement referential
integrity.
Statement B: In BMP entity bean, EJB container provides referential integrity.

Which of the following is applicable for above?

a) Statement A is true and Statement B is false

b) Statement A is false and Statement B is true

c) Both, statements, A and B, are true

d) Both, statements, A and B, are false

38. JDO (1.0.1, 2.0, 2.1) expects any XML MetaData to be specified in a file or files in
particular positions in the file system.
Pick the valid files JDO will search for, from the following (Choose 2)

a) META-INF/package.jdo

b) WEB-INF/web.xml

c) META-INF/application.xml
d) WEB-INF/package.jdo

e) WEB-INF/webpackage.jdo

39. Identify the characteristic of a BMP entity bean that defines that the state of a BMP
entity bean exists even after a client stops accessing an application.

a) Persistence

b) Shared Access

c) Primary Key

d) Consistent

40. Which of the following class / interface contains the transaction control methods
setAutoCommit, commit, and rollback?

a) Connection

b) ResultSet

c) Statement

d) DriverManager

41. Which of the following component of the enterprise bean interacts with the client, on
behalf of EJB Container, to provide services, such as transaction control, security,and
persistence?

a) Enterprise Bean Class

b) Remote Interface

c) Home Interface

d) EJB Object

42. Which of the following codes can be used to access a remote object using JNDI
name in the lookup method? (Choose 2)

a) Context c = new InitialContext();
Object o = c.lookup(“aaa/bbb”);

b) Context c = new InitialContext();
Context subcontext = (Context) c.lookup(“aaa”);
Object o = subcontext.lookup(“bbb”);

c) Context c = new Context();
Object o = c.lookup(“aaa/bbb”);
d) Context c = new Context();
Context subcontext = (Context) c.lookup(“aaa”);
Object o = subcontext.lookup(“bbb”);

e) Context c = new Context();
InitialContext subcontext = (Context) c.lookup(“aaa”);

f) Object o = subcontext.lookup(“bbb”);

43. Identify the option which represents all the methods that are present in the
EJBObject Interface.

a) EJBHome getEJBHome()
Handle getHandle()
getEJBMetaData()
boolean isIdentical(EJBObject obj)
void remove()

b) EJBHome getEJBHome()
Handle getHandle()
boolean isIdentical(EJBObject obj)
HomeHandle getHomeHandle()

c) EJBHome getEJBHome()
Handle getHandle()
Object getPrimaryKey()
boolean isIdentical(EJBObject obj)
HomeHandle getHomeHandle()

d) EJBHome getEJBHome()
Handle getHandle()
Object getPrimaryKey()
boolean isIdentical(EJBObject obj)
void remove()

44. Which object enable session beans to interact with EJB container to perform the
following functions?
(a) Retrieving the reference to the home objects
(b) Retrieving transaction attributes
(c) Setting transaction attributes

a) EJB session context

b) ejb object

c) Home object

d) Remote object
e) Transaction object

45.Consider the following code snippets to create a remote interface of a stateless
session bean :

(a) Remote home interface of a stateless session bean:

import java.rmi.RemoteException;
import javax.ejb.CreateException;
public interface StatelessSessionHome extends javax.ejb.EJBHome
{
public StatelessSessionRemote create() throws
RemoteException, CreateException;
}

(b) local home interface of a stateless session bean:
import javax.ejb.CreateException;
import java.rmi.RemoteException;
public interface StatelessSessionLocalHome extends
javax.ejb.EJBLocalHome
{
public StatelessSessionLocalRemote create() throws
RemoteException, CreateException;
}

Which of the above code snippets will compile successfully?

a) Only Code a will compile

b) Only Code b will compile

c) Both Code a and Code b will compile

d) Both Code a and Code b will not compile

46. Which of the following option is NOT true about the ejbRemove() method?

a) ejbRemove() method is not invoked by the EJB container when the EJB container or the
EJB Server crashes.

b) ejbRemove() method is not invoked by the EJB container when A client does not
respond for the specified timeout period when the bean is in Passive stage

c) ejbRemove() method is not invoked by the EJB container when a system exception,
such as java.lang.RuntimeException, occurs

d) ejbRemove() method is not invoked by the EJB container before destroying a
bean instance by the container.

47. Consider the following statements:
Statement A: Durable JMS consumer, the message delivery is guaranteed.

Statement B: Nondurable JMS consumer, the message is not delivered irrespective of
active or inactive state of the consumer.

Which of the following is applicable for above?

a) Both Statement A and B are true

b) Both Statement A and B are false

c) Statement A is true and Statement B is false

d) Statement A is false and Statement B is true

48. You have to identify the statements that are FALSE about the only business logic
method used in MessageDrivenBean class.
(a) It should be named onMessage().
(b) It should be declared public.
(c) It should not be declared final or static.
(d) It should have the return type as that passed as an argument of the onMessage()
method.
(e) It should throw Remote exceptions.

Which of the following gives the correct set of statements that are FALSE?

(a) and ( c)

(b) and( c)

(c) and (e)

(d) and (e)

49. Consider the following satements about the java interfaces required for creating
MessageDrivenBean:
Statement A:MessageDrivenBean implementation class
Statement B:Remote Interface which declares Bussiness methods.
Statement C:MessageListener Interface to declare Bussiness method.
Which of the following is applicable for the above?

(a) Statement A and B are true

(b) Statement A and C are true

(c) Statement C and B are true

(d) Only Statement A is true

50. Which method of the EJBHome interface is invoked by the clients to manage a
stateless session bean remotely?
(a) getEJBHome()

(b) getHomeHandle()

(c) getHandle()

(d) isIdentical()

51. Consider the following statements about JMS API:
Statement A:
Publish/Subscribe (Pub/Sub): In this type of messaging, several JMS producers send
messages to the middle layer that is known as a topic.
Statement B:
Point-to-Point (PTP): In this type of messaging, the middle layer is known as queue.

Which of the following is applicable for the above?

(a) Both Statement A and B are true

(b) Both Statement A and B are false

(c) Statement A is ture and Statement B is false

(d) Statement A is false and Statement B is true

52. “JMS API can be used to send and receive SOAP messages.”
State True or False.

(a) TRUE

(b) FALSE

53. Fill in the blanks with the correct option:
The EJBException is an example of _____ and CreateException is an example of
_______exception..

(a) System Exception, Customized exception

(b) Customized exception, System Exception

(c) Predefined exception, System exception

(d) System exception, Predefined exception

54. Consider the following scenario:
There is a CMP entity bean StudentEJB and has relationships with various enterprise
beans. One such bean is Address bean.The requirement is when the student bean is
deleted, all the beans related to student bean has to be deleted.
Which of the following deployment descriptor option will fulfill the above stated
condition?
(a) <relationships>
<ejb-relation>
<ejb-relationship-role>
<multiplicity>One</multiplicity>
<cascade-delete/>
<relationship-role-source>
<ejb-name>Student</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>Subjects</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<multiplicity>One</multiplicity>
<relationship-role-source>
<ejb-name>Address</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
</relationships>

(b) <relationships>
<ejb-relation>
<ejb-relationship-role>
<multiplicity>Many</multiplicity>
<cascade-delete/>
<relationship-role-source>
<ejb-name>Student</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>Subjects</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<multiplicity>Many</multiplicity>
<relationship-role-source>
<ejb-name>Address</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
</relationships>

(c) <relationships>
<ejb-relation>
<ejb-relationship-role>
<multiplicity>One</multiplicity>
<relationship-role-source>
<ejb-name>Student</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>Subjects</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<multiplicity>One</multiplicity>
<cascade-delete/>
<relationship-role-source>
<ejb-name>Address</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
</relationships>

(d) <relationships>
<ejb-relation>
<ejb-relationship-role>
<multiplicity>Many</multiplicity>
<relationship-role-source>
<ejb-name>Student</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>Subjects</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<multiplicity>Many</multiplicity>
<cascade-delete/>
<relationship-role-source>
<ejb-name>Address</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
</relationships>

55. Consider the following scenario:
The onMessage() method in a message-driven bean also needs to commit the
transaction before the method returns without completing the transaction. EJB container
performs the following operations ((a),(b),(c)) if the onMessage() method in a message-
driven bean returns without committing the transaction, but these tasks are not
sequenced properly.
.Arrange the following operations in correct sequence according to the above senerio.
(a) Removes the instance of the message-driven bean that started the transaction and
returned without its completion..
(b) Generates an application error
(c) Rolls back the transaction started by the method.

a) (a),(b),(c )

b) (b), (c ), (a)

c) (b),(a),(c )

d) (c ),(a),(b)

56. Which of the following options given will best replace the position of A and B in the
below given statemnets.

___A___ Transaction Attribute will throw an exception if it is called in the context of an
existing transaction.
___B___ Transaction Attribute will throw an exception if it is invoked in the absence of a
transaction

(A) Required (B) RequiresNew

(A) Mandatory (B) NotSupported

(A) NotSupported (B) Never.

(A )Never (B) Mandatory

(A)Never (B)NotSupported

57. Which of the following methods makes an entity bean instance available for garbage
collection?

A. ejbRemove()
B. unsetEntityContext()
C. finalize()

Select one correct answer from below.

a) Only A is true

b) Both, B and C, are true

c) Only C is true

d) Both, A and C, are true

58. Which of the following lines of code will not compile with a JMS version prior to 1.1?

1: ConnectionFactory connectionFactory = (ConnectionFactory)new
InitialContext().lookup("connFactory");
2: Connection connection = connectionFactory.createConnection();
3: Session session = connection.createSession(true, 0);
4: BytesMessage message = session.createBytesMessage();
5: message.writeBytes(byteMessage);

Assume that the variables byteMessage and aDestination exists.

a) 1

b) 2

c) 3

d) 4

e) 5

59. Consider the following statements about the two different Web authentication
Techniques:

Statement A: HTTP basic – The developer controls the look and feel of the authentication
process by supplying HTML forms.

Statement B: Form-based – The web browser prompts the user for a user name and
password, and supplies this information in the request header.

Which of the following is applicable for the above?

a) Both Statement A and B are true

b) Both Statement A and B are false

c) Statement A is ture and Statement B is false

d) Statement A is false and Statement B is true

60. Consider the following statements with respect to local and remote client view for an
EJB application:

Statement A: While using remote client view, the parameters are passed by value
between the EJB and the client
Statement B: While using local client view, the parameters are passed by reference
between the EJB and the client

Which of the following is applicable for above?

a) Both Statement A and B are true

b) Both Statement A and B are false

c) Statement A is ture and Statement B is false
d) Statement A is false and Statement B is true

61. Consider the following scenario:

Using JMS API, you create a MessageDrivenBean to send common messages to multiple
consumers.

Assuming that the bean class name is Welcome.Hello and is supported by declarative
transaction, select one correct option that satisfies your requirement.

a) <ejb-jar>
<enterprise-beans>
<message-driven>
<ejb-name>joy<ejb-name>
<ejb-class>Welcome.Hello</ejb-class>
<transaction-type>container</transaction-type>
<message-driven-destination>
<destination-type> javax.jms.Topic</destination-type>
</message-driven-destination>
</message-driven>
</enterprise-beans>
</ejb-jar>

b) <ejb-jar>
<enterprise-beans>
<message-driven>
<ejb-name>joy<ejb-name>
<ejb-class>Hello</ejb-class>
<transaction-type>container</transaction-type>
<message-driven-destination>
<destination-type> javax.jms.Queue</destination-type>
</message-driven-destination>
</message-driven>
</enterprise-beans>
</ejb-jar>

c) <ejb-jar>
<enterprise-beans>
<message-driven>
<ejb-name>joy<ejb-name>
<ejb-class> Hello</ejb-class>
<transaction-type>container</transaction-type>
<message-driven-destination>
<destination-type> javax.jms.Topic </destination-type>
</message-driven-destination>
</message-driven>
</enterprise-beans>
</ejb-jar>

d) <ejb-jar>
<enterprise-beans>
<message-driven>
<ejb-name>joy<ejb-name>

62. Consider the following statements about realms:

There are two types of realms, depending on the authentication policy, which are
Certificate and Default (file realm):
Statement A:
Certificate: Identifies clients that do not have the Https protocol and Certificates.
Statement B:
File realm: Identifies the Web Browser clients and is associated with the Https protocol.

Which of the following is applicable for above?

a) Both Statement A and B are true

b) Both Statement A and B are false

c) Statement A is true and Statement B is false

d) Statement A is false and Statement B is true

63. In which one of the relationship implemented by the container, cascade delete
technique cannot be used?

a) One to one

b) One to many

c) Many to one

d) Many to many

64. Consider the following scenario and predict the EJB containers behavior:

For a messagedriven bean the method that started the transaction calls the
EJBContext.setRollbackOnly() method and has the transaction attribute as
NotSupported.

a) EJB Container throws the java.lang.IllegalStateException

b) Method is executed with intended output.

c) EJB Container throws the javax.transaction.NotSupportedException

d) EJB Container throws the EJBException.
65.Consider the following scenario where JDBC transaction is implemented in an
enterprise bean, Assume that the dispatch method takes the necessary parameters and
in turn it invokes two methods, updatedispatchtable and updatewarehousestatus, con is
a connection object:

public void dispatch(String productID, String orderID, int
quantity)
{
try
{

-----???-----
updatedispatchtable(productID, ordered, quantity);
updatewarehousestatus(productID, ordered, quantity);
con.commit();
}
catch(Exception e)
{
con.rollback();
System.out.println(“Transaction failed”);
}}

Which of the following code must be replaced with --???-- to make the dispatch method
complete?

a) con.setAutoCommit(false);

b) con.setAutoCommit(true);

c) con.setCommit(false);

d) con.setCommit(true);

66.Consider the following scenario:
EJB container performs the following operations if a method in a stateless session bean
ends without completing the transaction but, these operations are not properly
sequenced:
Arrange the following operations in correct sequence according to the above scenario.
(a) Generates an application error.
(b) Throws the exceptions, java.rmi.RemoteException or javax.ejb.EJBException,
depending on whether the client is remote or local, respectively.
(c) Rolls back the transaction.
(d) Removes the instance of the session bean that started the transaction and returned
before the completion of the transaction

a) (b), (a), (c), (d)

b) (b), (c), (a), (d)

c) (c), (a), (b), (d)
d) (c), (b), (a),(d)

67. Consider the following description of one of the transaction attributes used in
Container Managed Transactions:
The --??--attribute indicates that the bean method needs to be executed within a
transaction. When a bean method with the --??-- transaction
attribute is called in the context of an existing transaction, it becomes a part of the
ongoing transaction. If no transaction exists, then EJB container starts a new
transaction before starting the execution of the bean method and ends the transaction
on completion of the bean method.

Which of the following Transaction attribute can be replaced with --??—in the above
description of the Transaction Attribute?

a) Required

b) RequiresNew

c) Mandatory

d) Supports

68.Consider this partial code given below:
//Assume message is a instance of the class Message
message.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
Which of the following are true about the above code.(Choose 3)

a) This message is guaranteed to be delivered.

b) This message is not guaranteed to be delivered.

c) This message is not important for the applications to work, and can get lost

d) This message is very important for the application and it must be delivered, or the
application will crash

e) This message can never be guaranteed to be processed.

69. There are different ways to initialize an initial context object of JNDI naming service
for a standalone application in J2EE.
Which of the following is the correct option for above?

a) Context c = new InitialContext();
Object o = c.lookup(“aaa/bbb”);

b) Context c = new InitialContext();
SubContext subcontext = (Context) c.lookup(“aaa”);
Object o = subcontext.lookup(“bbb”);

c) Properties env = new Properties();
String providerURL = "jndi:Somename://" + server + ":" + port;
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ashnasoft.jms.client.jndi.InitialContextFactoryImpl");
env.put(Context.PROVIDER_URL, providerURL)
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, username);
env.put(Context.SECURITY_CREDENTIALS, password);
InitialContext ic = new InitialContext(env);

d) Context env = new Context ();
String providerURL = "jndi:Somename://" + server + ":" + port;
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ashnasoft.jms.client.jndi.InitialContextFactoryImpl");
env.put(Context.PROVIDER_URL, providerURL)
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, username);
env.put(Context.SECURITY_CREDENTIALS, password);
InitialContext ic = new InitialContext(env);

70. Which of the following code in EJB-Tier Security API can be used to retrieve the
name of the user accessing the EJB?

a) public void setSessionContext(SessionContext sc)
{
this.sc = sc;
}
String user = sc.getUserPrincipal().getName();
if (request.isUserInRole("manager")) {
//... process request
}

b) public void setSessionContext(SessionContext sc) {
this.sc = sc;
}
String user = sc.getUserPrincipal().getName();
if (request.isCallerInRole("manager")) {
//... process request
}

c) public void setSessionContext(SessionContext sc) {
this.sc = sc;
}
String user = sc.getCallerPrincipal().getName();
if (request.isUserInRole("manager")) {
//... process request
}

d) public void setSessionContext(SessionContext sc) {
this.sc = sc;
}
String user = sc.getCallerPrincipal().getName();
if (request.isCallerInRole("manager")) {
//... process request
}

71. Fill in the blanks:
The _____________ enables a Web service to register its interfaces that can be accessed
by the clients to avail the service.

a) Service grid

b) Service Client

c) Service registry

d) None of the listed options

72. Fill in the blanks:
The SAX application uses the______ interface to get validation errors.

a) EntityHandler

b) EventHandler

c) EntityResolver

d) ErrorHandler

73. Which of the following package contains the interface that provides methods to
parse XML documents?

a) javax.xml.transform.sax package

b) org.xml.sax package

c) javax.xml.parsers package

d) javax.xml.transform.stream package

74. Consider the following partial code snippet:
sax_Parser.parse(file1, file2);
Which of the following best describes the above code snippet?

a) Parses the file1 object passed as first argument and specifies that the file2 object
needs to handle parsing events

b) Parses the file2 object passed as second argument and specifies that the file1 object
needs to handle parsing events.

c) Parses the file1 object and transforms the output to the file2 object.
d) Will produce compilation error because the parse() method does not accept two
arguments

75. Which of the following API is used to transform the XML document into other
formats?

a) SAX API

b) DOM API

c) XSLT API

d) JAXP API

76. Consider the following statement about DOM and SAX Parsers:
“DOM parsers consume more memory compared to SAX”
Which of the following justifies the above statement?

a) DOM serially parses the XML document from beginning to end of the document.

b) DOM stores the entire document as an object tree representation in the memory.

c) DOM transforms the XML document after parsing it.

d) DOM creates a single object in memory to represent the XML document.

77. Consider the following statements about WSDL file in Web Services:
Statement A: To create a WSDL file, the Web service configuration file specifies the Web
service endpoint interface.
Statement B: To create a WSDL file the Web service configuration file specifies the name
of the Web service implementation class.
Which of the following is applicable for the above?

a) Both statements A and B are true

b) Both statements A and B are false

c) Statement A is true while B is false

d) Statement A is false while B is true

78. Identify, from the following, the correct option regarding the packaging of a Web
service for deployment in the J2EE application server.

a) Web service is packaged in a WAR file.

b) A Web service is packaged in a JAR file.

c) A Web service is packaged in an EAR file.

d) A Web service is directly deployed, therefore no packaging is required.
79. Which of the following specifies the data types supported by JAX-RPC?

a) int, float, boolean

b) float, char, boolean

c) char, int, float

d) long, double, char

80. Identify the FALSE statement from the following regarding JAX-RPC.

a) Web services created in JAX-RPC are interoperable.

b) Web services created in JAX-RPC are portable.

c) Web services created in JAX-RPC uses SOAP protocol.

d) Web services created in JAX-RPC can only be called by the clients
created in J2EE platform.

81. Which of the following XML standard is used to enable communication between the
web services and its clients?

a) SOAP

b) UDDI

c) WSDL

d) UDID

82. A non-java client needs to access a java web service.
Which of the following java API can be used to perform this task?

a) Java API from XML Binding (JAXB)

b) Java API for XML based Remote Procedure Calls (JAX-RPC)

c) Java API for XML Registries (JAXR)

d) Java API for XML Processing (JAXP)

83. SAX Parser can be used to:
(a) parse an xml document that is nested
(b) modify the structure of an XML document
State True or False.
a) TRUE

b) FALSE
84. Consider the following statements:
Statement A: SOAP, is a lightweight protocol that is primarily used by service providers
to publish a Web Service.
Statement B: SOAP, is a lightweight protocol that is primarily used by service clients to
access a Web Service.
Which of the following is applicable for above?

a) Statement A is True and Statement B is False.

b) Statement A is False and Statement B is True.

c) Both, Statements, A and B, are True.

d) Both, Statements, A and B, are False.

85. Fill in the blanks:
A Java application can use JAXB to convert an XML document to _______________.

a) Java objects

b) Java classes

c) Other formats

d) DOM tree

86. Consider the following statements:
Statement A: The SAX and the DOM APIs process an XML document and XSLT API
transforms an XML document into other format.
Statement B: The SAX and the DOM APIs transforms an XML document into other format
and XSLT API process an XML document.
Which of the following is applicable for above?

a) Statement A is True and Statement B is False

b) Statement A is False and Statement B is True

c) Both, Statements, A and B, are True

d) Both, Statements, A and B, are False

87. Which of the following command is used to generate client side classes using the
wscompile tool. Assuming that config.xml is the configuration file used by the
wscompile tool?

a) wscompile –gen:server –d build

b) wscompile -gen:client -d build config.xml

c) wscompile –client config.xml

d) wscompile config.xml –d build –gen:client
88.Consider the following code which represents a Java class to transform an XML document to an HTML
file:
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
import java.io.*;
public class TransformBookXslt
{
public static void main(String[] argv) throws
TransformerException, TransformerConfigurationException,
FileNotFoundException, IOException
{
TransformerFactory transFactory =TransformerFactory.newInstance();
Transformer transformer = transFactory.newTransformer(new StreamSource(argv[1]));
transformer.transform(new StreamSource(argv[0]), new
StreamResult(new FileOutputStream(argv[2])));
System.out.println("** HTML file is generated **");
}
}
Which of the following represents the replacement of argv[0], argv[1], argv[2]?

a) Argv[0]-book.xml,argv[1]- book.argv[2]-xsl book.html

b) Argv[0]-book.xsl , argv[1]- book. xml , argv[2]-book.html

c) Argv[0]-book.xsl , argv[1]- book. html , argv[2]-book.xml

d) Argv[0]-book.html , argv[1]- book. xml , argv[2]-book.xsl

89. Consider the following scenario and fill in the blanks with correct option given
below:
Developers can send and receive SOAP messages in the Java platform. The body of the
SOAP message consists of data in XML-format. If Data that does not confirm to the XML-
format has to be sent, then the API used to send the non xml-format data is___________.

a) SAAP

b) JAX-JAS

c) SAAJ

d) JAX-RPC

90. Consider the following statement about SOAP message:
An object of the SOAP Fault class is used to receive status and error information when
the message does not reach its destination successfully.
Which of the following attribute of the SOAP fault object is used to identify the source of
the fault?

a) a fault code

b) a fault string

c) a fault actor

d) a detail object