Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 3 MCQs API Development and Server Actions

INT257 — Modern Web Application Development 60 questions. Pick an option to check it.

Read the notes Subjective questions

0 of 60 answered 0 right 0 wrong , 60 left

  1. Question 1 of 60 Route Handlers Easy

    What is the main purpose of a route handler?

  2. Question 2 of 60 REST APIs Easy

    What does REST commonly describe in web development?

  3. Question 3 of 60 HTTP Methods Easy

    Which HTTP method is commonly used to retrieve data?

  4. Question 4 of 60 HTTP Methods Easy

    Which HTTP method is commonly used to create new data?

  5. Question 5 of 60 Dynamic Route Handlers Easy

    What does a dynamic route usually contain?

  6. Question 6 of 60 Dynamic Route Handlers Easy

    In a route such as /users/42, what might 42 represent?

  7. Question 7 of 60 Request and Response Handling Easy

    What does a server receive from a client in a web request?

  8. Question 8 of 60 Request and Response Handling Easy

    What does a server send back after processing a request?

  9. Question 9 of 60 Request and Response Handling Easy

    Which status code usually means that a request succeeded?

  10. Question 10 of 60 Server Actions Easy

    What is a server action designed to do?

  11. Question 11 of 60 Server Actions Easy

    Which task is a suitable use for a server action?

  12. Question 12 of 60 Form Handling Easy

    What is the purpose of a form in a web application?

  13. Question 13 of 60 Form Handling Easy

    Which event commonly occurs when a user sends a form?

  14. Question 14 of 60 Form Validation Easy

    What is the main purpose of form validation?

  15. Question 15 of 60 Form Validation Easy

    Which input would usually fail validation for an email field?

  16. Question 16 of 60 File Upload Easy

    Which HTML control is commonly used to select a file?

  17. Question 17 of 60 File Upload Easy

    Which object commonly represents an uploaded file in web APIs?

  18. Question 18 of 60 Data Mutations Easy

    What is a data mutation?

  19. Question 19 of 60 Optimistic UI Updates Easy

    What is an optimistic UI update?

  20. Question 20 of 60 Optimistic UI Updates Easy

    What should an application do if an optimistic update fails on the server?

  21. Question 21 of 60 Route Handlers Medium

    A route handler receives a POST /api/orders request containing JSON. Which sequence is most appropriate for creating the order?

  22. Question 22 of 60 Route Handlers Medium

    A route handler must return a JSON object containing { "status": "ok" }. Which response is most suitable?

  23. Question 23 of 60 REST APIs Medium

    Which endpoint design best follows REST conventions for retrieving one product with ID 42?

  24. Question 24 of 60 REST APIs Medium

    A client requests a collection of published articles with pagination. Which design is most appropriate?

  25. Question 25 of 60 HTTP Methods Medium

    A user changes the title of an existing article and sends the complete updated article representation. Which HTTP method is the best fit?

  26. Question 26 of 60 HTTP Methods Medium

    Which status code best indicates that a new account was successfully created by a POST request?

  27. Question 27 of 60 Dynamic Route Handlers Medium

    A dynamic route is defined as /api/users/[id]. A request arrives at /api/users/73. What should the handler use to identify the requested user?

  28. Question 28 of 60 Dynamic Route Handlers Medium

    A request to /api/posts/abc cannot find a post with ID abc. What should the dynamic route handler normally return?

  29. Question 29 of 60 Request and Response Handling Medium

    A client sends invalid JSON to an endpoint that expects a JSON body. How should the handler respond?

  30. Question 30 of 60 Request and Response Handling Medium

    An API endpoint returns a list of users but must prevent browsers and intermediaries from reusing stale data. Which response behavior is most relevant?

  31. Question 31 of 60 Server Actions Medium

    A form invokes a server action that inserts a record into a database. Which security practice is still required?

  32. Question 32 of 60 Server Actions Medium

    After a server action updates a product name, the page still displays the old cached product data. What is the most appropriate follow-up?

  33. Question 33 of 60 Form Handling Medium

    A form submits a username and a profile image to a server action. Which encoding is needed to transmit both fields correctly?

  34. Question 34 of 60 Form Handling Medium

    A form should show a pending indicator while its server action is running and then disable the submit button. What is the best approach?

  35. Question 35 of 60 Form Validation Medium

    A registration form checks that an email is present in the browser. Why must the server repeat this validation?

  36. Question 36 of 60 Form Validation Medium

    A form requires a product quantity to be an integer from 1 through 10. Which server-side rule correctly enforces this requirement?

  37. Question 37 of 60 File Upload Medium

    An upload endpoint accepts profile images. Which validation combination provides the strongest basic protection?

  38. Question 38 of 60 File Upload Medium

    A user uploads a file named ../../avatar.png. What is the safest storage behavior?

  39. Question 39 of 60 Data Mutations Medium

    A delete operation is requested for an invoice that does not exist. Which behavior is generally most useful for an idempotent API?

  40. Question 40 of 60 Data Mutations Medium

    Two users edit the same document. Which technique best helps prevent one update from silently overwriting a newer update?

  41. Question 41 of 60 Route Handlers Hard

    A Next.js App Router project contains app/reports/page.tsx. A developer adds app/reports/route.ts to expose a JSON endpoint at /reports, and the build reports a route conflict. Which change correctly resolves the conflict while preserving both interfaces?

  42. Question 42 of 60 REST APIs Hard

    An API paginates orders sorted by createdAt DESC. New orders may share timestamps and may be inserted while clients paginate. Which cursor design most reliably prevents skipped or duplicated records?

  43. Question 43 of 60 HTTP Methods Hard

    A client times out after sending a payment-creation request and cannot determine whether the server committed it. Which API design best permits a safe retry without creating a second payment?

  44. Question 44 of 60 Dynamic Route Handlers Hard

    A handler is defined at app/api/docs/[[...slug]]/route.ts. Assuming the route parameters have been resolved, what values should it expect for requests to /api/docs and /api/docs/guides/install?

  45. Question 45 of 60 Request and Response Handling Hard

    A Route Handler must verify an HMAC over the exact raw request body and then parse the same body as JSON. Which approach is valid with the Fetch Request API?

  46. Question 46 of 60 Request and Response Handling Hard

    A Route Handler must set two cookies with different attributes in one response. Which implementation preserves both cookies correctly?

  47. Question 47 of 60 Server Actions Hard

    A Server Action called by an authenticated page receives accountId from submitted form data and deletes that account. What security check is essential inside the action?

  48. Question 48 of 60 Form Handling Hard

    A Server Action has the signature updateUser(userId, formData). Which expression correctly supplies userId while allowing <form action={...}> to provide the submitted FormData?

  49. Question 49 of 60 Form Validation Hard

    A registration form performs schema validation in the browser. The associated Server Action writes directly to the database without validating again. Which revision provides the correct trust boundary and supports field-level errors?

  50. Question 50 of 60 File Upload Hard

    A Route Handler accepts multi-gigabyte uploads, but await request.formData() followed by await file.arrayBuffer() exhausts memory. Which architecture best addresses the problem?

  51. Question 51 of 60 Data Mutations Hard

    An endpoint transfers credits by decrementing one balance, incrementing another, and inserting a ledger entry. Which implementation preserves consistency when a database operation fails halfway through?

  52. Question 52 of 60 Optimistic UI Updates Hard

    A user renames the same item twice before the first mutation finishes. The first request fails after the second optimistic rename has been displayed. What rollback strategy avoids overwriting the newer state?

  53. Question 53 of 60 Route Handlers Hard

    A browser sends a cross-origin PUT request with Content-Type: application/json and an Authorization header. The API's PUT handler is correct, but the browser never sends the actual request. What is the most likely missing behavior?

  54. Question 54 of 60 REST APIs Hard

    A POST /exports request starts a long-running export and returns before processing is complete. Which response most accurately represents the REST semantics?

  55. Question 55 of 60 HTTP Methods Hard

    Two administrators retrieve version 7 of a document. One updates it to version 8; the other then submits changes based on version 7. Which HTTP mechanism best prevents the second update from silently overwriting the first?

  56. Question 56 of 60 Dynamic Route Handlers Hard

    A multi-tenant handler uses /api/tenants/[tenantId]/invoices/[invoiceId]. The session proves the user belongs to tenant A, but the URL specifies tenant B. What should the handler do before retrieving the invoice?

  57. Question 57 of 60 Request and Response Handling Hard

    A successful DELETE operation has no representation to return. Which response is valid according to HTTP semantics?

  58. Question 58 of 60 Server Actions Hard

    A Server Action wraps its mutation and redirect("/dashboard") inside a broad try...catch. Successful submissions unexpectedly return the generic error state instead of navigating. What is the correct fix?

  59. Question 59 of 60 Optimistic UI Updates Hard

    A client optimistically inserts comments using temporary IDs. The server returns the persisted comment with a canonical ID and normalized text. What is the correct reconciliation behavior?

  60. Question 60 of 60 File Upload Hard

    An upload endpoint stores files using the client-provided File.name under a public directory. Which design best mitigates path traversal, collisions, and misleading file-type metadata?

That's unit 3

Answer a few questions and your score shows up here.