Unit 3: API Development and Server Actions - Subjective Questions

INT257 — Modern Web Application Development • Practice Questions with Detailed Answers

20 questions

1

Define a route handler in a modern web application framework. Explain its purpose and describe the main steps involved in creating one.

2

Explain the principles of REST APIs and describe how resources, endpoints, and representations are used in RESTful design.

3

Compare the HTTP methods GET, POST, PUT, PATCH, and DELETE with respect to their purposes, safety, and idempotency.

4

Describe dynamic route handlers and explain how route parameters are used to retrieve or modify a specific resource.

5

Explain how a server should process an incoming request and construct an appropriate response in a route handler.

6

Distinguish between path parameters, query parameters, headers, cookies, and request bodies. Give one suitable use case for each.

7

Design a REST API for managing students. Specify suitable endpoints, HTTP methods, request data, and response status codes for the main operations.

8

Explain the role of HTTP status codes and describe the status codes most commonly used in API development.

9

What are server actions? Explain how they differ from conventional client-side event handlers and API route handlers.

10

Describe the complete lifecycle of handling a form submission with a server action.

11

Explain form validation in a web application. Compare client-side validation and server-side validation, and discuss why both may be used.

12

Develop a validation strategy for a registration form containing a name, email address, password, and password confirmation.

13

Explain how file uploads work in web applications and describe the purpose of multipart/form-data and FormData.

14

Design a secure file-upload workflow for profile images, including validation, storage, error handling, and access control.

15

What is a data mutation? Explain the responsibilities of a server action or route handler that creates, updates, or deletes data.

16

Explain how authentication and authorization should be applied to API route handlers and server actions.

17

Compare route handlers and server actions as mechanisms for implementing data mutations. Include their advantages, limitations, and suitable use cases.

18

Derive a robust request and response flow for a POST /api/orders endpoint that creates an order from a JSON request body.

19

What is an optimistic UI update? Explain its sequence of operations and contrast it with a pessimistic update.

20

Describe how to implement rollback and error recovery for an optimistic update that modifies a task's completion status.