Olete.in
Articles
Mock Tests
đź§Ş Spring MCQ Quiz Hub
Spring Mcq Set 2
Choose a topic to test your knowledge and improve your Spring skills
1. Which interface is used to listen to certain events
ApplicationListener
ContextListener
EventListener
none of the mentioned
2. Which method is used to publish your own custom event
contextPublish
publishEvent
applicationEventPublish
addEvent
3. Which of the following is a well known recognized event
ContextCloasedEvemt
ContextRefreshedEvent
RequestHandledEvent
All of the mentioned
4. Which event is provoked when web request comes into action
ContextClosedEvent
ContextStoppedEvent
SessionEvent
RequestHandledEvent
5. Which of the following is used to convert property values to text Values?
property Editor
property setter
property getter
none of the mentioned
6. Which property editor is used to specify a URL String for a property of the URL type?
java.net.*
java.io.*
java.net.URL
None of the mentioned
7. Which interface is used to create your own property editors?
CustomEditorConfigurer
RegisterCustomEditor
PropertyEditorConfigurer
none of the mentioned
8. Which of the following property editors are registered by Spring?
CustomNumberEditor
FileEditor
CustomDateEditor
CustomNetEditor
9. What are the ways to create custom Property Editors?
implement PropertyEditor interface
extend PropertyEditorSupport Class
none of the mentioned
All of the mentioned
10. Method which converts property into a string value
getAsText
setAsText
regText
none of the mentioned
11. Method that converts string into a property value
getAsText
setAsText
regText
none of the mentioned
12. The property value is retrieved by:-
getValue method
setValue method
none of the mentioned
All of the mentioned
13. For a property editor to be searched correctly, it must be located in the same package as the target class, and the name must be Editor’s name
True
False
error
None of these
14. Which package is used for periodic work
java.lang.Thread
java.util.TimerTask
java.util.Timer
java.util.concurrent
15. Which subinterface provides functionality for managing Threads and their events
ExecutorService
ThreadService
All of the mentioned
none of the mentioned
16. Method provided by ExectuorService which returns a Future < T >
submit
publish
addService
registerService
17. Which method provided by ExecutorService is used to check whether job is finished or cancelled
Future.isDone()
Future.isCancelled()
None of the mentioned
all of the mentioned
18. Which of the following class’s instance is used by TimerTaskExecutor for managing jobs
java.util.Timer
java.util.Date
java.util.HashMap
none of the mentioned
19. Which tag informs the spring container about the use of AspectJ annotation?
aop:aspectj-autowire
aop:aspectj-name
aop:aspectj-autoproxy
none of the mentioned
20. Which of the following is advice supported by Aspect Annotation?
@Before
@After
@AfterReturning
all of the mentioned
21. Which advice is executed once a joint point finishes?
@Before
@After
@AfterReturning
@AfterThrowing
22. Which advice is executed only when joint point returns or throws an exception?
@Before
@After
@AfterReturning
@AfterThrowing
23. Which advice combines all advices into one?
@Before
@After
@AfterThrowing
none of the mentioned
24. Which interface is implemented to specify precedence of aspects?
Ordered
ApplicationAspect
AspectPointcut
none of the mentioned
25. Alternative annotative way to specify precedence of aspects?
@Order
@Aspect
@PointCut
none of the mentioned
26. Method which returns the highest priority of aspect’s join point?
getHighestPriority
getOrder
getHighOrder
getPriority
27. What will be the output of the code snippet? import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.AfterThrowing; @Aspect public class AfterThrowingExample { @AfterThrowing( pointcut="com.xyz.myapp.SystemArchitecture.dataAccessOperation()", throwing="ex") public void doRecoveryActions(DataAccessException e) { throw new IllegalArgumentException(); // ... } }
Runtime Error
IllegalArgumentException
BeanCreation Exception
none of the mentioned
28. Which instantiation model is supported by AspectJ?
perthis
pertarget
none of the mentioned
all of the mentioned
29. Which tag in XML is used to declare @Before advice’s method?
aop:before
aop:after
aop:afterthrow
none of the mentioned
30. Annotation used to refer poincuts?
@Pointcut
@PointcutExecution
@PointcutBefore
none of the mentioned
31. Language used to set various kinds of join points
AspectJ pointcut language
Java pointcut language
XML pointcut language
None of the mentioned
32. Is the following pointcut expression correct? execution(* ArithmeticCalculator.*(..))
Yes
No
If every target class is in same package
Depends where target class is located
33. Which of the following pattern is used to match bean name?
bean(*Calculator)
bean(Calculator)
bean(com.appress.spring.Calculator)
None of the mentioned
34. Expressions which returns Parameters of pointcuts?
target
args
none of the mentioned
all of the mentioned
35. Are logical operators valid in pointcut expressions?
Yes
No
error
none of the mentioned
36. Method which checks if all target classes are matched
matches()
pair()
matchTargetClass()
none of the mentioned
37. Spring supports operations on pointcuts:-
notably
union
intersection
all of the mentioned
38. Pointcuts can be composed using:-
org.springframework.aop.support.Pointcuts class
composablePointcut class
all of the mentioned
none of the mentioned
39. Pointcut used to parse an AspectJ pointcut expression string
org.springframework.aop.aspectj.AspectJExpressionPointcut
org.springframework.aop.aspectj.AspectJExpressionPointcutString
org.springframework.aop.aspectj.AspectJExpressionString
org.springframework.aop.aspectj.AspectJPointcuttoString
40. Which special type of advice is used to implement an interface?
Introduction
Before
After
AfterSpecial
41. Introduction advice helps in implementing multiple inheritance
True
False
error
None of these
42. In introduction advice you have to modify class to introduce new methods
True
False
error
None of these
43. How does an Introduction advice do this in Spring?
dynamic proxy
web proxy
implements org.springframework.net.bundle interface
none of the mentioned
44. Annotation used to declare an introduction
Before
After
@DeclareParents
none of the mentioned
45. Attribute used to specify implementation class
no such attribute
defaultImpl
defaultInterface
defaultImplement
46. How to keep track of the usage of your beans
Calling Count
Last modified date
New Interface to your object
All of the mentioned
47. How to introduce counter field to original bean class?
Using Spring AOP
Implementing interface
AspectJ Pointcut
None of the mentioned
48. Tag used to declare aspects
aop:config
aop:auto-proxy
aop:autowire
None of the mentioned
49. Tag used to enable AspectJ annotation?
Introduction
aop:aspectj-autowire
aop:aspectj-autoproxy
AfterSpecial
50. Tag which defined Spring AOP configurations
aop:config
aop:configregister
aop:configbeans
none of the mentioned
Submit