Interview questions
What happens when you type a URL into the browser and press Enter?
How I'd answer: Tell Chapter 13 in about 3 minutes, in order: URL parsing → DNS (caches, then resolver → root → TLD → authoritative) → routing to the default gateway, ARP, NAT → TCP handshake → TLS handshake with certificate check → HTTP request with cookie → CDN/load balancer, TLS termination → app server and database → response with status and caching headers → browser parses, fetches subresources over the same connection, renders.
Then offer to go deeper: "I can go deeper into any step — DNS caching, the TLS handshake, or how the server side handles it." Interviewers usually pick one. Choose to go deep where you're strongest.
Combines: every Foundations file.
What's the difference between PUT and PATCH, and what does idempotent mean?
How I'd answer: "PUT replaces the whole resource with what I send; PATCH changes only the fields I send. Idempotent means doing the request once or many times leaves the server in the same state. GET, PUT and DELETE are idempotent — deleting the same note twice still leaves it deleted. POST isn't — posting twice creates two notes. PATCH usually isn't guaranteed to be, for example 'increment the counter'.
It matters because networks fail after the server has done the work but before the client gets the answer. Idempotent requests are safe to retry automatically. For non-idempotent ones like payments, I'd use an idempotency key: the client sends a unique ID, and the server stores the result per key, so a retry returns the original result instead of charging twice."
Combines: Ch 4, and Networking 2: TCP, UDP and Ports Ch 6.
How does HTTPS work? What stops someone in the middle from pretending to be the server?
How I'd answer: "HTTPS is HTTP over TLS. After the TCP handshake, the client sends a ClientHello with the TLS versions and ciphers it supports, a key-exchange share, and the site name — SNI. The server replies with its own key share, its certificate chain, and a signature proving it owns the certificate's private key. Both sides then derive the same symmetric key through Diffie–Hellman, and everything after that is encrypted with a fast symmetric cipher like AES. In TLS 1.3 that's one round trip.
What stops an impostor is the certificate. It binds the domain to a public key and is signed by a certificate authority, through intermediates, up to a root that's pre-installed in my OS. An attacker can't produce a valid certificate for studybuddy.app, and can't forge the signature without the real private key. And because keys are ephemeral, we get forward secrecy — a stolen key later can't decrypt old traffic."
Combines: Ch 10, 11.
Users in Europe say StudyBuddy is slow; users in India don't. The servers are in Mumbai. What would you do?
How I'd answer: "It's likely latency, not server load. Europe to Mumbai is maybe 120–150 ms round trip, and a fresh page load costs several round trips — DNS, TCP, TLS, the request — plus each extra resource. First I'd measure: time-to-first-byte and the number of round trips from Europe.
Fixes, cheapest first: put a CDN in front, so static files and cacheable responses come from a European edge; make sure
connections are reused, HTTP/2 or HTTP/3 are on, and TLS 1.3 is used, to cut round trips; set good Cache-Control headers.
If the dynamic API calls are still slow, then consider deploying app servers in a European region — which brings up the
harder question of where the data lives, a system design topic."
Combines: Ch 8, 9, 11, 12; latency from How Computers Work Ch 6; Networking 2: TCP, UDP and Ports Ch 12.
What's the difference between 401 and 403? Between 502 and 504?
How I'd answer: "401 means unauthenticated — the server doesn't know who you are, so log in or send a valid token. 403 means authenticated but not allowed — it knows who you are and the answer is no.
502 and 504 both come from a proxy or load balancer in front of the app. 502 Bad Gateway means the upstream app sent back something invalid or dropped the connection — often it crashed or was restarting. 504 Gateway Timeout means the upstream didn't answer within the proxy's timeout — the app is too slow, so I'd look at slow queries or blocked workers."
Combines: Ch 5, 12.