Tải bản đầy đủ (.doc) (83 trang)

Programming Business Logic using EJB

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (658.66 KB, 83 trang )

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
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]
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 database
2. JDBC b) It allows asynchronous communication
3. JTA c) It is a component technology
4. 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]
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
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
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 classes
2.Create the Remote interface
3.Create and register the Remote object
4.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
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.
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 to
call 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
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 them

2.Application assembler b) It provides reusable components
3.Deployer c) It is similar to the container provider
[2.5]
4.Server provider d) It is used for putting the components
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/component
s
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

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) [2.5]
a) LDAP 1. SUN OS
b) NDS 2. Netscape

c) NIS 3.Novell
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/database
interface/middleware/hardwar
e
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

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 permanently
2.Isolation b) changes are not saved
3.Atomicity c) prevents viewing till transaction is
committed
[2.0]
4.Durability d) one logical unit
a) 1 – b, 2 – c, 3 – d, 4 – a c) 1 – a, 2 – b, 3 – d, 4 – c

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
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
[2.0]
them.
a) Instance passivation c) Message pooling
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
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
servicing the multiple clients.
[1.5]
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.
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
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.
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
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
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 [1.0]
spec?
a) True b) False
118. Deployment properties are stored in a _______________________
file.
[2.0]
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]
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]

×