HomeInterview QuestionsComputer Networks Interview QuestionsTop 10
🌐
Free Study Guide · 2025

Top 10 Computer NetworksInterview Questions & Answers (2025)

Computer Networks is tested in every core CS interview at TCS, Infosys, Wipro, Amazon, and Cisco. Whether you're applying for software engineering or networking roles, these questions on OSI layers, TCP vs UDP, DNS, HTTP, and routing are asked repeatedly at every level.

10 questions
Detailed answers
100% free
Also available:Top 20All 20 questions →
1What is the OSI model? Name all 7 layers.
The OSI (Open Systems Interconnection) model is a conceptual framework for how network communication works. 7 layers (top to bottom): 7. Application (HTTP, FTP, SMTP — user-facing protocols). 6. Presentation (encryption, encoding, compression — SSL/TLS). 5. Session (establish, manage, terminate sessions). 4. Transport (end-to-end delivery, segmentation — TCP/UDP). 3. Network (logical addressing, routing — IP, ICMP). 2. Data Link (MAC addressing, framing, error detection — Ethernet, Wi-Fi). 1. Physical (bits over wire/wireless — cables, signals). Mnemonic: 'All People Seem To Need Data Processing.'
2What is the TCP/IP model and how does it map to OSI?
TCP/IP is the practical 4-layer model used in the internet. Application layer (maps to OSI 5+6+7 — HTTP, DNS, FTP, SMTP). Transport layer (OSI 4 — TCP, UDP). Internet layer (OSI 3 — IP, ICMP, ARP). Network Access/Link layer (OSI 1+2 — Ethernet, Wi-Fi). TCP/IP is descriptive (what the internet actually does); OSI is prescriptive (a reference model). All real internet communication uses TCP/IP — OSI is used for understanding and troubleshooting.
3What is the difference between TCP and UDP?
TCP (Transmission Control Protocol): connection-oriented (three-way handshake), reliable (guarantees delivery, ordering, no duplicates), flow control, congestion control, slower. Use for: HTTP/HTTPS, email, file transfer, databases. UDP (User Datagram Protocol): connectionless, unreliable (no guarantee of delivery, order, or deduplication), no handshake, much lower overhead, faster. Use for: DNS (fast lookups), video streaming, online gaming, VoIP — where speed matters more than perfection. UDP packets are called datagrams.
4What is the TCP three-way handshake?
The three-way handshake establishes a TCP connection before data transfer: 1. SYN: client sends a segment with SYN flag set and a random initial sequence number (ISN) to the server. 2. SYN-ACK: server responds with SYN+ACK flags, acknowledging the client's ISN+1 and sending its own ISN. 3. ACK: client sends ACK acknowledging the server's ISN+1. Now both sides know each other's sequence numbers and the connection is established. Connection teardown uses a four-way handshake (FIN, ACK, FIN, ACK).
5What is an IP address? What is the difference between IPv4 and IPv6?
An IP address is a logical identifier assigned to a device on a network, used for routing packets. IPv4: 32-bit, written as 4 decimal octets (192.168.1.1), supports ~4.3 billion addresses — exhausted in 2011. IPv6: 128-bit, written as 8 groups of 4 hex digits (2001:0db8:85a3::8a2e:0370:7334), supports ~3.4×10³⁸ addresses, built-in IPsec, simpler header, no broadcast (uses multicast). IPv6 adoption is growing but many networks still use IPv4 with NAT to extend address space.
6What is DNS and how does it work?
DNS (Domain Name System) translates human-readable domain names (google.com) to IP addresses. Resolution steps: 1. Browser checks its cache. 2. OS checks its cache + /etc/hosts. 3. Query sent to Recursive Resolver (ISP or 8.8.8.8). 4. Resolver queries Root Name Server (knows TLD servers). 5. Resolver queries TLD Name Server (.com server — knows authoritative NS). 6. Resolver queries Authoritative Name Server (returns the actual IP). 7. IP cached at each level with TTL. DNS uses UDP on port 53 (TCP for large responses or zone transfers).
7What is the difference between a hub, switch, and router?
Hub (Layer 1): broadcasts all data to all ports — no intelligence, creates collisions, obsolete. Switch (Layer 2): uses MAC address table to forward frames only to the correct port — no collisions, creates separate collision domains. Router (Layer 3): routes packets between different IP networks using IP addresses and routing tables — connects your LAN to the internet, performs NAT. Summary: hub broadcasts blindly, switch forwards intelligently within a LAN, router connects different networks and makes forwarding decisions based on IP.
8What is NAT (Network Address Translation)?
NAT translates private IP addresses (192.168.x.x, 10.x.x.x) to one public IP address for internet communication, and vice versa for return traffic. This extends IPv4 address space — thousands of devices can share one public IP. The router maintains a NAT table mapping (private IP:port ↔ public IP:port). Types: Static NAT (one-to-one), Dynamic NAT (pool of public IPs), PAT/NAPT (many-to-one using ports — most common home router setup). Downside: NAT breaks true end-to-end connectivity (problems for P2P, VoIP, gaming).
9What is the difference between HTTP and HTTPS?
HTTP (HyperText Transfer Protocol): application-layer protocol for transferring web content, port 80, plaintext — all data is visible to anyone intercepting traffic. HTTPS: HTTP over TLS (Transport Layer Security), port 443, encrypted. TLS uses asymmetric encryption (RSA/ECDH) to exchange a symmetric key, then encrypts all traffic with that key. HTTPS prevents eavesdropping, tampering, and man-in-the-middle attacks. TLS also authenticates the server via a digital certificate signed by a Certificate Authority. Always use HTTPS — Chrome now marks HTTP sites as 'Not Secure.'
10What are HTTP methods (verbs)?
GET: retrieve a resource (no body, idempotent, cacheable). POST: submit data to create a resource (has body, not idempotent). PUT: replace a resource entirely (idempotent). PATCH: partial update of a resource (not necessarily idempotent). DELETE: remove a resource (idempotent). HEAD: like GET but returns only headers, no body — used to check if resource exists. OPTIONS: returns supported methods for a URL (used in CORS preflight). Idempotent means calling it multiple times has the same effect as calling it once.
See all 20 Computer Networks questions →
Level up your prep
Get company-specific Computer Networks questions
Upload your resume → get questions tailored to Google, Amazon, TCS, and 50+ companies.
Try AI Interview Prep →
© 2025 CareerLens · Home · Interview Questions · Pricing