• Tutorials
  • Courses
  • Tracks

Advanced Java Quiz Day 60

Last Updated :
Discuss
Comments

Question 1

What is the main difference between @Controller and @RestController?

  • @Controller is for APIs, @RestController is for views

  • @RestController returns data, @Controller returns views

  • @Controller is faster

  • No difference

Question 2

Which annotation is used to create a RESTful controller in Spring Boot?

  • @Controller

  • @RestController

  • @Service

  • @Component

Question 3

Which dependency is required for REST APIs in Spring Boot?


  • spring-boot-starter-data-jpa

  • spring-boot-starter-web

  • spring-boot-starter-thymeleaf

  • spring-boot-starter-security

Question 4

Which annotation maps HTTP GET requests in Spring Boot?

  • @PostMapping

  • @GetMapping

  • @RequestBody

  • @RequestParam

Question 5

By default, @RestController methods return data in which format?

  • HTML

  • JSON

  • XML only

  • JSP

Question 6

Which annotation is used to bind a variable from the URL path?

  • @PathVariable

  • @RequestParam

  • @RequestBody

  • @Variable

Question 7

If you use @Controller for a REST API, what else is needed to return JSON?

  • @JsonResponse

  • @ResponseBody

  • @Service

  • @Entity

There are 7 questions to complete.

Take a part in the ongoing discussion