Computer Networking, Protocols & Web Communication Master Interview Bank
OSI 7-Layer model, TCP 3-way handshake & flow control, UDP, TLS 1.3 encryption handshake, HTTP/1.1 vs HTTP/2 vs HTTP/3 (QUIC), DNS, and WebSockets.
Curriculum Roadmap & Learning Path
3 StagesPart 1: Basic & Foundational Concepts (Junior / Entry-Level)
10 QuestionsWhat is the difference between the OSI 7-Layer Model and the TCP/IP 4-Layer Model?
OSI 7-Layer Model (Conceptual / Educational) • Physical (Cables, radio waves) • Data Link (Ethernet, MAC addresses, switches) • Network (IP routing, routers).
How does the TCP 3-Way Handshake establish a connection?
Before exchanging data, TCP establishes a reliable connection: SYN (Synchronize): Client chooses an Initial Sequence Number (ISNC) and sends SYN packet to server • SYN-ACK: Server acknowledges (ACK = ISNC + 1), chooses its own sequence number (ISNS), and sends SYN-ACK • ACK: Client acknowledges (ACK = ISNS + 1).
How does the TCP 4-Way Handshake terminate a connection?
Terminates connections gracefully in both directions: FIN: Client sends FIN (signals it has no more data to send) • ACK: Server sends ACK (acknowledges client's close; server can still send data) • FIN: When server finishes, it sends its own FIN.
What are the key differences between TCP and UDP?
TCP (Transmission Control Protocol) • Connection-oriented: Requires 3-way handshake • Reliable: Guarantees delivery via ACKs and retransmissions • In-Order: Segments reassembled in order.
What is an IP Address and what is CIDR notation?
IPv4: 32-bit address represented as 4 decimal octets (e.g. 192.168.1.1) • IPv6: 128-bit hexadecimal address (e.g. 2001:0db8::1) • CIDR (Classless Inter-Domain Routing): Appends a slash and prefix length (/24) indicating how many bits represent the Network Prefix.
How does DNS (Domain Name System) resolution work step-by-step?
Translates human-readable domain names (example.com) to IP addresses: Browser checks local cache -> OS cache -> Router cache • If miss, queries the Recursive Resolver (ISP or 8.8.8.8) • Recursive resolver queries the Root Nameserver (.) • Resolver queries the TLD Nameserver (.com).
What are the primary DNS Record Types (A, AAAA, CNAME, MX, TXT)?
A: Maps hostname to an IPv4 address (example.com -> 93.184.216.34) • AAAA: Maps hostname to an IPv6 address • CNAME (Canonical Name): Alias that maps one domain to another domain (www.example.com -> example.com) • MX (Mail Exchange): Directs email traffic to mail servers.
What are the common HTTP Request Methods and their Idempotency?
Idempotent: Executing the request multiple times produces the exact same server state as executing it once • GET, HEAD, OPTIONS: Safe (read-only) and Idempotent • PUT: Idempotent (replaces entire resource) • DELETE: Idempotent (deleting already-deleted resource leaves it deleted).
What are the common HTTP Status Code ranges?
1xx (Informational): 101 Switching Protocols (WebSocket upgrade) • 2xx (Success): 200 OK, 201 Created (POST success), 204 No Content (DELETE success) • 3xx (Redirection): 301 Moved Permanently (SEO link equity transferred), 302 Found (temporary redirect), 304 Not Modified (client cache hit).
What is CORS (Cross-Origin Resource Sharing) and the Preflight Request?
A browser security mechanism enforcing the Same-Origin Policy: An origin is defined by Protocol + Domain + Port • If a frontend on https://myapp.com makes an API call to https://api.com • Preflight Request: The browser automatically sends an HTTP OPTIONS request first.
Part 2: Core Architecture & Implementation (Mid-Level)
10 QuestionsWhat are the differences between HTTP/1.1, HTTP/2, and HTTP/3?
HTTP/1.1 (1997): Textual protocol • HTTP/2 (2015 - Binary & Multiplexing) • Binary framing layer (Headers + Data frames) • Multiplexing: Hundreds of requests and responses interleaved concurrently over one single TCP connection!.
How does the TLS 1.3 Handshake work and how does it compare to TLS 1.2?
TLS (Transport Layer Security) encrypts communication over HTTPS: TLS 1.2 (Legacy): Required 2 full round-trips (2-RTT) to negotiate cipher suites and exchange keys before sending application data • TLS 1.3 (Modern Standard).
How do WebSockets work and what is the HTTP Upgrade Handshake?
WebSockets provide persistent, bidirectional, full-duplex communication over a single TCP socket: Handshake: Begins as a standard HTTP request • GET /chat HTTP/1.1 • Upgrade: websocket • Connection: Upgrade.
What are Server-Sent Events (SSE) and when should you choose SSE over WebSockets?
SSE provides unidirectional real-time streaming from Server to Client over standard HTTP: Sent with Content-Type: text/event-stream • Browser natively handles auto-reconnection via the EventSource JavaScript API • Why Choose SSE over WebSockets • LLM AI chat streaming (ChatGPT text completion), live stock tickers, notification feeds.
What is the difference between REST, GraphQL, and gRPC?
REST: Resource-oriented URLs (GET /users/1), HTTP methods, JSON payloads • GraphQL: Query-language API • gRPC: High-performance RPC framework by Google.
What are Protocol Buffers (Protobuf) and why are they smaller than JSON?
Google's language-neutral, binary serialization mechanism: In JSON, field names like "customeremailaddress" are serialized as literal ASCII characters on every single message • In Protobuf, fields are declared with small integer field tags.
How does TCP Flow Control (Sliding Window) work?
Prevents a fast sender from overwhelming a slow receiver's buffer: The receiver advertises its available buffer space (Receive Window - rwnd) in every TCP ACK packet • The sender cannot send more bytes than the advertised rwnd.
How does TCP Congestion Control work (Slow Start, Congestion Avoidance, Fast Retransmit)?
Prevents the sender from overwhelming the intermediary network routers and links: Sender maintains a Congestion Window (cwnd) • Slow Start: Starts with a small cwnd (e.g. 10 MSS) and doubles exponentially every round-trip until reaching ssthresh.
What is CDN Edge Caching and how does Anycast Routing work?
A Content Delivery Network (CDN) caches static and dynamic assets across hundreds of edge Points of Presence (PoPs) worldwide: BGP Anycast Routing: Multiple CDN edge servers across different continents advertise the exact same IP address.
What are HTTP Caching Headers (`Cache-Control`, `ETag`, `Last-Modified`)?
Cache-Control: max-age=3600, public: Browser and CDNs cache the response for 1 hour without checking the server • Cache-Control: no-cache: Browser caches the response, but must revalidate with the origin server via ETag before using it! • Cache-Control: no-store: Never cache anything (banking, sensitive data).
Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
30 QuestionsWhat is TCP Head-of-Line (HoL) Blocking and how does QUIC eliminate it?
In TCP, all bytes are delivered as a strictly ordered byte stream: If Packet #3 is dropped in transit, Packets #4, #5, and #6 cannot be delivered to the application, even if they arrived safely! • In HTTP/2 (which runs on one TCP connection), a single dropped packet stalls all 50 multiplexed HTTP streams!
What is TCP BBR (Bottleneck Bandwidth and RTT) Congestion Control?
Traditional TCP algorithms (CUBIC, Reno) interpret packet loss as the sole signal of network congestion: On modern networks with lossy Wi-Fi, CUBIC falsely slashes throughput by 50% • Google BBR: Models the actual physical network • Measures the maximum Bottleneck Bandwidth and the minimum Round-Trip Time (RT_{prop}).
What are TLS Session Resumption and Session Tickets?
Allows returning clients to resume a secure TLS session without re-executing full key exchange: Session ID (Stateful): Server caches master secret in memory and gives client an ID • Session Tickets (RFC 5077 - Stateless): Server encrypts session state with a secret Server Ticket Encryption Key (STEK) and sends it to the client.
What is MTU (Maximum Transmission Unit) and Path MTU Discovery (PMTUD)?
MTU: The maximum size of an Ethernet packet that can traverse a physical link without fragmentation (standard Ethernet: 1,500 bytes) • Jumbo Frames: MTU of 9,000 bytes used in cloud data centers and SANs to reduce CPU interrupt overhead.
What is the difference between Layer 4 Load Balancing and Layer 7 Load Balancing?
Layer 4 (Transport / TCP/UDP): Operates strictly on IP and Port (e.g. AWS Network Load Balancer, IPVS, HAProxy in TCP mode) • Does not inspect HTTP headers or payload • Blazing fast, consumes minimal CPU, handles millions of connections, but cannot route based on URL path or cookies.
How does DNS Anycast prevent DDoS attacks on DNS infrastructure?
Root nameservers and Cloudflare/Google DNS use Anycast routing • The exact same IP (e.g. 1.1.1.1) is announced by thousands of data centers worldwide via BGP • A 500 Gbps DDoS attack launched from botnets in Europe is automatically absorbed and scrubbed locally by European edge routers, leaving American.
What is WebRTC and how does NAT Traversal work (STUN, TURN, ICE)?
WebRTC enables direct Peer-to-Peer (P2P) audio, video, and data streaming between browsers: The NAT Problem: Most home devices have private internal IPs (192.168.1.5) hidden behind home routers with Network Address Translation (NAT).
What is HTTP/2 HPACK Header Compression?
In HTTP/1.1, user cookies and user-agent headers send 1-2 KB of redundant text with every single asset request: HPACK: Uses two tables • Static Table: Predefined list of 61 common headers (e.g. :method: GET = Index 2) • Dynamic Table: Remembers headers sent earlier in the connection.
What is SSE vs WebSockets in terms of HTTP/2 Multiplexing?
WebSockets over HTTP/1.1: Each WebSocket connection consumes a dedicated TCP socket • SSE over HTTP/2: Streams events over the existing shared HTTP/2 TCP connection alongside normal fetch requests via multiplexing, consuming zero.
How do you implement Secure Cookie configuration (`HttpOnly`, `Secure`, `SameSite`)?
Essential defense against XSS and CSRF attacks: HttpOnly: Blocks client-side JavaScript (document.cookie) from reading the cookie, completely neutralizing XSS session theft! • Secure: Cookie is transmitted strictly over encrypted HTTPS connections.
What is GraphQL N+1 Problem and how does DataLoader solve it?
In GraphQL, nested resolvers execute independently: Querying 50 users and their posts triggers 1 SQL query for users + 50 SQL queries for posts (51 queries) • DataLoader: Solves this using Batching and In-Memory Caching • Batches all individual IDs requested within a single event loop tick into a single SQL query.
What is gRPC Streaming (Client, Server, Bidirectional)?
Leveraging HTTP/2 multiplexed streams, gRPC supports 4 communication patterns: Unary: Simple request-response • Server Streaming: Client sends one request; server streams back a continuous sequence of messages (e.g. real-time stock ticker).
What is TCP TIME_WAIT state and why does it last for 2MSL?
After sending the final ACK during connection close, the client enters TIME_WAIT for 2 Maximum Segment Lifetimes (2MSL, typically 60 seconds): Purposes • Ensures the final ACK arrived safely; if lost, the server retransmits FIN, and the client can re-ACK.
What is the difference between Reverse Proxy and Forward Proxy?
Forward Proxy: Sits in front of a client (user) • Reverse Proxy: Sits in front of backend web servers.
When should you choose gRPC over REST/JSON?
Choose gRPC • Internal backend microservices communication where network bandwidth and serialization CPU overhead must be minimized • Multi-language enterprise teams (Protobuf generates type-safe clients in Go, Java, Python, C++, TypeScript) • Workloads requiring full-duplex streaming.
HTTP/3 and QUIC Protocol: Replacing TCP with UDP, 0-RTT handshakes, and solving Head-of-Line blocking.
HTTP/2 multiplexed streams over a single TCP connection, but created TCP Head-of-Line Blocking: if a single network packet is dropped on flaky Wi-Fi, the OS kernel pauses all streams until that one lost TCP packet is retransmitted: QUIC / HTTP/3: Replaces TCP with UDP in user space.
TLS 1.3 Handshake vs TLS 1.2: 1-RTT connection setup and modern cryptographic security.
TLS 1.2 (Legacy): Required 2 full round-trips (2-RTT) between client and server just to negotiate keys and certificates before sending HTTP data • TLS 1.3 • Slashes handshake latency to 1 round-trip (1-RTT) by combining key exchange parameters with the initial ClientHello.
DNS Resolution Deep Dive: Recursive resolver, Root, TLD, and Authoritative nameservers.
What happens when you type google.com in a browser: Local Caches: Checks browser cache, OS cache (/etc/hosts), and router cache • Recursive Resolver (e.g. 1.1.1.1 / 8.8.8.8): Acts on behalf of the client • Queries Root Nameserver (.) -> Returns IPs of .com TLD nameservers.
TCP Flow Control vs Congestion Control: Sliding Window, BBR, and CUBIC.
Flow Control (End-to-End Receiver Protection): Prevents a fast sender from overwhelming a slow receiver's memory buffer • Congestion Control (Network Protection): Prevents senders from overwhelming the shared routers across the global internet.
BGP (Border Gateway Protocol) and Anycast: How the global internet routes traffic.
BGP: The routing protocol of the global internet that exchanges routing tables between Autonomous Systems (ASNs like Comcast, Cloudflare, AWS • Unicast: An IP address belongs to exactly one physical server in one building • Anycast: The exact same IP address is announced from hundreds of data centers globally.
WebSocket Handshake and Framing: HTTP 101 Switching Protocols and Masking.
Handshake: Initiates via standard HTTP GET with headers.
Cross-Origin Resource Sharing (CORS): Simple requests vs Preflight `OPTIONS`.
A browser security mechanism enforcing the Same-Origin Policy (Protocol, Domain, Port): Simple Requests (GET/POST with standard headers): Browser sends request directly, including Origin header.
WebTransport Protocol: Bidirectional, multiplexed communication over QUIC.
Modern replacement for WebSockets designed for gaming, cloud gaming, and live streaming: Runs natively over HTTP/3 / QUIC • Supports both Reliable Streams (ordered delivery like WebSockets) and Unreliable Datagrams (unordered, drop-tolerant packet delivery like UDP).
Content Delivery Networks (CDN) Architecture: Edge PoPs, Origin Shields, and Caching.
Edge PoPs (Points of Presence): Distributed servers close to users that serve cached static assets (images, CSS, JS) in < 10 ext{ms} • Origin Shield: A centralized intermediate caching layer between edge PoPs and the primary origin data center, protecting origin servers from.
IP Addressing and Subnetting: IPv4 vs IPv6, CIDR notation, and RFC 1918.
CIDR Notation (/24): Number of fixed network prefix bits • RFC 1918 Private Ranges: Reserved for local networks, unroutable on the public internet • 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.
TCP Keep-Alive vs HTTP Persistent Connections (`Keep-Alive` header).
Two completely different concepts operating at different OSI layers: HTTP Connection: keep-alive (Layer 7): Reuses the same underlying TCP connection to send multiple sequential HTTP requests and responses • TCP Keep-Alive (Layer 4): Operates at the OS socket level.
Zero-Trust Network Architecture: mTLS and Software-Defined Perimeters (SDP).
Traditional security relied on the "Castle and Moat" perimeter model (firewalls protecting the corporate intranet). Once inside, everything was trusted: Zero-Trust: "Never trust, always verify" • Every request must be authenticated, authorized, and encrypted, regardless of whether it originates inside the corporate LAN or across the.
Network MTU (Maximum Transmission Unit) and Path MTU Discovery (PMTUD).
MTU: Maximum packet size in bytes that can be transmitted over a physical link without fragmentation (standard Ethernet MTU = 1500 bytes; AWS • Path MTU Discovery (PMTUD): Senders set the DF (Don't Fragment) bit in the IP header.
HTTP Caching Headers Matrix: `ETag`, `no-cache`, `no-store`, and `immutable`.
HTTP Caching Headers Matrix: ETag, no-cache, no-store, and immutable.
Debugging Network Bottlenecks: `tcpdump`, Wireshark, `curl` timing metrics, and `ss`.
Essential CLI diagnostic tools for network engineers.