117
85.3k
Chapter:

50+ Unit 3 Solved MCQs

in Enterprise Computing With JAVA

These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Master of Computer Applications (MCA) .

Chapters

Chapter: Unit 3
1.

Which statement correctly identifies the goals of the designers of the EJB architecture?

A. The EJB architecture requires that users be aware of the low-level transaction details of the Java EE platform.
B. The EJB architecture is the standard component architecture for building distributed business applications in the Java programming language. (*)
C. Although the EJB architecture defines the contracts that enable tools to develop and deploy components, each application server vendor must produce its own set of additional tooling.
D. The EJB architecture provides a standard way of persisting state data using the Java Persistence API, Java Data Objects, and JDBC.
Answer» B. The EJB architecture is the standard component architecture for building distributed business applications in the Java programming language. (*)
2.

Which statement about life-cycle callback methods is correct?

A. Life-cycle callback methods must be implemented in the bean class.
B. Life-cycle callback methods can have public, private, protected, or packagelevel access. (*)
C. A life-cycle callback method can only have a single callback annotation. In other words, you cannot define a single method and give it two different callback annotations.
D. Life-cycle callback methods can be declared as static.
Answer» B. Life-cycle callback methods can have public, private, protected, or packagelevel access. (*)
3.

Which of the following types of Enterprise Java Bean will be most likely to be difficult to port from one App Server to another?

A. Stateful Session Beans
B. Stateless Session Bean
C. BMP (Bean Managed Persistence) Entity Bean
D. CMP (Container Managed Persistence) Entity Bean
Answer» D. CMP (Container Managed Persistence) Entity Bean
4.

Which interface should be implemented by a stateful session bean if it needs to synchronize its conversational state with the transactional context?

A. javax.transaction.UserTransaction
B. javax.ejb.SessionSynchronization
C. javax.ejb.EJBContext
D. javax.transaction.TransactionContext
Answer» B. javax.ejb.SessionSynchronization
5.

Which of the following exceptions is thrown by the ejbLoad() method of an entity bean when the database row to be loaded is not found ?

A. NoSuchEntityException
B. EJBException
C. RemoteException
D. ObjectNotFoundException
Answer» A. NoSuchEntityException
6.

Which of the following is the format for EJB deployment descriptor files?

A. XML
B. XSL
C. HTML
D. Java
Answer» A. XML
7.

EJB is a

A. Middleware
B. Scalable component architecture
C. Component architecture to integrate legacy systems
D. All of the above.
Answer» D. All of the above.
8.

Which of the following EJB has no state? i. Message-Driven Bean. ii. BMP Entity Bean. iii. Stateless Session Bean. iv. Stateful Session Bean.

A. Both (I) and (II) above
B. Both (II) and (III) above
C. Both (III) and (IV) above
D. Both (I) and (III) above.
Answer» D. Both (I) and (III) above.
9.

Which of the following is true for EJB?

A. EJB is server-side component architecture for distributed applications in Java
B. EJB facilitates scalable, secure and transaction-oriented applications
C. EJB supports portability and reusability
D. All of the above.
Answer» D. All of the above.
10.

Which of the following EJB type has no Remote interfaces?

A. Message-Driven Bean
B. BMP Entity Bean
C. CMP Entity Bean
D. none
Answer» A. Message-Driven Bean
11.

Which role in EJB architecture is responsible for EJB Server?

A. EJB Deployer
B. Application Assembler
C. Network Engineer
D. Server Provider
Answer» D. Server Provider
12.

Which of the EJB has a passive state in its life cycle? I. Stateless Session Bean. II. Message-Driven Bean. III. BMP Entity Bean.

A. Only (I) above
B. Only (II) above
C. Only (III) above
D. Both (I) and (II) above
Answer» C. Only (III) above
13.

Which part of multi-tier enterprise application contains EJB component?

A. Application Server
B. Web Server
C. Database Server
D. Fat Client
Answer» A. Application Server
14.

Which of the following distributed object technology is/are not included in Java? I. CORBA. II. DCOM. III. RMI. IV. EJB.

A. Only (I) above
B. Only (II) above
C. Only (III) above
D. Only (IV) above
Answer» B. Only (II) above
15.

Which of the following is not a property of EJB transaction?

A. Atomicity
B. Consistency
C. Isolation
D. Distributed
Answer» D. Distributed
16.

Which of the following is not true for servlet?

A. It is persistent
B. Platform independent
C. High performance
D. It is single threaded.
Answer» D. It is single threaded.
17.

Which JSP tag is used to transfer processing to another JSP page?

A. <jsp:include>
B. <jsp:forward>
C. <jsp:redirect>
D. <jsp:useBean>
Answer» B. <jsp:forward>
18.

Which of the following is an approach for state maintenance in Web applications?

A. Hidden Form Field
B. URL Rewriting
C. Cookies
D. All of the above.
Answer» D. All of the above.
19.

Which of the following is not a container for EJB? I. Internet Information Server. II. Java System Application Server. III. Tomcat. IV. WebLogic.

A. Both (I) and (II) above
B. Both (II) and (III) above
C. Both (III) and (IV) above
D. Both (I) and (III) above.
Answer» D. Both (I) and (III) above.
20.

Which EJB usually represents persistent data?

A. Entity Bean
B. Stateless Session Bean
C. Stateful Session Bean
D. Message-Driven Bean
Answer» A. Entity Bean
21.

Which is least visibility scope for Java bean in JSP?

A. Page
B. Session
C. Request
D. Application
Answer» A. Page
22.

Which of the following is/are true for JSP technology? I. It is persistent. II. Platform independent. III. Browser executes the code.

A. Only (I) above
B. Only (II) above
C. Both (I) and (II) above
D. Both (II) and (III) above
Answer» C. Both (I) and (II) above
23.

Which of the following is true for JNDI?

A. Database service
B. Naming and Directory Service
C. Network Service
D. Web Service
Answer» B. Naming and Directory Service
24.

Which method of the request object is used to extract values of the input fields in a form when it is submitted?

A. getParameter
B. getParameterNames
C. getValues
D. putValues
Answer» A. getParameter
25.

Which of the following is true for CORBA?

A. Protocol for distributed computing
B. Database specification
C. Specification for distributed objects
D. Both (c) and (d) above.
Answer» D. Both (c) and (d) above.
26.

Which EJB uses EJB-QL for query operations?

A. BMP Entity Bean
B. CMP Entity Bean
C. Session Bean
D. Message-Driven Bean
Answer» B. CMP Entity Bean
27.

Which of the following is true for Java Bean?

A. It can not be a GUI component
B. It never implements serializable interface
C. It has zero-argument constructor
D. It is a distributed component
Answer» C. It has zero-argument constructor
28.

Which of the following is not true for <jsp:useBean> tag in JSP page?

A. Locates a bean instance
B. Stores object reference of the bean in a variable
C. Creates an instance if fails to locate the bean instance
D. All the above.
Answer» D. All the above.
29.

Which of the following is not an implicit object in JSP? I. Request. II. Session. III. Vector. IV. In.

A. Both (I) and (II) above
B. Both (II) and (III) above
C. Both (I) and (III) above
D. Both (III) and (IV) above.
Answer» D. Both (III) and (IV) above.
30.

Which is not a valid scope for Java bean in JSP?

A. Page
B. Session
C. Request
D. Global.
Answer» D. Global.
31.

Which two of the following is responsible to creates ejb-jar files? 1. The bean provider. 2. The application assembler. 3. The deployer. 4. The system administrator.

A. 1 and 2
B. 2 and 3
C. 3 and 4
D. 4 and 1
Answer» A. 1 and 2
32.

Which two of the following must be included in every ejb-jar file? 1. Stubs for the EJBHome and EJBObject interface. 2. The JAR Manifest file. 3. A deployment descriptor. 4. The JNDI context. 5. The EJB's home interface.

A. 1 and 3
B. 2 and 5
C. 3 and 5
D. 4 and 2
Answer» C. 3 and 5
33.

Which statement about session beans is true?

A. In both stateless and statefull session classes, the bean provider must write the method public void remove()
B. The method << remove >> in the component interface can be accessed only by the remote clients
C. The bean’s handle must be provided by the client, in order to ask the EJBHome for removing a session bean
D. None of the above
Answer» C. The bean’s handle must be provided by the client, in order to ask the EJBHome for removing a session bean
34.

Which of the following can be directly invoked by the client?

A. ejbPassivate
B. business methods
C. setSessionContext
D. newInstance
Answer» B. business methods
35.

Which is the method available in SessionContext interface?

A. afterBegin()
B. getRollbackOnly()
C. setSessionCotext()
D. getUserTransaction()
Answer» C. setSessionCotext()
36.

Which statements about a session bean class are true?

A. It is a final class
B. Overloaded constructors are supported
C. Their business methods can be 'private'
D. The ejbCreate() method must not be a final method
Answer» D. The ejbCreate() method must not be a final method
37.

Upon invoking getRollbackOnly() method by a business method in an entity bean, which transaction attribute settings will lead the ejb container to throw an exception?

A. Required
B. RequiresNew
C. Never
D. Mandatory
Answer» C. Never
38.

When a session bean has container-managed demarcation value of 'Supports', which three methods run in an unspecified transaction context? 1. ejbActivate 2. getRollbackOnly 3. getUserTransaction 4. ejbRemove 5. afterBegin 6. afterCompletion

A. 1,4,3
B. 4,2,6
C. 1,4,6
D. 2,5,6
Answer» C. 1,4,6
39.

EJB system’s performance tuning is the responsibility of

A. Bean Provider
B. EJB Deployer
C. Application Assembler
D. Tool Vendor
Answer» B. EJB Deployer
40.

The EJB Transaction Attribute that ensures the method call that always takes place in a transaction, either client started or container started’ are

A. TX_SUPPORTS
B. TX_MANDATORY
C. TX_REQUIRED and TX_REQUIRES_NEW
D. Either A or B
Answer» C. TX_REQUIRED and TX_REQUIRES_NEW
41.

JMS is mainly used to send and receive message from one application to another.

A. True
B. False
C. none
D. all
Answer» A. True
42.

Abbreviate the term JMS?

A. Java Message Service
B. Java Monitor Service
C. Java Message Session
D. Java Monitor Session
Answer» A. Java Message Service
43.

A message driven bean is like statefull session bean that encapsulates the business logic and doesn't maintain state.

A. True
B. False
C. none
D. all
Answer» B. False
44.

EJB QL is a Query Language provided for navigation across a network of enterprise beans and dependent objects defined by means of container managed persistence.

A. True
B. False
C. none
D. all
Answer» A. True
45.

Which case of a session bean obtains the UserTransaction object via the EJBContext using the getUserTransaction() method in EJB transaction management?

A. Bean-managed transactions
B. Container-managed transactions
C. Both A & B
D. None of the above
Answer» A. Bean-managed transactions
46.

Which services are provided to EJB components by the EJB container?

A. Transaction support
B. Persistence support
C. Naming support
D. All mentioned above
Answer» D. All mentioned above
47.

Which EJB container must provide an implementation of Java Naming and Directory Interface (JNDI) API to provide naming services for EJB clients and components?

A. Transaction support
B. Persistence support
C. Naming support
D. All mentioned above
Answer» C. Naming support
48.

Which session bean maintain their state between client invocations but are not required to maintain their state across server crashes or shutdowns?

A. Stateful Session Bean
B. Stateless Session Bean
C. Singleton Session Bean
D. None of the above
Answer» C. Singleton Session Bean
49.

EJB is a specification for J2EE server, not a product; Java beans may be a graphical component in IDE.

A. True
B. False
C. none
D. all
Answer» A. True
50.

A session bean represents a multiple clients inside the Application Server.

A. True
B. False
C. none
D. all
Answer» B. False

Done Studing? Take A Test.

Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.