R4RIN
Articles
Java 8
MCQS
Spring MCQ Quiz Hub
Spring Mcq Set 6
Choose a topic to test your knowledge and improve your Spring skills
1. To add attributes to the model.
Map
ModelMap
All of the mentioned
none of the mentioned
2. To access the binding and validation result for the command object.
Errors
BindingResult
All of the mentioned
None of the mentioned
3. To notify its completion of session processing.
Errors
BindingResult
SessionStatus
None of the mentioned
4. Controller Class renders the objects passed by the controller’s handler method.
True
False
error
None of these
5. Parameter used to specify a configuration file.
contextConfigLocation
contextConfigure
contextLocation
none of these
6. The @RequestMapping annotation can be applied to the class level only.
True
False
error
None of these
7. Bean classes pre-registered in the web application context by default.
DefaultAnnotationHandlerMapping
AnnotationMethodHandlerAdapter
All of the mentioned
None of the mentioned
8. By default, @RequestMapping gets all the POST Requests.
True
False
error
None of these
9. Callback methods provided by HandlerInterceptor to implement.
preHandle()
postHandle()
afterCompletion()
all of the mentioned
10. Interface implemented by locale resolver.
localeResolver
tiles
front controller
none of the mentioned
11. You can define a locale resolver by registering a bean of type LocaleResolver in the web application context.
True
False
error
None of these
12. Default localeResolver used by Spring.
AcceptHeaderLocale
AcceptHeader
AcceptHeaderLocaleResolver
AcceptLocaleResolver
13. AcceptHeaderLocaleResolver esolves locales by inspecting the accept-language header of an HTTP request.
True
False
error
None of these
14. Alternative way to resolve locales.
AcceptHeaderLocale
AcceptHeader
AcceptHeaderLocaleResolver
SessionLocaleResolver
15. Property which indicates how many seconds this cookie should be persisted.
cookieMaxAge
cookieName
cookieAge
none of the mentioned
16. Method used to change user’s locale.
set
setLocale
locale
set_locale
17. Property of LocaleChangeInterceptor used to customize parameter name.
localeResolver.setLocale
paramName
locale.parm
none of the mentioned
18. LocaleChangeInterceptor can only detect the parameter for the handler mappings that enable it.
True
False
error
None of these
19. Parameter which can change user’s locale by any URL.
locale
languageURL
language
none of the mentioned
20. Interface used to resolve text messages.
Message
Message_Source
Language
MessageSource
21. Tag used by view to resolve text messages.
spring:message
spring:language
spring:title
none of the mentioned
22. The ResourceBundleMessageSource implementation resolves messages for different locales.
True
False
error
None of these
23. cookieName is used by localeResolver to customize the cookie used.
True
False
error
None of these
24. The cookieMaxAge value when browser is closed.
0
1
-1
true
25. Interface for Dispatcher Servlet to auto detect view resolver beans.
localeResolver
tiles
ViewResolver
none of the mentioned
26. ViewResolver which maps each view name tol an application’s directory.
InternalViewResolver
InternalResourceViewResolver
InternalResolver
None of the mentioned
27. InternalResourceViewResolver resolves view names into view objects of type.
JstlView
Jst Library
View
None of the mentioned
28. By default, XmlViewResolver loads view beans from /WEB-INF/views.xml which is final.
True
False
error
None of these
29. View beans from a resource bundle is loaded by.
ResourceBundleViewResolver
ResourceBundleView
ResourceViewResolver
None of the mentioned
30. Views that can’t be resolved by InternalResourceViewResolver.
redirect
redirect:prefix
redirect:suffix
all of the mentioned
31. Properties used to determine the correct content and type for a certain web requests.
The URL extension provided in a request
The HTTP Accept header
All of the mentioned
None of the mentioned
32. Inspection of header is done by which of the following.
InternalViewResolver
ContentNegotiatingViewResolver
ContentNegotiating
InternalResolver
33. ContentNegotiatingViewResolver resolver configuration sets up the resolver to have the highest priority among all resolvers.
True
False
error
None of these
34. The ContentNegotiatingViewResolver resolver first determines the media type for a request based on which of the following criteria?
It checks a request path extension
If a request path has an extension but no match can be found in the default mediaTypes section of the ContentNegotiatingViewResolver bean
If no extension is present in a request path, the HTTP Accept header of the request is used
All of the mentioned
35. In a Spring MVC application, you can register one or more exception resolver beans in the web application context to resolve uncaught exceptions.
True
False
error
None of these
36. To configure the exception mappings in the web application context.
SimpleMappingExceptionResolver
ExceptionResolver
ExceptionViewResolver
None of the mentioned
37. Annotation which allows a controller’s field to be assigned using Spring Expression Language(SpEL)
@Value
@After
@Default
@None
38. SpEL statements are recognizable.
True
False
error
None of these
39. Tag, used to define a location in which to place errors in case a form.
form
form:GET
form:POST
form:errors
40. To validate Java beans in a web application using annotations.
XML
Java Based
JAR-303 standard
All of the mentioned
41. Spring MVC supports generating Excel files using which of the following libraries.
Apache POI library
JExcelAPI library
All of the mentioned
None of the mentioned
42. To use JSR-303 bean validation in a web application, dependencies to be added in maven.
javax.validation
org.hibernate
all of the mentioned
none of the mentioned
43. Annotation which indicates a field cannot be a null.
@NotNULL
@NotNull
All of the mentioned
none of the mentioned
44. Annotation used to indicate a field has to have a minimum of 2 characters.
@NotNull
@Size
@MaxSize
@size
45. Annotation which receives a value in the form regexp=”.+@.+\.[a-z]+”.
@Pattern
@EmailRecognizer
@Email
@Null
46. A field named validator is of type.
javax.validation.Validator
javax.validation.ValidatorFactory
javax.validation.ValidatorFactor
none of the mentioned
47. Validator field is not assigned to any bean, but rather a factory class of the type.
javax.validation.Validator
javax.validation.ValidatorFactory
javax.validation.ValidatorFactor
none of the mentioned
48. To hold any errors detected from validating the instance of beans.
javax.validation.Validator
javax.validation.ValidatorFactory
javax.validation.ValidatorFactor
javax.validation.ConstraintViolation
49. Spring doesn’t cope up with pdf and excel views.
True
False
error
None of these
50. The view classes for Excel view is/are:-
AbstractExcelView
AbstractJExcelView
None of the mentioned
All of the mentioned
Submit