Module quiz: Web APIs :Frontend development:Full Stack Web Development(Full Stack Web Development) Answers 2025
1. Question 1
Which HTTP method replaces the entire resource?
-
❌ GET
-
❌ DELETE
-
❌ POST
-
✔️ PUT
2. Question 2
Fetch API improvement:
-
✔️ Remove the Content-Type header.
-
❌ Change method to POST.
-
❌ No changes needed.
-
❌ Add trailing slash.
Reason: GET requests should not have a Content-Type header because they have no body.
3. Question 3
How does @RequestMapping add flexibility?
-
❌ Only maps one method.
-
❌ Automatically routes by content type.
-
❌ Only for GET.
-
✔️ Allows one endpoint to respond to multiple HTTP methods.
4. Question 4
Validate incoming request data:
-
❌ Include try-catch
-
❌ @RequestParam
-
✔️ @Valid
-
❌ Remove @PostMapping
Correct: public String registerUser(@Valid User user)
5. Question 5
Benefit of HATEOAS:
-
❌ Automatically validate requests
-
❌ Handles all errors
-
❌ Faster response time
-
✔️ Clients navigate via links included in responses
6. Question 6
Fix the DELETE endpoint:
-
❌ Use return
-
❌ Change String to Integer
-
❌ Change to @RequestMapping
-
✔️ Add @PathVariable
Correct:
public void deleteProduct(@PathVariable String id)
7. Question 7
Best AWS service for storing large files:
-
❌ EC2
-
✔️ S3
-
❌ Lambda
-
❌ RDS
8. Question 8
AWS Lambda auto-scales based on requests:
-
❌ False
-
✔️ True
9. Question 9
PUT request body in Fetch API:
-
✔️ JSON.stringify(data)
-
❌ data.toJSON()
-
❌ JSON.parse(data)
-
❌ data
10. Question 10
AWS service used with JDBC MySQL endpoint:
-
❌ Lambda
-
✔️ RDS
-
❌ S3
-
❌ EC2
📘 Summary Table
| Q.No | Correct Answer | Summary |
|---|---|---|
| 1 | ✔️ PUT | Replaces entire resource. |
| 2 | ✔️ Remove Content-Type | GET should not send Content-Type. |
| 3 | ✔️ Multi-method mapping | @RequestMapping supports GET/POST/PUT/DELETE. |
| 4 | ✔️ @Valid | Validates input. |
| 5 | ✔️ Navigation via links | HATEOAS benefit. |
| 6 | ✔️ @PathVariable | Needed to bind {id}. |
| 7 | ✔️ S3 | Stores large files efficiently. |
| 8 | ✔️ True | Lambda auto-scales. |
| 9 | ✔️ JSON.stringify(data) | Correct body format. |
| 10 | ✔️ AWS RDS | Managed relational database. |