Networking/Security Interview Questions

20 Networking/Security interview questions with worked answers, complexity notes, and runnable code you can edit in the browser — ordered easy to hard so you build up steadily. Free, no signup. Open any question for the full answer.

How the web moves data, and how it defends users

This section joins two topics that live together in practice: how HTTP actually works, and how the browser’s security model protects people from a web where any page can talk to any server. Start with the protocol. An HTTP message is a start line, headers, and an optional body; methods and status codes carry meaning you are expected to use correctly (idempotency, the difference between 401 and 403, what 304 buys you). Caching and conditional requests are where real latency wins hide, and the protocol’s evolution — HTTP/1.1’s head-of-line blocking, HTTP/2’s multiplexing, HTTP/3 over QUIC — is a story about removing bottlenecks one layer at a time.

The security half starts from the same-origin policy: by default a page cannot read the response from another origin, and CORS is the server’s way of granting specific exceptions. Cookies, and the SameSite attribute, decide what rides along on cross-site requests, which is the crux of CSRF. TLS is what makes any of this trustworthy on a hostile network.

From there the questions cover the vulnerability classes every frontend engineer must reason about — XSS, CSRF, clickjacking, and supply-chain risk — alongside the layered defenses that contain them: context-aware escaping, a Content Security Policy, security headers, and Subresource Integrity. The hardest questions are design decisions: where to store auth tokens and why, the OAuth and OIDC authorization-code flow with PKCE, choosing a real-time transport, and building request handling that survives retries, rate limits, and flaky connections. The recurring lesson is defense in depth — no single header or escape saves you, and knowing why each layer exists is what the interview is checking.

Easy

Medium

Hard

Other topics

HTML/CSS · Browser · JavaScript · TypeScript · React · System Design · Accessibility · Web Performance · Testing · DSA

← Search all 265 questions