Test Series - spring

Test Number 5/20

Q: Which method is used to publish your own custom event
A. contextPublish
B. publishEvent
C. applicationEventPublish
D. addEvent
Solution: Any bean can publish an event by calling an application event publisher’s publishEvent() method.
Q: Which of the following is a well known recognized event
A. ContextCloasedEvemt
B. ContextRefreshedEvent
C. RequestHandledEvent
D. All of the mentioned
Solution: The application context itself will also publish container events such as ContextClosedEvent, ContextRefreshedEvent, and RequestHandledEvent.
Q: Which event is provoked when web request comes into action
A. ContextClosedEvent
B. ContextStoppedEvent
C. SessionEvent
D. RequestHandledEvent
Solution: Web request events are handled by RequestHandledEvent.
Q: Which of the following is used to convert property values to text Values?
A. property Editor
B. property setter
C. property getter
D. none of the mentioned
Solution: A property editor is a feature of the JavaBeans API for converting property values to and from text values.
Q: Which property editor is used to specify a URL String for a property of the URL type?
A. java.net.*
B. java.io.*
C. java.net.URL
D. none of the mentioned
Solution: Spring will automatically convert the URL string into a URL object and inject it into your property.
Q: Which interface is used to create your own property editors?
A. CustomEditorConfigurer
B. RegisterCustomEditor
C. PropertyEditorConfigurer
D. None of the mentioned
Solution: The CustomEditorConfigurer is implemented as a bean factory post processor for you to register your custom property editors before any of the beans get instantiated.
Q: Which of the following property editors are registered by Spring?
A. CustomNumberEditor
B. FileEditor
C. CustomDateEditor
D. CustomNetEditor
Solution: ClassEditor, FileEditor, LocaleEditor, and URLEditor are pre registered by Spring, so you don’t need to register them again.
Q: What are the ways to create custom Property Editors?
A. implement PropertyEditor interface
B. extend PropertyEditorSupport Class
C. none of the mentioned
D. all of the mentioned
Solution: You can write custom property editors by implementing the java.beans.PropertyEditor interface or extending the convenient support class java.beans.PropertyEditorSupport.
Q: Method which converts property into a string value
A. getAsText
B. setAsText
C. regText
D. None of the mentioned
Solution: The getAsText() method converts a property into a string value.
Q: Method that converts string into a property value
A. getAsText
B. setAsText
C. regText
D. None of the mentioned
Solution: The setAsText() method converts a string back into a property.

You Have Score    /10