Models & layers
What are the layers of the OSI model?
Seven layers, top to bottom: Application, Presentation, Session, Transport, Network, Data Link, Physical. A common mnemonic is 'All People Seem To Need Data Processing'. Each layer serves the one above and is served by the one below.
OSI model vs TCP/IP model?
OSI is a seven-layer conceptual reference model. TCP/IP is the four-layer (Application, Transport, Internet, Network Access) model the internet actually runs on. OSI's top three layers roughly map to TCP/IP's Application layer, and OSI's bottom two to Network Access.
What is encapsulation in networking?
As data moves down the layers, each layer wraps it with its own header (and sometimes trailer): the transport layer adds a segment header, the network layer an IP header, the data link layer a frame header/trailer. The receiver reverses this, stripping headers on the way up.
Transport layer: TCP & UDP
TCP vs UDP?
TCP is connection-oriented and reliable: it guarantees ordered, error-checked delivery with acknowledgements and retransmission, at the cost of overhead. UDP is connectionless and unreliable: no handshake, ordering or retransmission, but low latency. Use TCP for web/email/file transfer, UDP for streaming, gaming, DNS and VoIP.
What is the TCP three-way handshake?
To establish a connection: the client sends SYN, the server replies SYN-ACK, and the client sends ACK. This synchronises sequence numbers on both sides before data flows. Closing uses a four-way handshake with FIN/ACK exchanges.
How does TCP ensure reliable delivery?
Through sequence numbers (to order and detect missing segments), acknowledgements and retransmission of unacked data, checksums for error detection, and flow control (a receive window) plus congestion control to avoid overwhelming the network.
What is the difference between flow control and congestion control?
Flow control stops a fast sender from overwhelming a slow receiver, using the receiver's advertised window. Congestion control stops senders from overwhelming the network itself, using algorithms like slow start and congestion avoidance that shrink the sending rate when loss is detected.
Network layer: IP & routing
IPv4 vs IPv6?
IPv4 uses 32-bit addresses (about 4.3 billion, now exhausted) written as four decimal octets. IPv6 uses 128-bit addresses written in hexadecimal groups, giving a practically unlimited space, plus built-in features like simpler headers and no need for NAT.
Private vs public IP, and what is NAT?
Public IPs are globally routable; private IPs (like 192.168.x.x, 10.x.x.x) are reused inside local networks and aren't routable on the internet. NAT (Network Address Translation) lets many private devices share one public IP by rewriting addresses/ports at the router.
What is subnetting?
Subnetting splits a network into smaller sub-networks by extending the network portion of the address with a subnet mask (or CIDR prefix like /24). It improves routing efficiency, reduces broadcast traffic, and organises address allocation.
Router vs switch vs hub?
A hub blindly repeats bits to all ports (Layer 1). A switch forwards frames only to the destination port using MAC addresses (Layer 2). A router forwards packets between different networks using IP addresses and routing tables (Layer 3).
Application layer: HTTP, DNS & the URL walkthrough
What happens when you type a URL and press Enter?
The browser resolves the domain to an IP via DNS (checking caches first), opens a TCP connection (and a TLS handshake for HTTPS), sends an HTTP request, the server returns a response, and the browser renders it - fetching additional resources (CSS, JS, images) as needed. It's a favourite because it touches every layer.
What is DNS and how does resolution work?
DNS maps human-readable domain names to IP addresses. A resolver queries a hierarchy - root servers, then the TLD server (.com), then the domain's authoritative name server - caching results along the way to speed up future lookups.
HTTP vs HTTPS?
HTTP sends data in plaintext. HTTPS wraps HTTP in TLS, encrypting the traffic, verifying the server's identity with a certificate, and protecting integrity. It defends against eavesdropping and tampering, and is now the default for the web.
What are common HTTP status code categories?
2xx success (200 OK), 3xx redirection (301 moved permanently), 4xx client errors (404 not found, 401 unauthorised), and 5xx server errors (500 internal error, 503 unavailable). Knowing a handful of specific codes is worth it.
How to actually get ready
Reading these answers builds recognition, but interviews test recall under pressure. Practise retrieving, not re-reading: take timed MCQ rounds on the OSI model and TCP/UDP first, because those anchor everything else, then read the explanation for anything you miss and revisit weak spots the next day.
Networks rarely comes up alone in placements. It's usually bundled with operating systems and DBMS in the core-CS round, so interleave those so you're ready when the interviewer moves from 'explain the three-way handshake' to 'now explain a deadlock' without warning.
