Loading

Quipoin Menu

Learn • Practice • Grow

spring / REST Controller & HTTP Methods
mcq
Direction: Choose the correct option

Q1.

What is @RestController?
A. A convenience annotation that combines @Controller and @ResponseBody
B. A controller for REST
C. Both A and B
D. None
Direction: Choose the correct option

Q2.

How do you map a method to HTTP GET in a REST controller?
A. @GetMapping
B. @RequestMapping(method=GET)
C. Both A and B
D. @PostMapping
Direction: Choose the correct option

Q3.

What does @PostMapping do?
A. Maps HTTP POST requests to handler methods
B. Maps HTTP GET
C. Maps HTTP PUT
D. Maps HTTP DELETE
Direction: Choose the correct option

Q4.

How do you handle a PUT request in a REST controller?
A. @PutMapping
B. @PatchMapping
C. @PostMapping
D. @RequestMapping(method=PUT)
Direction: Choose the correct option

Q5.

Which annotation is used for DELETE mapping?
A. @DeleteMapping
B. @GetMapping
C. @PostMapping
D. @RequestMapping(method=DELETE)
Direction: Choose the correct option

Q6.

What is the purpose of @PatchMapping?
A. To handle partial updates with PATCH
B. To handle full updates
C. To handle creation
D. To handle deletion
Direction: Choose the correct option

Q7.

How do you extract a path variable from URL?
A. @PathVariable
B. @RequestParam
C. @RequestBody
D. @ModelAttribute
Direction: Choose the correct option

Q8.

How do you access query parameters in a REST controller?
A. @RequestParam
B. @PathVariable
C. @RequestBody
D. @QueryParam
Direction: Choose the correct option

Q9.

What does @RequestBody do?
A. Binds the HTTP request body to a method parameter
B. Binds form data
C. Binds path variable
D. Binds query parameter
Direction: Choose the correct option

Q10.

How do you customize the HTTP response status?
A. @ResponseStatus
B. Return ResponseEntity
C. Both A and B
D. @Status