CS Fundamentals · Fresher-relevant
Computer Networks interview questions on OSI model, TCP/IP, DNS, HTTP/HTTPS, subnetting, and network security fundamentals.
What is the difference between TCP and UDP?
Tip: TCP is connection-oriented, reliable, ordered, and flow/congestion-controlled (HTTP, email, file transfer). UDP is connectionless, unreliable, and low-latency with no handshake (DNS, VoIP, gaming, video). Choose TCP when correctness matters, UDP when speed and tolerance to loss matter.
Explain the TCP three-way handshake.
Tip: SYN (client → server with initial seq), SYN-ACK (server acknowledges and sends its seq), ACK (client acknowledges). This synchronises sequence numbers and establishes a reliable connection before data flows. Connection teardown uses a four-way FIN/ACK exchange.
What happens when you type a URL into a browser and press Enter?
Tip: DNS resolves the domain to an IP → TCP connection (and TLS handshake for HTTPS) → HTTP request sent → server responds → browser parses HTML, fetches CSS/JS/images, builds the DOM/CSSOM, and renders. Caching (DNS, browser, CDN) short-circuits many steps. Mention each layer to show depth.
What are the layers of the OSI model?
Tip: Physical, Data Link, Network, Transport, Session, Presentation, Application (mnemonic: "Please Do Not Throw Sausage Pizza Away"). Map them to real protocols: IP at Network, TCP/UDP at Transport, HTTP/DNS at Application. The TCP/IP model collapses these into 4 layers.
How does DNS resolution work?
Tip: The resolver checks caches, then queries the root server → TLD server (.com) → authoritative name server for the domain, returning the IP. Records are cached per their TTL. Record types: A (IPv4), AAAA (IPv6), CNAME (alias), MX (mail), NS (name server).
What is the difference between HTTP and HTTPS, and how does TLS work?
Tip: HTTPS is HTTP over TLS, providing encryption, integrity, and server authentication. The TLS handshake uses asymmetric crypto to verify the certificate and agree on a shared symmetric session key, then encrypts traffic with that faster symmetric key. It defends against eavesdropping and tampering.
What is the difference between a switch, a router, and a hub?
Tip: A hub blindly repeats signals to all ports (Layer 1). A switch forwards frames to specific ports using MAC addresses (Layer 2). A router connects different networks and forwards packets by IP address, choosing routes (Layer 3).
Explain how HTTP status codes and methods convey request outcomes.
Tip: Methods: GET (read, safe), POST (create), PUT/PATCH (update), DELETE (remove). Status ranges: 2xx success, 3xx redirect, 4xx client error (404, 401, 403, 429), 5xx server error. Together they make HTTP a self-describing, stateless protocol.
InterviewEra generates role-specific questions using your actual projects and skills. Get scored feedback on technical depth, clarity, and structure — free to start.