Interview Prep11 min read

Computer Networks Interview Questions with Answers (2026)

Computer networks is one of the most reliably asked core-CS subjects in placements and backend interviews - and the questions barely change year to year. Understand the layered models, how TCP and UDP differ, how an IP packet finds its way, and what happens when you type a URL, and you'll answer the vast majority of what's asked. Here are those questions, grouped by area, each with a concise answer.

A laptop showing connected network nodes, a routing diagram and packet icons travelling between a client and a server, representing computer networks

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.

The bottom line

Now go test yourself

Computer networks is one of the most predictable interview subjects - the same layered models, the same TCP-versus-UDP contrast, the same 'what happens when you type a URL' walkthrough come up every cycle. Understand the concepts rather than memorising definitions and you'll handle the follow-ups comfortably.

The fastest way to find out whether you truly understand networking - rather than just recognise the terms - is to be tested on it. Start a computer networks quiz, answer from memory, and let the explanations catch every gap before an interviewer does.

FAQs

Frequently asked questions

What topics should freshers focus on for a computer networks interview?

The OSI and TCP/IP models, TCP versus UDP and the three-way handshake, IP addressing and subnetting, routers/switches/hubs, and the application layer - HTTP/HTTPS, DNS, and the 'what happens when you type a URL' walkthrough.

What is the most common computer networks interview question?

The difference between TCP and UDP, closely followed by the OSI model layers and 'what happens when you type a URL and press Enter'. Be able to answer all three fluently and you've covered the core.

How do I explain TCP vs UDP quickly?

TCP is reliable and connection-oriented - ordered, acknowledged, error-checked delivery with a handshake, used for web and file transfer. UDP is fast and connectionless - no ordering or retransmission, used for streaming, gaming, DNS and VoIP.

Is computer networks important for software placements?

Yes. Along with operating systems and DBMS, it's a core-CS subject nearly every service company and many product companies test, usually in the technical round before or alongside coding.

What is the difference between the OSI and TCP/IP models?

OSI is a seven-layer conceptual reference model; TCP/IP is the four-layer model the internet actually runs on. OSI is useful for understanding and teaching, while TCP/IP describes real protocols in use.

Are these networking questions enough to clear placement tests?

They cover the networks portion well. Most placement tests also include aptitude, reasoning, operating systems and DBMS, so pair networking practice with those sections for full coverage.

How many computer networks questions should I practise?

Quality beats quantity. Master the core questions above - the models, TCP/UDP, IP addressing and the application layer - until you can answer each from memory, then drill them as timed MCQs and review every miss.

Related quizzes

Put it into practice

Keep reading

Related articles

Browse all articles →

Test yourself in two minutes

Six adaptive questions, every answer explained by an AI tutor. Free.

▶ Start an AI quiz