j2ee开发习题和答案EJB,rvlet
Q :1Which of the following statements are correct regarding the stateful ssion bean
Select Your Answer :
They allow PostConstruct, PreDestroy callback methods.
A ssion bean has to always implement the intrefaces annotated with @Local and @Remote to Dspecify the local and and remote interfaces.
A Session bean can have no Local interface.
When a client looks up for a stateful ssion bean in JNDI, same bean instance is returned every time.
Q :2Given
Bean1 --> Stateful ssion Bean's local interface of 'bean1'
Bean2 --> Stateless Session Bean's local interface of 'bean2'
难忘的经
and given:
@EJB(beanName="bean1") Bean1 ref1;
@EJB(beanName="bean1") Bean1 ref2;
@EJB(beanName="bean2") Bean2 ref3;
@EJB(beanName="bean2") Bean2 ref4;
After injection has completed, what would be the output of the following code?
System.out.println(ref1.equals(ref2));
System.out.println(ref3.equals(ref4));
Select Your Answer :
A falfal
B faltrue
C truefal
D true true
Q :3EJB supports scheduling system called Timer Service.
Which interface must implemented by an enterpri bean to be able to be scheduled ?Select Your Answer :
A java.util.Timer
B javax.util.Timer
C javax.ejb.Timer
D javax.ejb.TimerObject
E java.util.TimerObject
Q :4Which of the following stateless bean definitions are correct to be able to be scheduled?
Select Your Answer :
A import javax.ejb.*;
@Stateless
public ClassFoo implements FooRemote,TimedObject{
public void ejbTimeout(Timer timer){//logic }
}
B import javax.ejb.*;
@Stateless
public class Foo implements FooRemote{职务英文
@Timeout迎新春作文
public String ejbTimeout(Timer timer){ // logic }
}
C import javax.ejb.*;
@Stateless
public class Foo implements FooRemote{
@Timeout
public void fnTimeout(Timer timer){ // logic }
}
关于孤独的唯美句子
D import javax.ejb.*;
@Statelessublic class Foo implements FooRemote{
@Timedout
public void fnTimeout(Timer timer){ // logic }
}
Q :6Given a Car EJB ud to schedule perticular car for Maintenance, which is being scheduled as below : @Stateless
public class Foo implements FooRemote{
@Resource TimerService timerService;
@Timeout
public void maintenanceCall(){
// maintenance appropriate Logic}
public void ScheduleMaintenance(Integer carId, Date dayToBeScheduled){
ateTimer( dayToBeScheduled, String());}
public void resceduleMaintenance(Integer carId, Date rescheduleDate){
//Block 1 }}
What are the appropriate code to be inrted in //Block 1 to reschedule a car maintenance to a new time?
Select Your Answer :
A for(Ibject Timers()){
Timer timer = (Timer) obj;
Info().String()){
timer = ateTimer(String);}}
B for(Ibject Timers()){
Timer timer = (Timer) obj;
Info().String()){
timer.cancel();
ateTimer(String);}}
C for(Ibject Timers()){
Timer timer = (Timer) obj;
Info().String())
schedule(rescheduleDate);}
Timer timer = Timer(carId);
schedule(rescheduleDate);
Q :7Given a Timer scheduled as below:Calendar time = Instance();
time.add(Calendar.DATE,15);Date initialExpiration = Timer timer =
Time(),1000*60*60*24,"Timer1");
what will be the result of NextTimeout()?Select Your Answer :
A The Date returned is the time when the timer will be off first time.
B The Date returned is the time when timer is off next time.
C The Date returned is the time remaining until the timer is off next time.
D None of the above
Q :9Given 2 Session beans, Foo and Foo1
@Stateless
public class Foo implementsFooRemote{
private Foo1 foo1;
@Resource TimerService timerService;
@PostConstruct
public void init(){ // block 1 }
@PreDestory
public void finish(){ // block 2 }// business method
public void doBusinessAction(){ // block3 }
@EJB
public tFoo1(Foo1 foo1){
张说的读音//Block 4
多肉日记
this.foo1 = foo1;}}
Which are the legal blocks to place following code:
ateTimer(expDate,"test Timer");
Select Your Answer :
A block 1
B block 2
C block 3
D block 4美发图
E block 5
Q :10Which of the following statements about @PostConstruct callback method of an EJB are true?Select Your Answer :
>焦虑症吃什么中药