Ejb Complete 406 Qs

120
Programming Business Logic using EJB 1. WORA stands for _________________. [0. 5] a ) Write Once Read Always c ) Work Once Run Afterwards. b ) Write Once Run Anywhere d ) Wrong Out Read Again. 2. Which of the following is not an advantage of the multi-tier application model. [1. 0] a ) Providing user interaction, using client-side applications. c ) Platform independence b ) Programming business logic d ) Relying on backend services 3. Which of the following statements is not true regarding EJB. [1. 5] a ) It is container dependent. c ) It collects all the common elements present during the development of server-side processes and applications. b ) It is server-side component architecture. d ) Transaction oriented components are written in Java.

description

DD

Transcript of Ejb Complete 406 Qs

Page 1: Ejb Complete 406 Qs

Programming Business Logic using EJB

1. WORA stands for _________________. [0.5]

a) Write Once Read Always c) Work Once Run Afterwards.

b) Write Once Run Anywhere d) Wrong Out Read Again.

2. Which of the following is not an advantage of the multi-tier application model.

[1.0]

a) Providing user interaction, using client-side applications.

c) Platform independence

b) Programming business logic d) Relying on backend services

3. Which of the following statements is not true regarding EJB. [1.5]

a) It is container dependent. c) It collects all the common elements present during the development of server-side processes and applications.

b) It is server-side component architecture.

d) Transaction oriented components are written in Java.

4. The client side is more complex than the server side [0.5]

a) True b) False

5. A ______________________ in EJB is an object that is deployed on any EJB server.

[0.5]

a) Component c) Chunk

b) Container d) Logic

Page 2: Ejb Complete 406 Qs

6. Which of the following statements is false with respect to a distributed application.

[1.5]

a) Processing is distributed across multiple networked computers.

c) It allows for a more accessible business system.

b) It is based on a two-tier application development

d) The user interface is on one network while the business rules and database is on another network

7. ___________________ is not a model for developing distributed applications.

[1.0]

a) DCOM c) RMI

b) COM d) CORBA

8. Generally, ________________________ objects do not implement any interfaces.

[0.5]

a) remote c) public

b) distributed d) local

9. Which of the following statements does not describe a component. [2.0]

a) It is an object. d) It can be described as a chunk of logic.

b) Performs a set of functions. e) It has an independent existence of its own.

c) Can consist of one or more classes.

10. Server side component architecture manages the components during [1.0]

Page 3: Ejb Complete 406 Qs

____________.

a) Compilation c) logic building

b) Development d) run time

11. Which of the following lines pertaining to local objects are true. [2.0]

a) They are created in a totally different JVM.

c) References are obtained directly.

b) They are accessed using interfaces.

d) They always implement a remote interface.

12. ______________________________________ enhances reusability and portability.

[1.0]

a) Client side component architecture.

c) Server-side component architecture.

b) JVM d) Remote objects.

13. The J2EE platform does not contain middleware services. [0.5]

a) True b) False

14. Match the following:

1. EJB a) It acts as a relational database2. JDBC b) It allows asynchronous communication3. JTA c) It is a component technology4. JMS d) It is used for reliable transaction support

[2.5]

a) 1 – a, 2 – b, 3 – c, 4 – d c) 1 – d, 2 – b, 3 – a, 4 – c

b) 1 – c, 2 – a, 3 – d, 4 – b d) 1 – d, 2 – c, 3 – b, 4 – a

15. Multiple connections from the client are taken care of by the [0.5]

Page 4: Ejb Complete 406 Qs

__________________.

a) Remote reference layer c) Skeleton layer

b) Stub layer d) Transport layer

16. The ______________ is an implementation of CORBA. [1.0]

a) Enterprise Java Beans c) Java Transaction API

b) Java Messaging Service d) Java IDL

17. Socket communication is ideal for exchanging files or small amounts of data.

[0.5]

a) True b) False

18. The RMI defines the difference between _______________ and _______________ objects.

[1.0]

a) public/global c) remote/local

b) distributed/concentrated d) random/definite

19. The ______________________________ supports communication between the stub and skeleton.

[1.5]

a) remote reference layer c) transport layer

b) stub layer d) Architecture

20. Method calls by the client, to the remote object leads to an invocation of a method on the _________which in turn passes control to the _________________ layer.

[1.5]

a) transport layer/top c) remote reference layer/lowermost

b) stub/underlying d) transport layer/next

Page 5: Ejb Complete 406 Qs

21. Providing a user-defined interface can change the implementation of the transport layer.

[2.0]

a) True b) False

22. A _____________ must be acquired to the remote object, before a client can invoke a method on that object.

[1.0]

a) tag c) connection

b) reference d) loop

23. Arrange the Events given below in the correct sequence.1) The skeleton contacts the remote registry.2) The object method is called.3) Invocation of the stub.4) Result is passed to the client object.

Forwarding the request the reference layer.

[2.5]

a) 2 – 5 – 3 – 4 – 1 c) 3 – 5 – 1 – 2 – 4

b) 1 – 2 – 3 – 4 – 5 d) 4 – 1 – 5 – 2 – 3

24. All distributed systems consist of _________________ and ___________________.

[1.0]

a) remote objects/random objects c) stubs/skeletons

b) transport layers/reference layers

d) JTA/JMS

25. The _______________________ is responsible for unicast point-to-point invocation.

[0.5]

a) remote reference layer c) skeleton layer

b) stub layer d) transport layer

Page 6: Ejb Complete 406 Qs

26. At present, ____________ is used by RMI to communicate between the ____________ transport layer and the _________________ transport layer.

[1.5]

a) IPX/PX, client, user c) Remote access, remote, network

b) NetBEUI, proxy, host d) TCP/IP, client, server

27. The remote registry is stored on the client. [0.5]

a) True b) False

28. Which of the following classes belong to the java.rmi package. [1.0]

a) MarshalledObject c) Naming

b) RegistryHandler d) Skeleton

29. The ___________________ does not have any methods. [1.0]

a) MarshalledObject d) Remote Interface

b) RMISecurityManager e) Naming

c) RegistryHandler

30. Arrange the order in which a remote object will be created and registered.

1.Create the stub and skeleton classes2.Create the Remote interface3.Create and register the Remote object4.Create a class that implements the Remote interface.5.Copy the Remote interface and stub file to the client.

[2.0]

a) 1 – 2 – 3 – 4 – 5 c) 5 – 1 – 3 – 4 – 2

Page 7: Ejb Complete 406 Qs

b) 3 – 2 – 1 – 5 – 4 d) 2 – 4 – 1 – 5 – 3

31. The interfaces and classes of the __________________ package are used to handle and register remote objects by name.

[1.0]

a) java.rmi.server package c) java.rmi.package

b) java.rmi.registry package d) java.rmi.activation package

32. Remote objects are always referenced through an interface. [0.5]

a) True b) False

33. The client object can call all the methods of the remote object. Do you agree with this statement?

[1.0]

a) Agree b) Disagree

34. Every method of the remote interface must throw a ______________________.

[0.5]

a) getData() c) getDataNum()

b) RemoteException d) interface

35. The statements given below define the implementation of the Remote Interface. Which of these is not true.

[2.0]

a) Classes that implement the remote interface generally extend the ‘UnicastRemoteObject’ class.

c) The implementation class also implements all the methods present in the remote interface.

b) The implementation class does not require a constructor.

d) The implementation class has a main() function.

Page 8: Ejb Complete 406 Qs

36. How many errors are there in the following code snippet.

import java.rmi.;

public interface MyEx extends Remote{

String getDataNum();String getData(int a) throws RemoteException

}

[2.5]

a) None c) Five

b) Four d) Two

37. Which of the following lines of code will be required to register the class ‘Myex’, where the name of the host machine is stored in ‘hostName’ and the name used by the client tocall the remote object is ‘myobj’.

[2.5]

a) Myex instance = new Myex(); Naming.rebind(“//”+hostName+”/myobj”, instance));

c) Myex = new Myex();Naming.(“hostName”, instance));

b) DistributedExImpl instance = new DistributedExImpl();Naming.rebind(“//”+hostName+” /DistributedExample”, instance));

d) Myex instance = new Myex;Naming.rebind(“//”+hostName+”/myobj”, instance)

38. The _______________ compiler is used to register the class that implements the remote interface, with the remote registry.

[1.0]

a) rmi c) rmic

b) class d) java

39. When the compiler is executed for the ‘Myex.class’ program, then the following files are generated. (Choose the correct answer/s).

[1.5]

a) Myex.java c) Myex.class

b) Myex_Stub.class d) Myex_Skel.class

Page 9: Ejb Complete 406 Qs

40. The command required to start the RMI registry is ____________________

[1.5]

a) start rmiregistry c) execute rmiregistry

b) rmiregistry d) begin rmiregistry

41. For listening to incoming requests the RMI registry uses port ___________.

[1.0]

a) 1024 c) 1099

b) 65535 d) 1020

42. The client is able to directly code the container. Do you agree with this statement?

[0.5]

a) Agree b) Disagree

43. Connection pooling and security management are examples of _____________________.

[0.5]

a) Multi-tier applications. c) Components.

b) Application servers d) Middleware.

44. The ______________________ meets the low-level run time execution environment required by EJB applications.

[1.0]

a) Container provider c) Server provider

b) Bean provider d) Deployer

45. Match the following.

1.Bean provider a) It takes prewritten components and deploys them2.Application assembler b) It provides reusable components3.Deployer c) It is similar to the container provider4.Server provider d) It is used for putting the components

[2.5]

Page 10: Ejb Complete 406 Qs

together

a) 1 – a, 2 – b, 3 – c, 4 – d c) 1 – d, 2 – c, 3 – b, 4 – a

b) 1 – b, 2 – d, 3 – a, 4 – c d) 1 – c, 2 – a, 3 – d, 4 – b

46. The EJB ___________ consists of the EJB ____________, which in turn contains the EJB ___________.

[1.5]

a) components/container/server c) container/server/components

b) server/container/components d) components/server/container

47. The EJB architecture consists of the following tiers. [1.5]

a) Client d) Database

b) Container e) EJB server

Home interface

48. The bean accesses the database using ______________. [0.5]

a) ODBC c) JDBC

b) MS-SQL d) server

49. Interaction with the bean by the client is done using the _____________ interface and the ___________ interface.

[1.0]

a) home/remote c) user/EJB

b) database/server d) random/client

50. The ___________________ acts as a buffer between the bean and the outside world.

[1.0]

a) Component c) Container

Page 11: Ejb Complete 406 Qs

b) EJB server d) Client

51. Which of the following statement is false with respect to the EJB container.

[2.0]

a) It consists of a representation of the bean requested by the client.

c) The bean is aware of the methods used by the container to implement the services.

b) It provides services to the bean.

d) It provides support to manage and keep track of beans.

52. The EJB object and EJB home for a bean are managed by the container.

[0.5]

a) True b) False

53. Which of the specifications is not available in EJB1.1? [2.5]

a) Session Beans c) Java Messaging Service

b) Entity Beans d) Message Driven Bean (MDB)

54. The Life cycle of EJB is defined by__________________. [2.5]

a) Remote Interface c) Implemented by User

b) Home Interface d) None of the above

55. Match the following directory services (2.5)

a) LDAP 1. SUN OSb) NDS 2. Netscapec) NIS 3.Novell

[2.5]

Page 12: Ejb Complete 406 Qs

a) a-2 ,b-3 ,c-1 b) a-2 ,b-1 ,c-3

b) a-1 ,b-2 ,c-3 d) a-3 ,b-1 ,c-2

56. In JNDI, binding is an association of a ________________ with a/an _____________.

[2.5]

a) class/library c) client/server

b) name/object d) file/directory

57. Marshalling is the process that converts arguments and return values into ___________________ that can be sent over the network.

[2.5]

a) data c) stream of bytes

b) bits of information d) bits and bytes.

58. Stub file resides on the server. State whether the statement is true or false.

[2.5]

a) True b) False

59. Depending on the environment, the deployer adapts the _________________, _________________ and _______________ to that environment.

[1.5]

a) beans/server/container c) server/component/databaseinterface/middleware/hardware

b) client/object/component d)

60. The container along with all its interfaces resides in the ___________________.

[0.5]

a) client c) beans

b) object d) server

Page 13: Ejb Complete 406 Qs

61. Which of the following is not an example of EJB server/container. [1.0]

a) IBM’s Websphere d) BEA’s Weblogic

b) Jakarta Tomcat’s Jboss e) Oracle’s Oracle Application Server

c) SQL server

62. Assembling of the deployable server side components, at the customers end is done by the ________________.

[1.0]

a) application assembler c) client

b) client assembler d) server

63. Which of the following is not a function of the application server [1.5]

a) Mapping components which are different from each other

c) Providing a user interface

b) Providing an environment in which the enterprise bean can run

d) Making sure that the component is like a given entity

64. The EJB deployer is unaware of the operational environments. [0.5]

a) True b) False

65. Match the following.

1.Consistency a) changes stored permanently2.Isolation b) changes are not saved3.Atomicity c) prevents viewing till transaction is committed4.Durability d) one logical unit

[2.0]

a) 1 – b, 2 – c, 3 – d, 4 – a c) 1 – a, 2 – b, 3 – d, 4 – c

Page 14: Ejb Complete 406 Qs

b) 1 – d, 2 – c, 3 – a, 4 – b d) 1 – c, 2 – a, 3 – b, 4 – d

66. As of now, the terms container and EJB server in EJB can be used inter-changeably. Do you agree with this statement?

[1.5]

a) Agree b) Disagree

67. Adaptation of the access level of beans to fit into a particular system is done by the system administrator.

[1.0]

a) True b) False

68. The management tools used by the EJB server and container are controlled by the _________________.

1.0

a) EJB deployer c) EJB container

b) EJB server d) EJB administrator

69. Identify the services that the container or the server fails to provide [2.0]

a) Security support c) Persistence support

b) Writing of code d) Management of multiple instances.

70. The properties that characterize transactions are known as ACID properties.

[0.5]

a) True b) False

71. The _______________ notification at given at the start of the transaction, signals the start of the transaction.

[1.0]

a) Start c) Initial

b) Begin d) First

Page 15: Ejb Complete 406 Qs

72. Can a transactional context be propagated from client? Comment. [2.0]

a) True b) False

73. Which transaction attribute cannot be set while deployment [2.5]

a) TX_NOT_SUPPORTED d) TX_NOT_REQUIRED

b) TX_SUPPORTS e) TX_REQUIRES_NEW

c) TX_REQUIRED

74. The person deploying the bean specifies the ________________ for that bean for better __________________.

[1.5]

a) ACID/transaction c) State of the object/consistency

b) Start/durability d) ACL’s/security

75. Repeated creation of an object whenever it is required is persistence. [1.0]

a) True b) False

76. Constant storage can be done on a file. [0.5]

a) True b) False

77. For efficient management of multiple instances, the server performs a variety of tasks. Which of the tasks mentioned below, is not one of them.

[2.0]

a) Instance passivation c) Message pooling

Page 16: Ejb Complete 406 Qs

b) Instance pooling d) Database connection pooling.

78. The Life cycle of EJB is defined by: [2.0]

a) Remote Interface c) Implemented by User

b) Home Interface d) None of the above

79. The specifications set by EJB need not match with those of the component interface.

[0.5]

a) True b) False

80. When the client calls a bean, it can in turn call another bean. Do you agree with this statement?

[1.0]

a) Agree b) Disagree

81. What do A and B represent in the diagrammatic representation given below;(1.5)

A

Session Bean

B

[1.5]

a) A – Stateful Bean, B – Stateless Bean

c) A – BMP, B – CMP

b) A – Entity Bean, B – Enterprise Bean

d) A – JavaBean, B – Enterprise Java Bean

82. A session bean being used by a client can also be used by another client.

[0.5]

a) True b) False

Page 17: Ejb Complete 406 Qs

83. The instantiation of a session bean is done by the ____________________ while the management of the lifetime of the bean is done by the ___________________________.

[1.5]

a) EJB server/container c) Component/client

b) Container/EJB server d) Client/component

84. Once the client ceases to exist, the session bean is also destroyed. State True or False.

[0.5]

a) Yes c) No

85. Suppose in a garment shop, a request is made for all the colors available in a particular garment along with the all the sizes and their respective prices, then which session bean will be used to handle such processes?

[1.5]

a) Stateful session bean b) Stateless session bean

86. Stateless session beans are also known as _________________________.

[1.0]

a) Stateful session beans c) Anonymous method providers

b) Container d) Know method providers

87. Measuring in terms of throughput and resource consumption, ____________________ beans provide the highest performance.

[2.0]

a) Stateless session beans c) Entity beans

b) Stateful session beans

88. When multiple clients try to access the same bean, then the developer needs to take care of instantiating an equal number of components for

[1.5]

Page 18: Ejb Complete 406 Qs

servicing the multiple clients.

a) True b) False

89. Which of the beans cannot be pooled? [2.0]

a) Stateful session beans c) CMP

b) State less session beans d) BMP

90. In J2EE Design Business process is represented as ________________ and Business data is represented as __________________.

[2.0]

a) Session beans / Entity beans

c) CMP/BMP

b) Stateless beans/stateful beans

d) Transaction/process

91. Which of the following statement does not represent an entity bean. [1.5]

a) They are shared by multiple clients

c) An entire chunk of data can be read once into an entity bean.

b) They are modeled on real world objects.

d) It cannot be manipulated.

92. The life of an entity bean is as long as the client session. [0.5]

a) True b) False

93. If a ______________is being used then all the operations need to be written by the developer to a persistent API.

[0.5]

a) Bean-Managed persistent entity bean.

b) Container-Managed persistent entity bean.

Page 19: Ejb Complete 406 Qs

94. _____________________ beans have a higher level of reuse. [1.0]

a) Session beans c) Stateful session beans

b) Entity beans d) Stateless session beans

95. What is known as instance pooling. [1.5]

a) The instantiation, destroying and reuse of a bean by the EJB container.

b) If the bean is not required after use, then the container destroys it.

b) If a requested bean has to be created, then the container does the instantiation.

d) All of the above.

96. A ____________ is a group of operations, which appear as one large operation during execution.

[1.0]

a) Transaction c) Task

b) State d) Process

97. At the time of creation, beans are written as ______________ components, while during deployment they are ___________ components.

[1.0]

a) Distributed/individual c) Networked/single

b) Separate/distributed d) Whole/networked.

98. The bean class is different from a Java class. [0.5]

a) True b) False

Page 20: Ejb Complete 406 Qs

99. The implementation of a session bean is the same as an entity bean. Do you agree with this statement? Select the correct reason to support your answer.

[1.5]

a) Yes – because both are types of enterprise javabeans.

c) Yes – because the implementation details of the components are present in the bean class

b) No – because entity beans relate to persistent objects, whereas session beans contain business-process related logic.

100. The bean class has to portray a set of methods specific to beans, when the ________________________ as per the EJB specification are implemented.

[1.5]

a) Components c) Interfaces

b) Containers d) Objects

101. The statement javax.ejb.Enterprisebean extends java.io.Serializable signifies:-

[1.5]

a) The bean class is confirmed. c) None of the above

b) The enterprise beans can share all the properties of the serializable objects.

d) Both a and b

102. What takes place when a client invokes a method on a bean? [1.5]

a) The bean is directly invoked. c) The EJB container delegates the client request to the bean instance.

b) The EJB container intercepts the call by the client.

d) The EJB container delegates the client request to the bean instance.

Page 21: Ejb Complete 406 Qs

103. Which of the following is not a management function performed by an EJB container.

[1.0]

a) Container logic c) Bean instance logic

b) Security logic d) Transaction logic

104. Which of the following statements is not true regarding an EJB object. [2.0]

a) The EJB container manifests itself as a single network-aware object.

c) This is the original object aware of networking, transactions and security.

b) The network-aware object is also called the EJB object.

d) This object performs the intermediate logic necessary for the EJB container to service the method calls.

105. The interface, which duplicates the methods exposed by the bean class, is called the _______________.

[1.0]

a) Remote interface c) External interface

b) Home interface d) Internal interface

106. Which of the following functions does the remote interface perform? [1.5]

a) Persistence c) Security

b) Business methods d) Concurrency

107. All the remote interface types extend the ___________________________________ interface.

[1.0]

a) javax.ejb.EJBHome c) javax.ejb.EnterpriseBean

Page 22: Ejb Complete 406 Qs

b) javax.ejb.EJBObject d) java.rmi.Remote

108. Which of the following is not a method of the EJB object. [1.5]

a) getEJBHome() c) isidentical()

b) remove() d) getEJBMetData()

109. The _____________________ method is used to delete an entity bean from the persistent store.

[0.5]

a) delete() c) getHandle()

b) remove() d) erase()

110. The client code which invokes methods on the EJB object is in the form of:

[1.0]

a) JSP c) . exe file

b) Enterprise bean d) All the options given

c) Applets

111. The client is unaware of the physical location of a remote object in EJB. Do you agree with this statement?

[0.5]

a) Agree b) Disagree

112. The initialization of an EJB object depends on the ____________________.

[1.0]

a) Home Object c) Container

b) Remote Object d) Client

Page 23: Ejb Complete 406 Qs

113. Only entity beans can be destroyed by passing the _________________________.

[1.0]

a) EJBMetadata object c) Secondary key

b) Primary key d) EJB handle

114. Which of the following is not the responsibility of the EJB home object. [1.5]

a) Make a copy of every method exposed by the bean class.

c) Instantiate an EJB object.

b) Remove the EJB objects. d) Search for an existing EJB object.

115. The deployment descriptor is essentially a file. [0.5]

a) True b) False

116. Choose the correct answer/s from below.

The deployment descriptor contains essential information regarding ___________

[2.0]

a) Remote interface d) Home interface

b) EJB container e) Client

c) Classes that form the bean

117. Can a blank method be added in Home interface as per EJB 1.1 spec?

[1.0]

a) True b) False

118. Deployment properties are stored in a _______________________ [2.0]

Page 24: Ejb Complete 406 Qs

file.

a) Java c) HTML

b) Class d) XML

119. Deployment descriptors provide persistence requirement, wherein the EJB container is informed whether a session bean can take care of persistence on its own, or whether it should delegate the persistence to the container. Do you agree with this statement?

[2.0]

a) Agree b) Disagree

120. Generation of the EJB object, and the home objects, and tuning the bean, are functions that have to be performed by the ___________________.

[0.5]

a) Deployer c) Container

b) Developer d) Client

121. The life of a/an __________________ is comparatively smaller than that of a/an _________________.

[1.0]

a) Entity bean/session bean b) Session bean/entity bean

122. Session beans are able to survive machine crashes. Do you agree with this statement? Give reasons for your answer.

[1.0]

a) Yes – because they are enduring objects.

c) Yes – because they can be constructed in memory from the data in the database.

b) No – because they die along with the surrounding environment.

d) No – because they represent business logic.

123. What are call back methods? [2.5]

Page 25: Ejb Complete 406 Qs

a) Container calling methods of bean

c) Methods representing business logic.

b) Non-enduring methods d) Methods representing business data.

124. ___________________________ session beans are more functional, as they can retain their conversational state.

[0.5]

a) Stateless b) Stateful

125. The methods implemented by the session beans are available to the clients.

[1.0]

a) True b) False

126. Which of the following is a callback method that the container makes use of.

[1.0]

a) setSetContext(Session Context ctx)

c) ejbActivate()

b) ejbCreate() d) ejbRemove()

127. The ejbpassivate() method is called before the bean is passivated. [0.5]

a) True b) False

128. Deployment descriptors are ______________ that describe the bean and some of its runtime behavior to the container.

[2.5]

a) jar files c) serialized classes

b) interfaces d) beans

129. The ejb-jar.xml file may or may not be present in the directory called META-INF.

[0.5]

Page 26: Ejb Complete 406 Qs

a) False b) True

130. Session beans have a primary key. [2.0]

a) True b) False

b) d)

131. Deployment descriptors are found in the _________________________ package.

[2.5]

a) javax.ejb.DeploymentDescriptor c) javax.ejb.ControlDescriptor

b) javax.ejb.deployment d) javax.ejb.descriptor

132. The _______________________ is a gateway for the bean to interact with the container.

[0.5]

a) setSetContext(Session Context ctx)

c) ejbActivate()

b) ejbCreate() d) ejbRemove()

133. The container may not call the ejbRemove() method. Why? [1.5]

a) Because the life of the bean has expired.

c) Because the bean is an entity session bean

b) Because the bean is a stateless session bean

d) Because of a container crash.

134. Study the code given below. The method simpleint() given below is an example of _____________

Import java.ejb.*;

Public class sess implements SessionBean{

[2.0]

Page 27: Ejb Complete 406 Qs

public int simpelint(int pi,int rate,int tm ){

return (pi + (pi * rate * tm / 100);}. . . . .

}

a) ejbCreate() method c) ejbPassivate() method

b) business method d) ejbActivate method

135. Binding is an association of a _______________ with a/an ______________.

[1.5]

a) home interface/remote interface

c) client/server

b) name/object d) client/network

136. Which of the following is not a step involved in JNDI? [2.0]

a) Specify initial context factory c) Acquire Initial context

b) Information for Service provider to start up

d) Connecting the bean with the container

137. Which of the beans cannot be pooled? [2.5]

a) Stateful session beans c) CMP

b) State less session beans d) BMP

138. The major advantage of bean pooling is that there is maximum utilization of time and resources.

[0.5]

a) True b) False

139. The client creates and destroys the bean. [0.5]

Page 28: Ejb Complete 406 Qs

a) True b) False

140. Point out the error in the following code, assuming that a remote interface ‘myeg’ has already been created.

1) import javax.ejb.*;2) import java.rmi.*;

3) public interface myeghome extends EJBHome4) {5) myeg create() throws RemoteException, CreateException ;6) }

[2.5]

a) No errors c) Error in line 5 – class myeg not found

b) Error in line 3 – the package javax.ejb. EJBHome needs to be extended

d) Error in line 5 – two exceptions cannot be thrown together

141. While defining the bean class, are the following statements valid:………………………………public void ejbActivate(){}public void ejbPassivate(){}public void ejbRemove(){}………………………..

[2.5]

a) Yes – they are valid b) No – they will generate an error.

142. Which of the following methods of stateless session beans never have their callback methods invoked.

[2.5]

a) SetSetContext(Session Context ctx)

d) ejbRemove()

b) ejbCreate() e) ejbPassivate()

c) ejbActivate()

Page 29: Ejb Complete 406 Qs

143. The arguments and return type for each method should be serializable.

[2.0]

a) True b) False

144. The process of swapping out a bean and saving the conversational state to a storage device is known as ___________.

[1.0]

a) Activation c) Swapping

b) Passivation d) Pooling

145. At any point of time ___________________ instance/s of stateful sessions beans are/is allowed in the container when there are clients making requests.

[1.0]

a) no c) many

b) one d) few

146. The activated bean is always the original bean instance that was passivated.

[0.5]

a) True b) False

147. LRU stands for [1.0]

a) Last remote user c) Last recently used

b) Least recently used d) Least resource utilized

148. Once the server has been started, the client code can be executed from the same window.

[1.0]

a) True b) False

149. Arrange the activation process in the proper sequence.1) Serialize the bean state.

[2.0]

Page 30: Ejb Complete 406 Qs

2) Conversational state is read back into memory.3) The ejbActivate() method restores the resources of the bean.

Container reconstructs the memory state.

a) 2 – 4 – 1 – 3 c) 3 – 1 – 2 – 4

b) 1 – 2 – 3 – 4 d) 3 – 2 – 4 – 1

150. What do the following lines of code indicate:

System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");

System.setProperty("java.naming.provider.url", "192.9.200.9:1099");

[1.5]

a) Nothing important, these lines just have to be compulsorily given.

c) Indicates the way to locate the client, which is 1099.

b) Indicates the way to locate the server, which is 1099.

d) Mentions how the bean will interact with the container.

151. What do the following lines of code indicate? (2)

…………public int myvar;…………..public void ejbCreate(int myvar) throws CreateException{

this.myvar = myvar;…………….

}

[2.0]

a) Stateless session bean class has been created.

c) The above method will begin a conversation with the client in a stateful session bean.

b) Simply, a variable myvar has been declared.

d) None of the above.

152. Point out the error/s in the following code for the creation of the [2.5]

Page 31: Ejb Complete 406 Qs

remote interface. (2.5)

1) import javax.ejb.*;2) import java.rmi.RemoteException;

3) public interface Myrem extends EJBObject4) {

5) public string myrem() throws RemoteException;}

a) No errors c) Error in line 5 only

b) Error in line 1 and 5 d) Error in line 3

153. Assume that the files Myeg, Myeghome and Myegbean representing the remote interface, home interface and the bean class respectively, have been created in the myeg directory. What will the following command do:

jar cvf myeg.jar Myeg.class Myeghome.class Myegbean.class

[2.5]

a) Create a myeg.jar file in the META-INF directory

c) Will give an error

b) Create a myeg.jar file in the current directory

d) None of the above.

154. Assume that the files Myeg, Myeghome and Myegbean representing the remote interface, home interface and the bean class respectively, have been created in the myeg directory. What will the following command do and will this jar file work with the client code?

jar cvf myeg.jar Myeg.* Myeghome.* Myegbean.* META-INF

[2.5]

a) It will create a myeg.jar file and will include all the .java files also. Yes, it will work with the client code.

c) It will create a myeg.jar file and will include only the .class files and it will work with the client code.

b) It will create a myeg.jar file and will include only the .class files but it will not work with the

d) It will generate an error.

Page 32: Ejb Complete 406 Qs

client code.

155. Assume that the files Myeg, Myeghome and Myegbean representing the remote interface, home interface and the bean class respectively, have been created in the myeg directory. Will the following command work with the client code. Give reasons for your answer.

jar cvf myeg.jar Myeg.class Myeghome.class Myegbean.class

[2.5]

a) Yes it will work normally with the client code.

c) No it will not work with the client code, as the files in the META-INF directory are not included.

b) No it will not work with the client code, as the jar file needs to be created in the META-INF directory.

d) None of the above.

156. To run the client, the server ______________ [1.5]

a) Needs to be started before we run the client.

c) Need not be started.

b) Needs to be started after we run the client.

d) None of the above.

157. In order to start the server, we need to give the _________________________ command at the command prompt.

[1.0]

a) execute c) run

b) start d) start server

158. The passivation process is the opposite of the activation process. [0.5]

a) True b) False

Page 33: Ejb Complete 406 Qs

159. If ________________________ invocation/s is/are required, then stateful session beans need to be used, whereas for _____________________ method call/s the stateless session bean has to be used.

[1.0]

a) a single/multiple c) one/many

b) multiple/single d) no/multiple

160. Which of the following sentences is an advantage of stateless session beans.

[1.5]

a) There are a lot of input/output bottlenecks.

c) Client-specific data needs to be given.

b) Increased congestion in the network.

d) Pooling is simple.

161. There is an increased chance of losing conversations while using stateless session beans.

[0.5]

a) True b) False

162. Data needs to be pushed to the stateful session bean for every method invocation.

[0.5]

a) True b) False

163. The conversation with the client ___________________ be lost, due to caching of client conversation, while using stateful session beans.

[1.0]

a) may c) will never

b) will always d) none of the above

164. What are the don’ts while using stateful session beans? [1.5]

a) Always keep the conversation long.

c) Try to use EJB products that persists stateful

Page 34: Ejb Complete 406 Qs

conversations.

b) Always write the client code that takes into account bean failures.

d) None of the above

165. The rules for the conversational state are put forward by ______________________.

[2.0]

a) EJB c) The server

b) Java object serialization. d) The client

166. The ___________________________ method is used to read the conversational state back into the memory.

[1.5]

a) ejbPassivate() c) ejbCreate()

b) ejbActivate() d) ejbremove()

167. Which of the following files is not included in the .jar file. [1.5]

a) home interface c) bean class

b) remote interface d) client code

168. To be able to execute the bean, the .jar file needs to be copied to the ______________________ directory of the server.

[1.0]

a) bin c) deploy

b) META-INF d) current

169. Stateful session beans tend to be specific to one scenario. Do you agree with this statement?

[2.0]

a) True b) False

Page 35: Ejb Complete 406 Qs

170. Stateful session beans are dedicated to _____________ client/s and have a preset __________________ period.

[2.5]

a) few/time c) one/timeout

b) many/session d) none of the above

171. Stateless session beans are dedicated to one client. [2.0]

a) True b) False

172. A client is able to maintain a connection to a stateless session bean’s ___________________________, but the _______________________ itself is free to service requests from anywhere.

[2.5]

a) container/server c) server/component

b) component/container d) EJB object/bean

173. Since the stateless session bean does not contain any _______________________ information, there is _______________________ between one client and the next.

[2.5]

a) State/no difference c) Bean/always a similarity

b) Conversational/difference d) None of the above.

174. Stateless session beans often perform services that are fairly generic in nature and are reusable. Do you agree with this statement.

[2.0]

a) Yes b) No

175. Entity beans are called _______________________ objects. [0.5]

a) Resistant c) Persistent

b) Dominant d) None of the above

Page 36: Ejb Complete 406 Qs

176. To be able to deploy entity beans, the EJB container has to be compliant with Enterprise JavaBeans version 1.0.

[1.0]

a) True b) False

177. Which of the following sentences differs in meaning with respect to the other three.

[2.0]

a) Entity beans model real world objects.

c) The state of an entity bean is permanently stored in the database.

b) Persistence is expected to operate with transactional integrity.

d) Entity beans are durable

178. In EJB, persistence can also be termed as ______________. [1.0]

a) Object serialization c) EJB object

b) Object durability d) Permanence

179. Which is not a way of making an object persistent. [1.5]

a) Object Database Management System

c) Object-Relational Mapping.

b) Relational Database Management System

d) Java Object Serialization.

180. The capturing of Java Objects in their current state for permanent storage is known as ______________________.

[1.0]

a) Object capturing c) Object Serialization.

b) Object Database Management System

d) Object-Relational Mapping.

Page 37: Ejb Complete 406 Qs

181. In _________________________ Java objects are stored as whole objects.

[1.0]

a) Hand-craft mapping c) Object database management

b) Java serialization d) Object-relational mapping

182. Which of the following statements is not part of the Java object serialization process.

[2.0]

a) It consists of a simple method to marshall an object graph into a compact representation.

c) This enables the developer to pull the data over a network.

b) The serialization of a graph converts it into a byte stream.

d) The data may be saved as a stream to a storage

183. In _____________________ databases, each Java object is decomposed into its constituent part, which is stored separately.

[0.5]

a) Object c) Complex

b) Simple d) Relational

184. The process of querying stored objects using objects serialization is _________ and __________.

[1.0]

a) Cheap/simple c) Expensive/cumbersome

b) Cheap/cumbersome d) Expensive/simple

185. Either ________________ or _______________ can be used to map the object data to the relational database, while saving the objects.

[1.0]

a) JDBC, SQL/J c) Access, MS SQL

b) OOP, RDBMS d) ODBC, OOP

Page 38: Ejb Complete 406 Qs

186. Arrange the sequence in which the object is read back from a relational database.

1.The object is instantiated from the Java class.2.The data is read from the database.3.The field of the Java class instance is populated with the data.

[2.0]

a) 1 – 2 – 3 c) 2 – 1 – 3

b) 3 – 2 – 1 d) 2 – 3 – 1

187. Object-Relational mapping is more sophisticated than Java serialization.

[0.5]

a) True b) False

188. The fields of an object are mapped to a relational database in _________ mapping.

[1.0]

a) Hand-craft c) Object database management

b) Java serialization d) Object-relational

189. Sun’s JavaBlend and Object People’s TOP link are examples of a/an _________ product.

[1.0]

a) Java serialization c) Object database management

b) Hand-craft d) Object-relational

190. Programming to a relational database is required in object database management.

[0.5]

a) True b) False

191. OQL stands for _____________. [0.5]

Page 39: Ejb Complete 406 Qs

a) Other Query Language c) On Question loop

b) Object Query Language d) Oriented Question language

192. Which line does not describe the object database management system.

[1.5]

a) The OQL adds a layer of abstraction from the relational database queries

c) Object oriented databases give better mapping between the entity bean and the database.

b) A decomposed part of the object forms a row in the relational database

d) Serializable objects can be stored in the object-oriented database.

193. Systems based on mainframe and non-relational database applications are ____________.

[1.0]

a) Persistence systems c) Java object serialization

b) Object database management systems

d) Legacy systems

194. CMP’s are preferred to BMP’s in legacy systems. [0.5]

a) True b) False

195. The calculation of the salary of an employee will be handled by the ________________________ component.

[1.5]

a) Application logic component

c) None of the above

b) Persistent data component

196. The employee details, i.e., the name, designation, H.R.A, D.A., etc. will be managed by the _______________________ component.

[1.5]

Page 40: Ejb Complete 406 Qs

a) Application logic component c) None of the above

b) Persistent data component

197. Which of the statements given below does not answer the following question.Why is data treated as an object?

[1.5]

a) It is simple to treat data as an object

c) Middleware services can be gained.

b) Related data can be grouped d) None of the above.

198. Choose the correct answer/s from below.

Entity beans are persistent by themselves, because they include:-

[2.0]

a) Serialization. d) Mapping O/R

b) Workflow logic e) Modeling business processes.

c) Object database persistence

199. Which of the following statements is false regarding entity beans. [1.5]

a) Entity beans may last for years c) The entity bean instance is an instance of the entity bean class.

b) Entity beans can survive a JVM crash.

d) None of the above.

200. Which of the following files is not included into the entity bean. [1.5]

a) The entity bean class c) The primary key class

b) The remote interface d) The property file

Page 41: Ejb Complete 406 Qs

201. What does an instance of an entity bean represent as per EJB1.1 Specification

[2.0]

a) A row of a database c) A relational table

b) A column of a database. d) None of the above

202. Standard call back methods to manage an entity bean are a must. [1.0]

a) True b) False

203. Invoking of an entity bean is done with the help of the ____________, whereas the client does the creation of the entity bean with the help of the __________.

[1.5]

a) Remote interface/home interface

c) Primary key class/deployment descriptor

b) Home interface/remote interface

d) Entity bean class/primary key class

204. It is the ___________who provides tools to implement the remote interface while the implementation is the entity bean’s _________.

[1.5]

a) EJB object/EJB container vendor

c) EJB container vendor/ EJB object.

b) Remote interface/primary key d) EJB client/deployment descriptors

205. A primary key is a/an _______consisting of ‘n’ number of _______________.

[1.5]

a) object/objects c) table/rows

b) interface/objects d) unique ID/beans

Page 42: Ejb Complete 406 Qs

206. Suppose there are 100 employee details entity beans then there will be 100 unique IDs.

[0.5]

a) True b) False

207. The primary key class has to be __________. [1.0]

a) remote c) serializable

b) unique d) none of the above

208. The deployment descriptors for the session beans and the entity beans are the same.

[0.5]

a) True b) False

209. The reading and the alterations to the database can be done only within the ________________.

[1.0]

a) container c) remote interface

b) bean d) JVM

210. Which of the following statements is not true. [1.5]

a) The in-memory object is the database

c) Multiple copies of the same data are the entity bean instances.

b) When the in-memory object is updated, the database however is not updated.

d) There is a mechanism to transfer information between the database and the Java object.

211. The client view remains ________________________ independent of the container or location of the entity bean.

[2.5]

a) Same c) Neutral

Page 43: Ejb Complete 406 Qs

b) Different d) None of the above.

212. ____________________ EJB class/es may be installed on a single container.

[2.5]

a) A single c) Two

b) Multiple d) No

213. Unlike the remote interface and the home interface the primary key is a ___________ and its definition is bound to a _____________ definition.

[2.5]

a) Object/primary key c) Unique entity/key id

b) Method/method d) Class/bean class

214. If the data in a relational table needs to be updated automatically, without using JDBC then __________________ needs to be used.

[1.0]

a) CMP c) Object-relational management

b) BMP d) None of the above

215. The _ method reads the data from the persistent storage into the in-memory fields of the entity bean.

[0.5]

a) ejbLoad() c) ejbCreate()

b) ejbStore() d) none of the above

216. The developer is able to call the ejbStore() method explicitly. [0.5]

a) True b) False

217. The entity bean instance implements ____________________ [1.0]

Page 44: Ejb Complete 406 Qs

callback method/s, when it is in a pool.

a) one c) three

b) two d) none

218. The _____________ method is used to transition a bean form the instance pool, while ________ is used to send the bean into the pool instance.

[1.5]

a) ejbLoad/ejbStore c) ejbActivate/ejbPassivate

b) ejbCreate/ejbRemove d) none of the above

219. There are multiple ways to persist entity beans. [0.5]

a) True b) False

220. Using the SQL construct UPDATE through JDBC to update data in a relational database is an example of ________________.

[2.0]

a) CMP c) Object-relational management

b) BMP d) None of the above

221. Can a blank method be added in the home interface as per EJB 2.0 spec?

[2.5]

a) True b) False

222. Choose the odd one out. Entity beans can -

[2.0]

a) Be created c) Be modified

b) Represent legacy systems d) Do without a primary key

Page 45: Ejb Complete 406 Qs

223. The ejbCreate() method should have ___________________ which must ___________ the create() method in the home interface.

[2.5]

a) Objects/be same with c) Parameters/match

b) Beans/differ d) None of the above

224. The EntityContext is relevant to the bean during the call to the _________________________ method.

[2.5]

a) ejbPostCreate() c) ejbActivate()

b) ejbCreate() d) ejbPassivate()

225. In a container-managed bean, the ejbCreate is called _________ writing the bean’s container managed fields to the database.

[2.5]

a) prior to c) simultaneously while

b) after d) none of the above

226. The methods to find an entity bean are listed in the __________________________.

[1.0]

a) Remote interface c) Bean itself

b) Home interface d) Container

227. Creation and modification of entity beans can be done by directly accessing the database.

[0.5]

a) True b) False

228. The _________________________ interface needs to be implemented to be able to write an entity bean class.

[0.5]

a) javax.ejb.EnterpriseBean c) javax.ejb.EntityBean

b) javax.ejb.SessionBean d) none of the above

Page 46: Ejb Complete 406 Qs

229. Which of the following is not a method of the javax.ejb.EntityBean [2.0]

a) setSessionContext(SessionContext ctx)

c) ejbLoad()

b) unsetEntityContext() d) ejbActivate()

230. The ejbCreate() method is compulsory with entity beans if the underlying database data needs to be created.

[0.5]

a) True b) False

231. Which of the following statements is not true while using the ejbCreate() method with entity beans.

[2.0]

a) There are multiple ways to initialize an entity bean instance.

c) Every method provides the client different ways to create entity beans.

b) The methods in the home interface have to be duplicated in the remote interface.

d) None of the above.

232. Incase of CMPs the _______________________ implements the finder methods.

[0.5]

a) Bean c) EJB container

b) Component d) Client

233. Which of the following is not a rule for finder methods: [2.0]

a) They have to begin with the ejbFind() method.

c) The methods only have to return an enumeration of the primary keys.

b) The can be various finder methods with different names and parameters.

d) There has to be at least one finder method by the name ejbFindByPrimaryKey.

Page 47: Ejb Complete 406 Qs

234. Even if the client times out, the ejbRemove() method is called. [0.5]

a) True b) False

235. The ____________________ identifies the bean’s environment. [0.5]

a) Primary key c) Container

b) Context object d) Bean instance

236. The context object adds new methods which are: (choose the correct answer/s)

[1.5]

a) setEntityContext() c) getEJBObject()

b) unsetEntityContext() d) getPrimaryKey()

237. The finder methods defined in the _________________ should match the ejbFind methods in the actual __________.

[2.5]

a) remote interface/client code c) home interface/bean class

b) bean class/remote interface d) client code/database

238. The call back methods invoked on BMPs by the container are defined in the ____________________ interface.

[1.0]

a) javax.ejb.EnterpriseBean c) javax.ejb.EntityBean

b) javax.ejb.SessionBean d) none of the above

239. Match the following.

1. ejbPassivate() a. It follows ejbCreate()2. ejbRemove() b. The bean is returned to the pool3. ejbStore() c. It will destroy data in the

[2.0]

Page 48: Ejb Complete 406 Qs

database 4. ejbPostCreate() d. It will update the database

a) 1 – b, 2 – d, 3 – a, 4 – c c) 1 – d, 2 – c, 3 – b, 4 – a

b) 1 – b, 2 – c, 3 – d, 4 – a d) 1 – a, 2 – b, 3 – c, 4 – d

240. The __________________________ method is called when the container has to increase the pool size by instantiating a new entity bean.

[1.0]

a) ejbLoad() c) setEntityContext()

b) ejbCreate() d) unsetEntityContext()

241. The ejbLocate() method is used to locate the existing entity bean data instances from within the persistent storage. Do you agree with this statement?

[1.0]

a) Agree b) Disagree

242. The container creates EJB objects to associate it with bean instances _____________ the data is located and its primary key sent back to it.

[0.5]

a) after c) none of the above.

b) before

243. Initialization of the bean is done by the ______________________ method.

[1.5]

a) ejbPostCreate() c) ejbLoad()

b) ejbActivate() d) None of the above.

244. Once the bean instance is associated with the EJB Object, the _____________________ is called.

[1.0]

a) ejbPostCreate() c) ejbLoad()

Page 49: Ejb Complete 406 Qs

b) ejbActivate() d) None of the above.

245. For the ejbActivate() method to function properly, socket connections are important.

[0.5]

a) True b) False

246. The ________ method tells the bean when the data has to be loaded, with the _________ method and also destroyed with the _______________ method.

[1.5]

a) setEntityContext()/ ejbStore()/ejbDestroy()

c) ejbPrimaryKey()/ ejbActivate()/ejbPassivate()

b) FindByPrimaryKey()/ ejbCreate()/ejbPassivate()

d) getPrimaryKey()/ ejbLoad()/ejbRemove()

247. The data in a database is ___________________ updated through a storage API, when using the ejbStore() method with BMPs.

[1.0]

a) explicitly c) directly

b) implicitly d) none of the above

248. All the resources allocated to the bean needs to be released, which is done using the ejbRemove() method.

[0.5]

a) True b) False

249. The unsetEntityContext() method is called _________________________ the instance of the entity bean is destroyed.

[1.0]

a) just after c) simultaneously

b) just before d) none of the above

250. The resources allocated during _________________________ need to be released when using the unsetEntityContext() method is being

[0.5]

Page 50: Ejb Complete 406 Qs

used.

a) ejbCreate() c) ejbRemove()

b) ejbActivate() d) setEntityContext()

251. The ___________________of the ejbFind methods in the home interface may differ with those of the bean class, though the _________________________ and ____________________ should match.

[2.5]

a) names/arguments/exceptions

c) logic/names/signatures

b) arguments/primary key/methods

d) none of the above

252. The major difference between the ejbFind methods of the home interface and the bean class is :

[2.5]

a) When a find method is invoked on the home interface, it is delegated to the corresponding ejbFind method of the bean class.

c) The find method of the home interface throws the FinderException, whereas that of the bean class throws the RemoteException.

b) The arguments of both the methods should differ.

d) The methods of the home interface return either an object or an enumeration of that object, while the remote interface returns either a primary key or an enumeration of the primary key.

253. While using ejbFind method, if a ____________________ needs to be looked up then the method should return an Enumeration, whereas a single object will be returned if a ________________ is looked up.

[2.5]

a) Single reference/group of references

c) Primary key/object

Page 51: Ejb Complete 406 Qs

b) Group of references/single reference

d) Method/class

254. It is possible to write ejbFind methods, which will return arrays using the current version of EJB.

[2.0]

a) True b) False

255. The ejbFindByPrimaryKey() method returns _________________ remote reference/s and takes __________________ parameter/s.

[1.5]

a) Two/two c) Multiple/multiple

b) A single/one d) A single/multiple

256. The state of a bean instance should always be up-to-date with the _________.

[2.0]

a) Bean c) Database

b) Container d) Server

257. The ___________________ exception is necessary for all create methods.

[0.5]

a) FinderException c) ExceptionCreate

b) CreateException d) None of the above

258. The __________________________ methods are called by the container, when the corresponding create() method is invoked by the client on the bean’s home.

[1.0]

a) create() c) ejbmake()

b) ejbCreate() d) ejbActivate()

259. The findByPrimaryKey() method throws the _________ exception if no matching records are found in the database.

[2.5]

Page 52: Ejb Complete 406 Qs

a) ObjectNotFoundException() c) RecordNotFoundException()

b) Null d) RemoteException()

260. ___________ methods are called by the container to manage the bean.

[0.5]

a) Business methods c) EJB-required methods

b) Logic methods d) None of the above

261. Bean-managed State Fields are non-persistent fields. [0.5]

a) True b) False

262. Which of the following is not an EJB required method. [1.5]

a) unsetEntityContext() c) ejbPassivate()

b) ejbActivate() d) ejbStore()

263. The _____ file is the interface used by jBoss to access the database. [0.5]

a) ejb-jar.xml c) jboss.xml

b) jaws.xml d) none of the above.

264. Which of the following files lists the details of the classes and type of the bean along with the name of the primary key.

[1.0]

a) ejbjar.xml c) jboss.xml

b) jaws.xml d) none of the above

265. The bean instance can service ___________________ finder method/s while in the pool.

[1.5]

Page 53: Ejb Complete 406 Qs

a) one c) multiple

b) zero d) none

266. To be able to access the database, a connection request needs to be made to the ______.

[2.0]

a) getConnection c) DriverManager

b) Connect d) Driver

267. Which of the following methods is implemented by the developer in BMP ‘s.

[2.5]

a) ejbCreate() d) findByPrimaryKey()

b) ejbStore e) All the above

c) ejbLoad()

268. In EJB, BMPs are more used than CMPs. [0.5]

a) True b) False

269. The data access logic is performed by the __________ in a BMP, whereas in CMPs it is performed by the ______.

[1.0]

a) Bean/container c) Home interface/remote interface

b) Container/bean d) Remote interface/home interface

270. The ___________________________ queries the bean instance for all the field values when saving the instances of these fields.

[0.5]

a) Bean c) Container

Page 54: Ejb Complete 406 Qs

b) Deployment descriptor d) Classes

271. Which of the following statements is not true with respect to CMPs. [2.0]

a) The developer has to identify the fields, which are to be managed by the container.

c) The above information is given in the deployment descriptor.

b) The container needs to be informed about the fields, which it has to manage.

d) The logic for saving the bean’s instance also has to be provided by the developer.

272. Which of the statements given below, regarding the primary key with respect to entity beans is true.

[2.0]

a) It is optional c) It can have several attributes

b) It can be of a non-serializable class.

d) It is an object.

273. Client interaction to entity beans is : [2.0]

a) Synchronous c) None of the above

b) Asynchronous d)

274. How does the entity bean know that the database has changed? [2.5]

a) By checking the boolean value of the isModified() method in BMP

c) Both a and b

b) The container recognizes the change in the database in CMP

d) Entity beans do not know about the changes in the database.

Page 55: Ejb Complete 406 Qs

275. In BMPs, the fields in the primary key class have to come from the container-managed fields of the entity bean class.

[1.0]

a) True b) False

276. The definition of a primary key class is normally bound to the ________________________ definition.

[2.0]

a) Remote interface c) Bean class

b) Home interface d) None of the above

277. A constructor with no arguments is compulsory in the primary key class definition. Do you agree with this statement.

[1.0]

a) True b) False

278. Study the code for the primary class definition given below and point out the errors in it.import java.io.Serializable;

1. public class MyegPK implements java.io.Serializable{

2. public int myid;3. public String mydat;

4. public MyegPK () {}

5. public MyegPK(int val,String dat){

6. myid = val;7. mydat = dat;

}

………………………………

}

[2.5]

a) error in line 2 c) error in line 5

b) error in line 3,4,7 and 8 d) no errors

Page 56: Ejb Complete 406 Qs

279. import java.io.Serializable;

public class MyegPK implements java.io.Serializable{

public int myid;………………………………………………

public String toString(){

return String.valueof(myid);}

}

Is the toString() method given in the above code fragment a valid one.

[2.5]

a) valid b) invalid

280. Match the following.

1.ejbFind() a. reset transaction related parameters2.ejbStore() b. not required for CMPs3.ejbPostCreate() c. update the database4.ejbLoad d.utilities required to work with the data are performed.

[1.5]

a) 1 – a, 2 – b, 3 – c, 4 – d c) 1 – c, 2 – a, 3 – d, 4 – b

b) 1 – b, 2 – c, 3 – a, 4 – d d) 1 – a, 2 – d, 3 – b, 4 – c

281. Requests for resources needed by the instance are made by using the ________ method.

[1.0]

a) ejbActivate() c) setEntityContext()

b) ejbPassivate() d) unsetEntityContext()

282. The _______ method should be used in CMP for checking the client parameters.

[1.0]

a) ejbCreate() c) ejbActivate()

Page 57: Ejb Complete 406 Qs

b) ejbPostCreate() d) ejbFind()

283. The variable ‘ct’ is used in a CMP entity bean, to indicate whether a row in the database has been updated or not. Which method can be used to reset the value of the variable ‘ct’.

[1.5]

a) ejbCreate() c) ejbLoad()

b) ejbPostCreate() d) ejbStore()

284. When the container needs to call a bean from the pool and ready it, the method called is:

[1.0]

a) ejbActivate() c) ejbPassivate()

b) ejbStore() d) ejbLoad()

285. Before the ____________________________ method can be called, the data from the database is read.

[0.5]

a) ejbStore() c) ejbCreate()

b) ejbRemove() d) ejbLoad()

286. The ejbLoad() and the ejbStore() methods in container-managed beans may be omitted.

[1.5]

a) True b) False

287. If data in a container-managed field needs to be reformatted before it can be stored in the database, then the ___________ and ___________ methods prove to be useful for the said purpose.

[2.5]

a) ejbLoad()/ejbStore() c) setEntityContext()/unsetEntityContext()

b) ejbActivate()/ejbPassivate() d) none of the above

Page 58: Ejb Complete 406 Qs

288. All resources have to be released before the _________ method is called.

[1.0]

a) ejbActivate() c) setEntityContext()

b) ejbPassivate() d) ejbPostCreate()

289. The ejbActivate() method is called during a transaction. [0.5]

a) True b) False

290. The major advantage of container-managed persistence is: [1.5]

a) It allows the developer to focus on business logic.

c) The bean can be defined independently of the database used to store its state.

b) The responsibility of persistence is delegated to the container.

d) All of the above.

291. The major disadvantage of CMPs is: [1.5]

a) The developer is unable to provide the data access logic.

c) Sophisticated mapping tools are required for defining the manner in which the bean’s fields map to the database.

b) More code needs to be specified for the bean.

d) The bean is not reusable.

292. The __________ interface defines the business methods, which the clients will use to interact with the bean.

[1.0]

a) Remote b) Home

Page 59: Ejb Complete 406 Qs

293. The container calls the ____________ method before terminating the life of the entity instance.

[1.5]

a) setEntityContext() c) ejbRemove()

b) unsetEntityContext() d) ejbPassivate()

294. The _______ and _____ methods are associated with the birth of the object.

[1.5]

a) ejbActivate()/ejbPassivate() c) ejbCreate()/ejbPostCreate()

b) ejbLoad()/ejbStore() d) none of the above.

295. The ________ and ____ methods can be invoked by the container any number of times.

[1.5]

a) ejbActivate()/ejbPassivate() c) ejbCreate()/ejbPostCreate()

b) ejbLoad()/ejbStore() d) none of the above.

296. When the transition from the ready state to the pooled state is made, the _______ call is made, whereas the transition back to the ready state from the pooled state results in the ___________ call.

[2.5]

a) ejbLoad()/ejbStore() c) ejbCreate()/ejbPostCreate()

b) ejbPassivate()/ejbActivate() d) ejbActivate()/ejbPassivate()

297. The code in an individual EJB component can be modified without requiring a change to the interface.

[1.0]

a) True b) False

298. The home interface can have __________________________ create method/s and ___________________________ find method/s.

[2.0]

a) one/one c) zero or more/one or more

Page 60: Ejb Complete 406 Qs

b) zero/zero d) none of the above.

299. A lot of bugs are found in the CMP bean.java class. [0.5]

a) True b) False

300. All the container-managed fields need to be declared as _____________.

[0.5]

a) private c) void

b) public d) none of the above

301. The ______________________________ method sets the container-managed fields to the parameters passed by the client.

[1.0]

a) ejbLoad() c) setEntityContext()

b) ejbActivate() d) ejbCreate()

302. For the code of the container to be made available, it has to be __________.

[1.0]

a) compiled c) written

b) decompiled d) generated

303. Study the code fragment given below, which consists of the bean class definition. Is it a valid one, i.e., can the code consist of two ejbCreate() methods.

import javax.ejb.EntityContext;………………

public class MyegBean implements EntityBean{

public int myid;

[2.5]

Page 61: Ejb Complete 406 Qs

public String myname;public double amt;

public String ejbCreate(int myid, String myname, double amt) throws CreateException{

this.id = myid;this.myname = myname;this.amt = amt;

}public void ejbPostCreate(………………){

…………………}public String ejbCreate(int myid, double amt) throws CreateException{

this.id = myid;this.amt = 0;

}public void ejbPostCreate(………………){

…………………}

…………………

a) Valid b) Not valid

304. CMP applications are completely portable. [0.5]

a) True b) False

305. In EJB, the important beans need to determine the information about their status during runtime.

[0.5]

a) True b) False

b) d)

306. Which of the following information is not stored in the context object. [1.5]

Page 62: Ejb Complete 406 Qs

a) Home object of the bean. c) Security for authorizing the client.

b) Environment properties. d) None of the above.

307. The EJB context object can also be called the ____________ to the container.

[1.0]

a) Interface c) Client

b) Gateway d) None of these

308. Callbacks to the container can be performed using __________ because they can be accessed from within the __________.

[1.5]

a) Context objects/beans c) Beans/context objects

b) Beans/container d) Container/context objects

309. Callbacks help the beans to determine their present status. [0.5]

a) True b) False

310. What is the main objective of the context object? [1.5]

a) To store the home object. c) Encapsulate the bean’s domain in a compact object.

b) Call backs can be performed. d) All of the above.

311. The context object acts as middleman for storing __________ about the bean.

[1.0]

a) Data c) Status information

b) Context information d) None of these.

Page 63: Ejb Complete 406 Qs

312. Which of the following is not a method of the javax.ejb.EJBContext. [1.0]

a) getHome() c) getTransaction()

b) getRollbackOnly() d) getEnvironment()

313. The ________ object is used by the bean to create, find or destroy an EJB object.

[1.0]

a) getHome() c) getCallerinRole()

b) Home() d) setRollbackOnly()

314. Information like the location of a file can be obtained from the __________ object

[1.0]

a) getHome() c) getProperties()

b) getEnvironment() d) none of these.

315. The ________________ method returns the security identity of the client.

[1.0]

a) isCallerinRole() c) CallerIdentity()

b) getCallerIdentity() d) setCallerIdentity()

316. Whether a client can perform a particular operation or not is determined by the ____________ method.

[1.0]

a) isCallerinRole() c) isCallerRole()

b) getCallerIdentity() d) setCallerinRole()

317. A Boolean value is returned by the ________________________ method.

[1.0]

a) setRollbackOnly() c) RollbackOnly()

Page 64: Ejb Complete 406 Qs

b) getRollbackOnly() d) setRollback()

318. The getUserTransaction() method is applicable for those beans which____________.

[1.0]

a) do not perform transactions. c) Perform transactions on their own.

b) Perform only one transaction. d) None of these

319. The context in EJB is found only in Entity beans. [0.5]

a) True b) False

320. The SessionContext interface extends the _______________ interface.

[0.5]

a) SessionContext c) EntityContext

b) EJBContext d) Context

321. Session beans have to represent a _______________________, which is called by the container, so that the bean can be associated with a particular context.

[1.0]

a) Context c) Object

b) Method d) Class

322. To associate an entity bean with a particular context, a call is made to __________.

[0.5]

a) setSessionContext(SessionContext ctx)

c) setEntityContext(EntityContext ctx)

b) javax.ejb.SessionBean d) javax.ejb.EntityBean.

Page 65: Ejb Complete 406 Qs

323. The method body of a callback method can be left blank in the bean class.

[0.5]

a) True b) False

324. A bean can act as a client for other beans. [0.5]

a) True b) False

325. When a reference needs to be passed to a bean, then the ____________ method is used.

[1.0]

a) setEJBObject() c) getEJBReference()

b) getEJBObject() d) setEJBReference()

326. As in Java, it is also possible in EJB to use the ‘this’ keyword for self-reference by a bean.

[1.0]

a) True b) False

327. Which of the following correctly represents the interface for the entity context.

[2.5]

a) public interface javax.ejb.SessionContext

extends javax.ejb.EJBContext

{public

javax.ejb.EJBObject getEJBObject();

}

c) public interface javax.ejb.EntityContext extends javax.ejb.EJBContext{public abstract EJBObject getEJBObject()throws illegalStateException;

public abstract Object getPrimaryKey()throws illegalStateException;

}

b) public interface javax.ejb.EntityContext

d) public interface javax.ejb.EntityContext

Page 66: Ejb Complete 406 Qs

extends javax.ejb.EJBContext{public abstract EJBObject getEJBObject();}

{public abstract EJBObject getEJBObject();}

328. The _______________________________ method needs to be called at the end of the bean instance’s life.

[1.5]

a) setEntityContext() c) getEJBObject()

b) unsetEntityContext() d) removeEJBObject()

329. The two important security aspects in EJB are _________ and __________.

[1.0]

a) username/password c) authentication/authorization

b) secrecy/validity d) none of the above

330. An online shopping mall has given all its customers a unique customer id, which the client needs to enter whenever he/she logs on to that site. The id is verified and only then is the customer allowed to proceed further. This is an example of:

[1.5]

a) Authorization c) Validity

b) Authentication d) Identification

331. What is the difference between authentication and authorization. [1.5]

a) There is no difference c) One is performed before calling the EJB method, while the other occurs during the EJB method.

b) One addresses security and the other addresses access control in EJB.

d) None of the above.

Page 67: Ejb Complete 406 Qs

332. An online shopping mall has given all its customers a unique customer id, which the client needs to enter whenever he/she logs on to that site. Based on the customer id, the customer is allowed a certain amount of discount on particular products. The id is verified and only then the customer is allowed to proceed further and is taken to the relevant page for shopping. This is an example of:

[1.5]

a) Authorization c) Validity

b) Authentication d) Identification

333. The two ways of performing authorization are _______ and _________.

[1.0]

a) Authenticative/configuration c) Creative/development

b) Declarative/programmatic d) None of these

334. Which of the following steps are not performed during declarative authorization.

[1.5]

a) Validations are performed by the container.

c) Focus is entirely on business logic.

b) Security checks are coded into the bean.

d) Requirements are entered into the deployment descriptor.

335. The EJB context needs to be queried during security authorization. [0.5]

a) True b) False

336. The methods available for programmatic authorization are ________ and __________.

[1.5]

a) setRollbackOnly() / getRollbackOnly()

c) isCallerInRole(identity role)/ getCallerIdentity()

Page 68: Ejb Complete 406 Qs

b) getUserTransaction() /getEnvoronment()

d) none of these.

337. The isCallerInRole(identity role) checks the security role defined in the __________________.

[1.0]

a) deployment descriptor c) remote interface

b) code d) home interface

338. Security roles may be omitted in EJB. [0.5]

a) True b) False

339. Security roles can be specified based on the type of _______________ used.

[0.5]

a) application server c) container

b) client d) EJB component

340. The Access Control does not take care of : [1.0]

a) User’s access to data c) Sub-systems

b) Business objects d) Client’s identities

341. The __________________________ enables outsiders to modify security rules without modifying the bean code.

[1.0]

a) Access control c) Declarative security

b) Security roles d) None of these

342. Suppose an enterprise bean represents an employee’s salary account. The employee, who is also the caller of the bean can modify the salary details, though he should not be able to do so as it is the responsibility of the accountant. Which security feature is required, so

[2.0]

Page 69: Ejb Complete 406 Qs

that only the accountant is able to modify the salary details.

a) Declarative security c) Security roles

b) Programmatic security d) Access control

343. Which of the following statements is not true with respect to security propagation.

[2.0]

a) Security checks are possible because security contexts.

c) The security contexts are visible in the application code.

b) When a method is called, the container uses the security contexts to propagate the security information.

d) The security context is passed implicitly inside the stub as skeletons.

344. The ___________________________method indicates the security identity, which is required for the bean to perform operations such as calling various other beans.

[1.0]

a) runAsMode c) SYSTEM_IDENTITY

b) runAsIdentity d) CLIENT_IDENTITY

345. Match the following: CLIENT_IDENTITY a. circulate the client’s security contextSYSTEM_IDENTITY b. run the bean using system-level authoritySPECIFIED_IDENTITY c. runAsIdentity

[2.5]

a) 1 – a, 2 – b, 3 – c c) 1 – c, 2 – a, 3 – b

b) 1 – c, 2 – b, 3 – a d) 1 – b, 2 – c, 3 – a

346. Assume that there are two containers A and B. Container A calls a method in Container B, then the security context of container A be passed on to container B

[2.0]

Page 70: Ejb Complete 406 Qs

a) True b) False

347. To resume the operations of an application, which was temporarily stopped, ______________________ needs to be used.

[1.0]

a) components c) object handles

b) objects d) containers

348. In a system where only certain users can update information, while others can only view this data, is an example of:

[2.0]

a) authentication c) secure communication

b) access control d) Security roles

349. Authentication can be accomplished using the ____________. [2.5]

a) Remote interface c) Home interface

b) Container d) JNDI API

350. As per EJB specifications every client application accessing an EJB system should be associated with a ________________________________ object.

[2.5]

a) java.security c) java.Identity

b) java.security.Identity d) none of these

351. The _____________________________ decides who get to access the bean’s methods.

[2.0]

a) container c) home interface

b) remote interface d) person deploying the bean

352. When a client logs on to an EJB system, it is associated with a/an [2.5]

Page 71: Ejb Complete 406 Qs

______________________ for the duration of that session.

a) context object c) bean object

b) client object d) Identity object

353. The _____ keeps track of every client and its Identity object. [2.5]

a) EJB client c) Container

b) EJB server d) Home interface

354. ___________ are services, which are required for robust server-side development.

[1.0]

a) Scalability c) Security services

b) Resource pooling d) Transactions.

355. Transactions are useful for performing persistent operations. [0.5]

a) True b) False

356. Transaction programming can be ______________________ and/though its benefits can still used with the help of _____________________.

[1.5]

a) Performed/transactions c) Omitted/beans

b) Written/container d) Avoided/EJB

357. Exceptions can be used to solve atomic problems. However, it has its disadvantages. Which of the following statements is not a disadvantage.

[1.5]

a) The code will be huge. c) Error handling will go out of control if more complex processes are to be

Page 72: Ejb Complete 406 Qs

performed.

b) Every single problem that can occur at every step has to be considered and looked into.

d) Quality Assurance will be greatly enhanced.

358. Incase of network crash, an exception will be thrown back to the client code, which will help distinguish when the crash occurred. Do you agree with this statement?

[1.0]

a) Agree b) Disagree

359. With the help of transactions, multiple users can share data as it performs various functions. Which one is not one of them?

[2.0]

a) Allow two users to simultaneously change the same data.

c) Ensures that the updated data is completely and wholly written.

b) Allow users to share the same data.

d) Perform necessary locking controls to keep client threads from affecting each other in the database.

360. ________ is an application component, which may be an Enterprise bean, a server component or a CORBA object.

[0.5]

a) Resource c) Transactional Object

b) Transaction Manager d) Resource Manager

361. The ______________________ operates behind the scenes performing all its tasks.

[1.0]

a) Transaction Manager c) Resource

b) Transactional Object d) Resource Manager

362. The ________________ represents storage from where one can read and write.

[0.5]

Page 73: Ejb Complete 406 Qs

a) Transaction Manager c) Resource

b) Transactional Object d) Resource Manager

363. The ____________________ also manages the state of the bean. [0.5]

a) Resource c) Transactional Object

b) Transaction Manager d) Resource Manager

364. What does the C in ACID stand for? [1.0]

a) Container c) Consistency

b) Component d) Class

365. Multiple operations when grouped together to appear as one unit of work is called __________.

[1.0]

a) A database c) Atomicity

b) Transactions d) None of these

366. A transaction is used to perform a banking job, which includes deduction of withdrawals and addition of deposits in all the current accounts taking place every two minutes. If one of these transactions fail, then will the database will :

[2.0]

a) Be restored to its original state, i.e., the one before the transaction began

c) Show only the first operation in the transaction.

b) Be in the partial state, i.e., till the transaction failed.

d) Show the final state, i.e., after all the transactions have been completed, irrespective of the failure.

Page 74: Ejb Complete 406 Qs

367. __________ ensures that a transaction leaves the system’s state as consistent once the transaction is completed.

[1.0]

a) Atomicity c) Isolation

b) Consistency d) Durability

368. The major advantage of isolation is that the client feels that ______________________.

[1.5]

a) All the clients are modifying the data.

c) The data cannot be modified.

b) Only he/she is modifying the data.

d) The data is already modified.

369. Isolation is achieved in the transaction system by making use of a _________on the underlying database data.

[0.5]

a) middle-level synchronization protocol

c) low-level synchronization protocol

b) high-level synchronization protocol

d) synchronization protocol

370. _____ ensures that updates to the managed resources are able to survive failures like network crashes.

[0.5]

a) Atomicity c) Isolation

b) Consistency d) Durability

371. The two major transactional models are __________ and _____________.

[1.0]

a) Flat transactions/nested transactions

c) Durable transactions/consistent transactions

b) Atomic transactions/Isolated transactions

Page 75: Ejb Complete 406 Qs

372. Which of the following statements do not represent a flat transaction. [1.5]

a) ‘N’ number of applications can be performed when flat transactions are started.

c) The result is either success or failure.

b) When the transactions end, a binary result is provided.

d) Units of work can be embedded in other units of work.

373. A failed transaction is ______ whereas a successful transaction is ________.

[1.0]

a) Roll backed/saved c) Abandoned/accepted

b) Aborted/committed d) None of these

374. A transaction will not be aborted in which case. [1.5]

a) When invalid parameters are passed to components

c) When the database is being updated.

b) When there is a hardware or software failure.

d) An invariant system state was violated.

375. Consider the following scenario. The salary of several employees is being calculated using transactions, where first the number of working days for an employee is calculated and stored in the database, and nested within it the additional perks are calculated which is based on the number of working days. Subsequently, the database is updated with the perk amount. Suppose the calculation of an employee’s perk amount fails for some reason, then the database will represent:

[2.5]

a) The original state, i.e., even the number of working days will not be stored.

c) The present state, i.e., the number of working days and some junk perk amount will be stored

b) The current state, i.e., the d) None of the above.

Page 76: Ejb Complete 406 Qs

number of working days will be stored.

376. Consider the following scenario. The salary of several employees is being calculated using transactions, where first the number of working days for an employee is calculated and stored in the database, and nested within it the additional perks are calculated which is based on the number of working days. Subsequently, the database is updated with the perk amount. Suppose a rollback is performed during the calculation of an employee’s perk then the database will represent:

[2.5]

a) The original state, i.e., even the number of working days will not be stored.

c) The present state, i.e., the number of working days and some junk perk amount will be stored

b) The current state, i.e., only the number of working days will be stored.

d) None of the above.

377. Which of the following is supported as per the EJB specification. [1.0]

a) Chained transactions c) Sagas

b) Nested transactions d) Interaction of the bean with a resource manager.

378. A transaction starts with a __________ and finishes with a _______. [1.0]

a) Begin/end c) Commit/abort

b) Start/end d) None of these

379. The process of deciding who begins a transaction, who issues a commit or abort and when do these steps occur is called:

[1.0]

a) Transaction cycle c) Demarcating transactional boundaries

b) Transaction boundary d) None of the above.

Page 77: Ejb Complete 406 Qs

380. Components are automatically listed in ________________________ transactions.

[0.5]

a) Programmatic c) Chained

b) Declarative d) Nested

381. __________________________ is the separation of multiple users from one another though they may use the same database.

[0.5]

a) Isolation c) Atomicity

b) Consistency d) Durability

382. _______ isolation levels ensure low levels of performance, whereas _______ isolation levels lead to high performance.

[1.0]

a) Loose/stringent c) lower/great

b) Stringent/loose d) None of these

383. The EJB container inspects the _________________________ in order to apply appropriate isolation levels to the beans

[1.0]

a) Remote interface c) Bean class

b) Home interface d) Deployment descriptor

384. The ____________ mode offers performance at the highest level. [0.5]

a) TRANSACTION_READ_UNCOMMITTED

c) TRANSACTION_REPEATABLE_READ

b) TRANSACTION_READ_COMMITTED

d) TRANSACTION_SERIALIZABLE

385. The dirty read problem is solved by the [0.5]

Page 78: Ejb Complete 406 Qs

______________________________ mode.

a) TRANSACTION_READ_UNCOMMITTED

c) TRANSACTION_REPEATABLE_READ

b) TRANSACTION_READ_COMMITTED

d) TRANSACTION_SERIALIZABLE

386. Reading of uncommitted data from the database represents the ___________________________ problem.

[1.0]

a) Unrepeatable read c) Phantom

b) Dirty read d) None of the above

387. In a banking transaction, a clerk accesses a wrong account number by mistake and makes changes to the amount in it. Before he can issue a commit, another clerk accesses the same account number and again makes changes to it. The first clerk realizes his mistake and issues an abort. However, the second clerk after making certain modifications to the said amount saves it to the database. The database thus shows an incorrect amount. The above problem represents the ________________ problem.

[2.0]

a) Dirty read c) Phantom

b) Unrepeatable read d) Inconsistency

388. When a component reads data from a database, and upon reading it a second time, finds that the data has changed, it is called the ______________________ problem.

[1.0]

a) Dirty read c) Phantom

b) Unrepeatable read d) Inconsistency

389. The main difference between the unrepeatable read problem and the phantom problem is that the former occurs when _________ and the latter occurs when__________.

[1.5]

a) existing data is c) uncommitted data is

Page 79: Ejb Complete 406 Qs

changed/new data is inserted

read/persistent data is read

b) new data is inserted/ Existing data is changed

d) none of these

390. Distributed flat transactions allow multiple application servers to collaborate under one transactional cover.

[0.5]

a) True b) False

391. The transactional journal is like a/an _________and it is___________, which makes it capable of surviving crashes.

[1.5]

a) Book/perishable c) Interface/modifiable

b) Log/ persistent d) None of the above

392. In an organization, all new employees start with a grade of E5. The general manager performs a query to view all the employees with this grade. However, the HRD manager after recruiting two new employees adds their record into the database. The general manager on performing the same query again, will now see a different set of data. This problem can be addressed as the ______________ problem.

[2.0]

a) Unrepeatable read c) Phantom

b) Dirty read d) Inconsistency

393. All actual data updates are performed by the resource managers, which are located and controlled separately in _________.

[1.0]

a) Phase one b) Phase two

394. Arrange the steps in which the two-phase commit works.1. Each transaction manager then reports back to the

transaction coordinator. If everyone agrees to commit, then commit is called in case of a crash.

[2.0]

Page 80: Ejb Complete 406 Qs

2. The transaction coordinator asks each transaction manager to commit.

3. Each of the transaction managers spreads the message to the resource managers, tied to that particular transaction manager.

4. The transaction coordinator will send a prepare to commit message to every transaction manager that is involved.

a) 1 – 2 – 3 – 4 c) 3 – 2 – 4 – 1

b) 4 – 3 – 1 – 2 d) 2 – 1 – 4 – 3

395. The ___________is the most important piece of information sent over the transactional communication.

[1.0]

a) object c) IIOP

b) transaction manager d) transactional context

396. To be able to control transaction boundaries the __________________ is required.

[1.0]

a) API c) CORBA

b) JTA d) JTS

397. The OTS is broken into the ____________ and ______________. [1.0]

a) The CosTransactions interfaces/ The CosTSPortability interface

c) SessionContext interface/EntityContext interface

b) Home interface/remote interface

d) None of these

398. The developer needs to be concerned about the OTS. [0.5]

Page 81: Ejb Complete 406 Qs

a) True b) False

399. The OTS has been separated into two APIs that are: [1.0]

a) CORBA/RMI c) JTA/JTS

b) DCOM/MOM d) APIJ/JAPI

400. Which of the following should a programmer be concerned about? [2.0]

a) JTA c) OTS

b) JTS d) None of these

401. The JTA is a _________________________. [1.0]

a) Interface c) Object

b) Class d) Package

402. Which of the following is not a functionality of the JTA. [2.0]

a) A transaction can be started inside a bean

c) Other beans can be called.

b) Two methods can be simultaneously invoked on a bean.

d) Components other than beans can also use JTA.

403. In stateless session bean, an exception is thrown to the ___________ but in the case of a stateful session bean, throwing an exception will lead to ___________.

[1.5]

a) Container/the bean c) Client/loss of time

b) Server/EJBserver d) Client/gain in time

Page 82: Ejb Complete 406 Qs

404. The interface _________interface is implemented in the bean class along with other methods.

[1.0]

a) javax.ejb.SessionSynchronization

c) javax.ejb.EntityBean

b) javax.ejb.SessionBean d) none of these

405. What are the different Transaction isolation levels set during deployment? (Choose the correct answer/s)

[2.5]

a) TRANSACTION_READ_UNCOMMITTED

c) TRANSACTION_SERIALIZABLE

b) TRANSACTION_REPEATABLE d) TX_REQUIRED

406. In an online shopping site, the client is allowed to select multiple items and then place his/her order. As a developer, how would you allow the user to cache the items and then write them to the database after the transaction is complete?

[2.5]

a) By implementing the SessionBean interface.

c) By implementing the EntityBean interface.

b) By implementing the SessionSynchronization interface.

d) None of the above

406. public class Mybean implements SessionBean, SessionSynchronization

{……………..public int num;public void ejbCreate(int num) throws CreateException{

this.num = num;}

public int inc(){

return (num –1);

[2.5]

Page 83: Ejb Complete 406 Qs

}

public void afterCompletion(boolean bl){

if (bl==false) ++num;}………………}

What will happen if a transactional abort occurs in the above program.

a) The value in num remains unchanged.

c) The value of num is decremented.

b) The value of num is restored to its original value.

d) None of these