Week 3 JBDL

Last Updated :
Discuss
Comments

Question 1

What makes a REST API "RESTful"?

  •  It only uses HTTP GET requests

  • It relies on a uniform interface, stateless communication, client-server architecture, layered system, and optional cacheability

  • It uses both XML and JSON data formats for responses

  •  It is built using Java's Spring MVC framework

Question 2

In Spring MVC, what is the purpose of the @Controller annotation?

  •  It marks the class as a servlet

  •  It marks the class as a Spring Bean

  •  It marks the class as a web request handler

  •  It marks the class as a DAO (Data Access Object)

Question 3

What is the purpose of the @EnableWebMvc annotation in Spring MVC?

  • It enables the traditional Java EE web application features

  • It enables the auto-configuration feature of Spring Boot

  •  It enables the WebSocket support in the application

  •  It enables the Spring MVC features and provides sensible defaults

Question 4

What is the purpose of the @EnableWebMvc annotation in Spring MVC?

  • It enables the traditional Java EE web application features

  • It enables the auto-configuration feature of Spring Boot

  •  It enables the WebSocket support in the application

  •  It enables the Spring MVC features and provides sensible defaults

Question 5

What are idempotent methods in RESTful API?

  • They perform an action that the server remembers and repeats automatically

  •  They perform the same action no matter how many times the request is repeated

  • They perform a different action every time the request is repeated

  • They perform an action only once, even if the request is repeated

Question 6

In Spring MVC, what does the @RequestBody annotation do?

  •  It maps the HttpRequest body to a transfer or domain object

  •  It handles the entire request including both metadata and data

  • It binds a method parameter to a web request header

  •  It maps a method return value to be bound to the web response body
     

Question 7

How does Lombok help in a Spring MVC project?

A. 

B.

C.

  • It generates boilerplate code like getters, setters, constructors, etc., at compile-time

  •  It creates database tables based on entity classes

  •  It helps in creating REST endpoints

  •  It is used for managing project dependencies

Question 8

In cURL, how would you send a POST request with JSON data?

Question 9

If you were to test a REST API using POSTMAN, how would you send data in JSON format in a POST request?

  • Add the data to the "Headers" section

  • . Add the data to the "Body" section, and set the format to "JSON"

  • Add the data to the "Params" section

  •  Add the data to the "Authorization" section

Question 10

Which of the following HTTP status codes indicates a successful POST request in REST API?


 

  • 200 OK

  • 201 Created

  • 400 Bad Request

  • 500 Internal Server Error

Tags:

There are 20 questions to complete.

Take a part in the ongoing discussion