|
SCBCD Mock Questions - 5 - Answers
1)2,5
Answers 2 and 5 are correct. The bean provider uses the resource manager connection factory reference deployment descriptor element to define a logical name for a resource manager connection factory object. When a resource connection is required, the bean provider uses the defined logical name to perform a JNDI lookup to obtain the resource manager connection factory reference in the enterprise bean's code. A connection to the resource is obtained by calling the appropriate method on the factory reference.
The deployer uses the resource reference deployment descriptor element to bind the reference to an actual resource manager connection factory in the target environment. If the location of a database is modified, the deployer can simply rebind the associated resource manager connection factory without modifying the enterprise bean's source code. The bean provider can also specify whether the principle associated with a resource manager needs to be supplied by the deployer thus allowing the bean provider to obtain database connections without having to specify the user credentials in the enterprise bean's source code.
Answer 1 is incorrect because the resource environment reference deployment descriptor element must be used when referencing an administered object associated with resources such as JMS destinations. Answer 3 is incorrect because the EJB reference deployment descriptor element must be used to enable the bean provider to lookup the home interface of an enterprise bean. Answer 4 is incorrect because the environment entry deployment descriptor element must be used to allow the bean provider to reference configurable data.
2)1,5
Answers 1 and 5 are correct. The exchange rate between pound sterling and Japanese yen is stored in the exchangeRate subcontext of the enterprise bean's environment. The JNDI name of this environment entry is java:/comp/env/exchangeRate/japan and can therefore be accessed using either the full JNDI name from the initial context or using the exchangeRate/japan JNDI name from the enterprise bean's environment context.
Answer 2 is incorrect. The full JNDI name cannot be used from the enterprise bean's environment context. Answer 3 is incorrect because the JNDI name used to lookup the exchange rate from the initial context must include the enterprise bean's environment name. Answer 4 is incorrect because the '.' symbol cannot be used to partition the subcontexts.
3)4,5
Answers 4 and 5 are correct. The ejb-ref element allows the bean provider to refer to enterprise beans that are accessed through its remote home and ejb-local-ref to refer to enterprise beans that are accessed through its local home.
Answer 1 is incorrect because the env-entry element should only be used to reference configurable data that allow customisation of an enterprise bean without changing the bean's source code. Answers 2 and 3 are incorrect because no such elements are permitted in the deployment descriptor.
4)2,4
Answers 2 and 4 are correct. Ensuring that the target enterprise method is type-compatible with the declared EJB reference are the responsibilities of both the application assembler and the deployer.
Answer 1 is incorrect because it is the responsibility of the bean provider. Answers 3 and 5 are incorrect because they are the responsibilities of the deployer.
5)1,5
Answers 1 and 5 are correct.
Answer 2 is incorrect because there are no restrictions imposed by the EJB specification regarding the organisation of the configuration data that an enterprise bean needs. The configuration data can be declared at the root of the env context or in the subcontexts within the enterprise bean's environment. If fact, the same rules apply for references to other enterprise beans, JDBC DataSource references, JMS connection factories, JavaMail connection factories and URL connection factories. Although the J2EE specification provides guidelines regarding how they should be organised in the subcontexts, it is not mandatory that the guidelines are followed. Therefore answers 3 and 4 are also incorrect.
6)5
Answer 5 is correct. The system administrator is responsible for adding, removing and configuring resource managers in the EJB environment.
7)5
Answer 5 is correct.
Answer 1 is incorrect. If an enterprise bean is deployed more that once in the same container, each bean will get a distinct home. Answer 2 is incorrect because enterprise bean instances can only read the values of the environment entries at runtime; the bean instances are not able to modify them. Answer 3 is incorrect because environment entries cannot be shared with different enterprise beans. Answer 4 is incorrect because different environment entry values can be set for an enterprise bean if the bean is deployed multiple times in the same container.
8)3,4,5
Answers 3, 4 and 5 are correct. The bean provider declares in the deployment descriptor the configuration details that the enterprise bean expects to be provided in its environment at runtime. The tools provided by the container presents the configuration details expected, for the application assembler or deployer to set or modify. The process allows configuration values to be changed without requiring any access or modification of the enterprise bean's source code. Answer 5 is correct because the use of the environment entry deployment descriptor element provides a standard process for externalising configuration details used by enterprise beans. This avoids the necessity of using property files to store configuration details. Note that accessing files from an enterprise bean is of course prohibited by the EJB specification.
Answer 1 is incorrect. The bean provider should use the resource environment reference deployment descriptor element when referencing an administered object associated with resources such as JMS destinations. Answer 2 is incorrect. The bean provider should use the resource manager connection factory reference deployment descriptor element to define factories for creating connections to a resource manager. The child res-auth element is used to define whether the deployer is responsible for supplying the credentials used by the connection.
9)4
Answer 4 is correct.
Answer 1 is incorrect because it is the responsibility of the application assembler. Answer 2 is incorrect because it the responsibility of the deployer. Answer 3 is incorrect because it is the responsibility of the bean provider. Answer 5 is incorrect because ensuring that the target enterprise method is type-compatible with the declared EJB reference are the responsibilities of both the application assembler and the deployer.
10)1,5
Answers 1 and 5 are correct.
Answer 2 is incorrect because enterprise bean instances can only read the values of the environment entries at runtime and are not able to modify them. Answers 3 and 4 are incorrect because the deployment descriptor is used to define only the environment entries, as opposed to the values that the enterprise bean expects to be provided at runtime.
|