Test Series - spring

Test Number 6/20

Q: The property value is retrieved by:-
A. getValue method
B. setValue method
C. none of the mentioned
D. all of the mentioned
Solution: The property value is retrieved and set by calling the getValue() and setValue() methods.
Q: Which package is used for periodic work
A. java.lang.Thread
B. java.util.TimerTask
C. java.util.Timer
D. java.util.concurrent
Solution: Java 1.3 saw the introduction of java.util.TimerTask to support doing some sort of work periodically.
Q: Which subinterface provides functionality for managing Threads and their events
A. ExecutorService
B. ThreadService
C. All of the mentioned
D. None of the mentioned
Solution: ExecutorService, a subinterface, provides more functionality for managing threads and providing support for raising events to the threads, such as shutdown().
Q: Method provided by ExectuorService which returns a Future < T >
A. submit
B. publish
C. addService
D. registerService
Solution: ExecutorService, a subinterface, provides more functionality for managing threads and providing support for raising events to the threads, such as shutdown().
Q: Which method provided by ExecutorService is used to check whether job is finished or cancelled
A. Future.isDone()
B. Future.isCancelled()
C. None of the mentioned
D. All of the mentioned
Solution: You can call Future.isDone() or Future.isCancelled() to determine whether the job is finished or cancelled, respectively.
Q: Which of the following class’s instance is used by TimerTaskExecutor for managing jobs
A. java.util.Timer
B. java.util.Date
C. java.util.HashMap
D. none of the mentioned
Solution: TimerTaskExecutor uses a java.util.Timer instance and manages jobs (java.util.concurrent.Callable or java.lang.Runnable instances) for you by running them on the Timer.
Q: Which tag informs the spring container about the use of AspectJ annotation?
A. aop:aspectj-autowire
B. aop:aspectj-name
C. aop:aspectj-autoproxy
D. none of the mentioned
Solution: To enable AspectJ annotation support in the Spring IoC container, you only have to define an empty XML element aop:aspectj-autoproxy in your bean configuration file.
Q: Which of the following is advice supported by Aspect Annotation?
A. @Before
B. @After
C. @AfterReturning
D. All of the mentioned
Solution: AspectJ supports five types of advice annotations: @Before, @After, @AfterReturning, @AfterThrowing, and @Around.
Q: Which advice is executed once a joint point finishes?
A. @Before
B. @After
C. @AfterReturning
D. @AfterThrowing
Solution: An after advice is executed after a join point finishes, whenever it returns a result or throws an exception abnormally.
Q: Which advice is executed only when joint point returns or throws an exception?
A. @Before
B. @After
C. @AfterReturning
D. @AfterThrowing
Solution: If you would like to perform logging only when a join point returns, you should replace the after advice with an after returning advice.

You Have Score    /10