PrepPilotPractise free

Web Fundamentals interview questions

HTTP, cookies, sessions, CORS, auth flows, caching, TLS

17 questions · HTTP/2 · updated November 2026

Practise these as flashcards. One or two lines each; the ones you miss come back first.

Start free

Core questions

What are the main steps that occur when you enter a URL in the browser and press Enter?

The browser resolves the domain via DNS, establishes a TCP (or QUIC) connection, negotiates TLS if HTTPS is used, sends an HTTP request, receives the response, and then parses and renders the page, fetching additional resources as needed.

Name three common HTTP methods and what they are used for.

GET is used to retrieve data, POST is used to submit data to the server, and DELETE is used to remove resources. Each method signals a different intent to the server.

What does the HttpOnly flag on a cookie do?

The HttpOnly flag prevents JavaScript from accessing the cookie, which helps mitigate the risk of client-side script attacks like XSS stealing session cookies.

What is the purpose of TLS in web communication?

TLS encrypts data between the client and server, ensuring that sensitive information can't be read or tampered with by attackers during transmission.

Intermediate questions

How does HTTP/2 improve performance compared to HTTP/1.1?

HTTP/2 introduces multiplexing, allowing multiple requests and responses to be sent simultaneously over a single connection, reducing latency. It also compresses headers and supports server push, which further improves load times.

Explain the difference between SameSite=Strict and SameSite=Lax on cookies.

SameSite=Strict prevents cookies from being sent with any cross-site requests, providing strong CSRF protection. SameSite=Lax allows cookies to be sent with top-level navigations and GET requests, offering a balance between security and usability.

What triggers a CORS preflight request and what does it do?

A CORS preflight is triggered when a cross-origin request uses methods other than GET/POST or custom headers. The browser sends an OPTIONS request to the server to check if the actual request is allowed, based on the server's CORS headers.

Describe the Authorization Code flow with PKCE in OAuth 2.0.

The client app generates a code challenge and verifier, redirects the user to the authorization server, and after user consent, receives an authorization code. The client then exchanges the code and verifier for tokens, preventing interception attacks.

How does the ETag header help with HTTP caching?

ETag provides a unique identifier for a resource version. When the client makes a request with If-None-Match, the server can respond with 304 Not Modified if the resource hasn't changed, saving bandwidth and improving load times.

What is the difference between WebSockets and Server-Sent Events?

WebSockets provide bidirectional, persistent communication between client and server, suitable for real-time apps like chat. Server-Sent Events allow the server to push updates to the client over HTTP, but only in one direction.

How does a CDN use HTTP caching headers to serve content efficiently?

A CDN respects headers like Cache-Control and ETag to cache content at edge locations. When a user requests a resource, the CDN can serve it from cache if it's still valid, reducing latency and offloading the origin server.

What is SQL injection and how do you prevent it?

SQL injection is when attackers manipulate queries by injecting malicious SQL. I prevent it by always using parameterized queries or ORM methods that separate code from data, and by validating and sanitizing user inputs.

Senior questions

How would you debug a CORS error in a production web application?

See the answer in the app, free

What are the trade-offs between using session cookies and JWT tokens for authentication?

See the answer in the app, free

How would you mitigate XSS and CSRF vulnerabilities in a modern web app?

See the answer in the app, free

Explain how you would secure a WebSocket connection.

See the answer in the app, free

How do you handle certificate renewal and deployment in a large-scale web service?

See the answer in the app, free

More Developer fundamentals topics