Web services with Spring Boot Flashcards
What is a web service in the context of Java development?
a) A method with a graphical user interface (GUI)
b) A method exposed to and run on the web without a GUI
c) A standalone desktop application
d) A database management system
b) A method exposed to and run on the web without a GUI
What is Spring Boot primarily used for?
a) Building desktop applications
b) Quickly building and deploying standalone Java web applications
c) Managing databases
d) Creating graphical user interfaces
b) Quickly building and deploying standalone Java web applications
What is the purpose of the Spring Initializr?
a) To manage database connections
b) To quickly build and configure starting project files for Spring Boot
c) To create graphical user interfaces
d) To debug Java applications
b) To quickly build and configure starting project files for Spring Boot
Which of the following is NOT a dependency added in the Spring Initializr for the weather application?
a) Spring Web
b) Vaadin
c) Spring Data for Apache Cassandra
d) Spring Security
d) Spring Security
What is the purpose of the pom.xml file in a Maven project?
a) To define the graphical user interface
b) To manage project dependencies and configurations
c) To store database credentials
d) To define RESTful endpoints
b) To manage project dependencies and configurations
What does the MVC design pattern stand for?
a) Model, View, Controller
b) Main, View, Controller
c) Model, View, Configuration
d) Main, View, Configuration
a) Model
What is the role of the Controller in the MVC pattern?
a) To handle the structure of the data
b) To manage the user interface
c) To abstract the model from the view and handle data requests
d) To store data in the database
c) To abstract the model from the view and handle data requests
What annotation is used to define a class as a RESTful controller in Spring Boot?
a) @Controller
b) @RestController
c) @RequestMapping
d) @GetMapping
b) @RestController
What annotation is used to specify the base service name for a RESTful controller in Spring Boot?
a) @Controller
b) @RestController
c) @RequestMapping
d) @GetMapping
c) @RequestMapping
What HTTP method is used to retrieve data in a RESTful service?
a) POST
b) PUT
c) GET
d) DELETE
c) GET
What is the purpose of the @GetMapping annotation in Spring Boot?
a) To define a POST endpoint
b) To define a GET endpoint
c) To define a PUT endpoint
d) To define a DELETE endpoint
b) To define a GET endpoint
What is the default port used by the embedded Tomcat server in Spring Boot?
a) 8080
b) 80
c) 443
d) 3000
a) 8080
What is the purpose of the ResponseEntity class in Spring Boot?
a) To define the structure of the data
b) To manage the user interface
c) To represent the entire HTTP response, including status code and body
d) To store data in the database
c) To represent the entire HTTP response
What HTTP response code is returned by the ResponseEntity.ok() method?
a) 200
b) 404
c) 500
d) 403
a) 200
What is the purpose of the curl command in the context of testing RESTful services?
a) To create a new web service
b) To make HTTP requests from the command line
c) To manage database connections
d) To debug Java applications
b) To make HTTP requests from the command line