Show List

Quiz - Spring MVC - 3

56%

Public Average Score
Select the right answer for below questions:

What is the main role of the DispatcherServlet in a Spring MVC application?
To route incoming requests to appropriate controllers
To manage the lifecycle of the application
To handle transactions and database access
To render views for the response
To route incoming requests to appropriate controllers

What is the purpose of the @Controller annotation in Spring MVC?
To indicate that a class is a service and can be autowired into other components
To indicate that a class is a repository and can access the database
To indicate that a class is a controller and can handle incoming requests
To indicate that a class is a model and can hold data for the view
To indicate that a class is a controller and can handle incoming requests

What is the purpose of the @RequestMapping annotation in Spring MVC?
To map a URI template variable to a method parameter
To map a URL to a controller method
To map a request parameter to a method parameter
To map a header value to a method parameter
To map a URL to a controller method

What is the purpose of the @Valid annotation in Spring MVC?
To enable data validation for request parameters
To enable data validation for form submissions
To enable data validation for model attributes
To enable data validation for URI template variables
To enable data validation for form submissions

What is the purpose of the @Validated annotation in Spring MVC?
To enable data validation for request parameters
To enable data validation for model attributes
To enable data validation for form submissions
To enable data validation for URI template variables
To enable data validation for form submissions

How can you define custom validation rules in Spring MVC?
By using the @Validated annotation and creating custom validation annotations
By using the @Valid annotation and creating custom validator classes
By using the @Validated annotation and creating custom validator classes
By using the @Valid annotation and creating custom validation annotations
By using the @Valid annotation and creating custom validator classes

How can you define default error pages in Spring MVC?
By configuring error pages in the web.xml file
By configuring error pages in the application.properties file
By using the @ControllerAdvice annotation and creating custom error handling methods
By using the @ExceptionHandler annotation and creating custom error handling methods
By configuring error pages in the web.xml file

How can you define a custom error page for a specific exception type in Spring MVC?
By configuring error pages in the web.xml file
By configuring error pages in the application.properties file
By using the @ControllerAdvice annotation and creating custom error handling methods
By using the @ExceptionHandler annotation and creating custom error handling methods
By using the @ExceptionHandler annotation and creating custom error handling methods

What is the purpose of the @ResponseBody annotation in Spring MVC?
To indicate that the return value of a controller method should be written to the response body
To indicate that the return value of a controller method should be written to the response header
To indicate that the return value of a controller method should be written to the response status code
To indicate that the return value of a controller method should be written to the response cookies
To indicate that the return value of a controller method should be written to the response body

What is the purpose of the @ResponseStatus annotation in Spring MVC?
To set the content type of the response
To set the status code of the response
To set the encoding of the response
To set the language of the response
To set the status code of the response

Submit
Retry
{"qz1-717914":"To route incoming requests to appropriate controllers","qz1-717915":"To indicate that a class is a controller and can handle incoming requests","qz1-717916":"To map a URL to a controller method","qz1-717917":"To enable data validation for form submissions","qz1-717918":"To enable data validation for form submissions","qz1-717919":"By using the @Valid annotation and creating custom validator classes","qz1-717920":"By configuring error pages in the web.xml file","qz1-717921":"By using the @ExceptionHandler annotation and creating custom error handling methods","qz1-717922":"To indicate that the return value of a controller method should be written to the response body","qz1-717923":"To set the status code of the response"}

    Leave a Comment


  • captcha text