Enterprise Java Beans (EJB) Architecture
Test your knowledge of Enterprise Java Beans including session beans, entity beans, transactions, lifecycle methods, and callbacks.
Questions
Which of the following call back method belongs to Entity bean?
- void setContext()
- void ejbLoad()
- void ejbDelete()
- void ejbEvict()
----- cannot have local or remote interfaces?
- EntityBean
- StatefulSession Bean
- MessageDrivenBean
- StatelessSessionBean
What should be the return type of the method using @PrePassivate?
- Object
- void
- String
- Boolean
Which of the following call backs are called for the stateful session bean?
- construction
- destruction
- activation
- passivation
- All the above
Who is allowed to override the transaction attribute in the deployment descriptor?
- Bean Provider
- Application Assembler
- Deployer
- System Administrator
Which of the following statements are correct w.r.t. entity bean?
- Every entity must have a primary key
- It is not necessary to define primary key for an Entity
- @Primary annotation is used for denoting a simple primary key
- All the above
Which of the following statement is true about Enterprise Java Beans architecture?
- EJB architecture defines distributed component based architecture for business applications
- EJB is a standard that is built on top of Web Services architecture
- EJB Architecture is language independent, meaning that it is possible to write components using any programming language.
- none
Both CMT and BMT may be used with Entity and Session Beans. True or False?
- True
- False
Which of the following is valid life cycle state for a Stateless Session Bean?
- Does not exist
- Pooled State
- Passive
- None
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?
- Load distribution, Load balancing capability
- Location transparency
- Caching capability
- 2PC (Two phase commit) capability
You have a method that can't be executed in a transaction. What is the correct attribute in the deployment descriptor?
- Leave it empty this is the default.
- NEVER
- NOT SUPPORTED
- NO_TRANSACTIONS
By default, What is the value of the transaction attribute for a method of a bean with CMT?
- NotSupported
- Required
- RequiresNew
- Supports
Which of the following are true about composite primary keys. ?
- The primary key class must be Serializable
- The application must not change the value of the primary key.
- Properties of primary key class must be public or protected.
- Primary key class must be public
- All the above
Which of the following call backs are called for the stateful session bean?
- construction
- destruction
- activation
- passivation
- All the above
Which of the following call backs are supported for the stateless session bean?
- post construction
- pre destroy
- both a and b
- none of the above.
Which of the following is not a life-cycle method for a Stateful Session Bean?
- Post Construction
- Pre Destruction
- Post Activation
- Pre Construction
Can we restart a thread after it has died?
- Yes, we can restart a thread after it has died
- No, we can’t restart a thread after it has died. You will have to create a new thread.
- None of the above.
- Cant say. Not predictable.
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?
- public class MyRunnable extends Runnable{public void run(){}}
- public class MyRunnable extends Object{public void run(){}}
- public class MyRunnable implements Runnable{public void run(){}}
- public class MyRunnable implements Runnable{void run(){}}