Enterprise Java Beans (EJB) Architecture

Test your knowledge of Enterprise Java Beans including session beans, entity beans, transactions, lifecycle methods, and callbacks.

18 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which of the following call back method belongs to Entity bean?

  1. void setContext()
  2. void ejbLoad()
  3. void ejbDelete()
  4. void ejbEvict()
Question 2 Multiple Choice (Single Answer)

----- cannot have local or remote interfaces?

  1. EntityBean
  2. StatefulSession Bean
  3. MessageDrivenBean
  4. StatelessSessionBean
Question 3 Multiple Choice (Single Answer)

What should be the return type of the method using @PrePassivate?

  1. Object
  2. void
  3. String
  4. Boolean
Question 4 Multiple Choice (Single Answer)

Which of the following call backs are called for the stateful session bean?

  1. construction
  2. destruction
  3. activation
  4. passivation
  5. All the above
Question 5 Multiple Choice (Single Answer)

Who is allowed to override the transaction attribute in the deployment descriptor?

  1. Bean Provider
  2. Application Assembler
  3. Deployer
  4. System Administrator
Question 6 Multiple Choice (Single Answer)

Which of the following statements are correct w.r.t. entity bean?

  1. Every entity must have a primary key
  2. It is not necessary to define primary key for an Entity
  3. @Primary annotation is used for denoting a simple primary key
  4. All the above
Question 7 Multiple Choice (Single Answer)

Which of the following statement is true about Enterprise Java Beans architecture?

  1. EJB architecture defines distributed component based architecture for business applications
  2. EJB is a standard that is built on top of Web Services architecture
  3. EJB Architecture is language independent, meaning that it is possible to write components using any programming language.
  4. none
Question 8 True/False

Both CMT and BMT may be used with Entity and Session Beans. True or False?

  1. True
  2. False
Question 9 Multiple Choice (Single Answer)

Which of the following is valid life cycle state for a Stateless Session Bean?

  1. Does not exist
  2. Pooled State
  3. Passive
  4. None
Question 10 Multiple Choice (Single Answer)

Most EJB servers show high degree of availability. Server clusters are an example of how this is functionality is achieved. What key advantages might server clusters offer in an EJB environment?

  1. Load distribution, Load balancing capability
  2. Location transparency
  3. Caching capability
  4. 2PC (Two phase commit) capability
Question 11 Multiple Choice (Single Answer)

You have a method that can't be executed in a transaction. What is the correct attribute in the deployment descriptor?

  1. Leave it empty this is the default.
  2. NEVER
  3. NOT SUPPORTED
  4. NO_TRANSACTIONS
Question 12 Multiple Choice (Single Answer)

By default, What is the value of the transaction attribute for a method of a bean with CMT?

  1. NotSupported
  2. Required
  3. RequiresNew
  4. Supports
Question 13 Multiple Choice (Single Answer)

Which of the following are true about composite primary keys. ?

  1. The primary key class must be Serializable
  2. The application must not change the value of the primary key.
  3. Properties of primary key class must be public or protected.
  4. Primary key class must be public
  5. All the above
Question 14 Multiple Choice (Single Answer)

Which of the following call backs are called for the stateful session bean?

  1. construction
  2. destruction
  3. activation
  4. passivation
  5. All the above
Question 15 Multiple Choice (Single Answer)

Which of the following call backs are supported for the stateless session bean?

  1. post construction
  2. pre destroy
  3. both a and b
  4. none of the above.
Question 16 Multiple Choice (Single Answer)

Which of the following is not a life-cycle method for a Stateful Session Bean?

  1. Post Construction
  2. Pre Destruction
  3. Post Activation
  4. Pre Construction
Question 17 Multiple Choice (Single Answer)

Can we restart a thread after it has died?

  1. Yes, we can restart a thread after it has died
  2. No, we can’t restart a thread after it has died. You will have to create a new thread.
  3. None of the above.
  4. Cant say. Not predictable.
Question 18 Multiple Choice (Single Answer)

The following block of code creates a Thread using a Runnable target: Runnable target = new MyRunnable(); Thread myThread = new Thread(target); Which of the following classes can be used to create the target, so that the preceding code compiles correctly?

  1. public class MyRunnable extends Runnable{public void run(){}}
  2. public class MyRunnable extends Object{public void run(){}}
  3. public class MyRunnable implements Runnable{public void run(){}}
  4. public class MyRunnable implements Runnable{void run(){}}