Level 4 exam — harder

Exam — fresh questions

4.1 · Recall

1. In a REST API, what carries the action (create, read, delete)?

URL = plural resource; the action comes from the HTTP method.
4.2 · Recall

2. How to store a user password correctly?

Compare at login without ever decrypting; never homemade.
4.3 · Recall

3. What does a WebSocket allow compared to classic HTTP?

Connection continuously open, messages in both directions.
4.1 · Application

4. Salim creates a product via POST /api/v1/produits. Which codes does the front end expect?

201 after creation, 400 if invalid, 404 if resource missing.
4.1 · Application

5. Salim's API grows: where to place the product-creation logic?

Routes (URLs) → controllers (logic) → models (data).
4.2 · Application

6. A request arrives without a token on /mon-compte (Salim's protected route). Response?

401 = unauthenticated; 403 = authenticated but not allowed.
4.3 · Application

7. Salim wants a chat per shop. How to isolate conversations?

Rooms: who joins what, broadcast at the right scope.
4.4 · Application

8. A client sends { prix: -5 } without a name to Salim's API. What to do?

Validate before processing; clear 400, never a sensitive leak.
4.4 · Application

9. Where to place Salim's Express error-handling middleware?

Centralised last: a single error format for the whole API.
4.2 · Arbitration

10. Salim finds his JWT secret hardcoded in a commit pushed to Git. First reflex?

Secret outside code and outside Git; immediate rotation after exposure.
4.3 · Arbitration

11. 40 sellers poll the API “anything new?” every second and the server saturates. Salim's call?

Push via an open connection instead of re-asking in a loop.
4.4 · Arbitration

12. On the eve of a release, Salim hesitates to write tests (“it already works”). What to decide?

Non-regression: the green suite before each merge frees up changes.
What's next?
Back to the guideGuide contents