Computer Networks interview questions & answers
A computer network is a set of interconnected devices that exchange data using agreed protocols. Networking is organized into layers, modeled by the OSI and TCP/IP stacks, where each layer handles a specific concern such as addressing, reliable delivery, or routing. Interviews test how data flows from one machine to another and the trade-offs between the protocols involved.
Updated 2026-06-18 · 16 real, commonly-asked questions with answers.
Key takeaways
- A computer network is a set of interconnected devices that exchange data using agreed protocols.
- Core areas to revise for Computer Networks: OSI & TCP/IP models, TCP vs UDP, IP addressing & subnetting, DNS & HTTP/HTTPS, Routing & switching.
- This guide answers 16 of the most-asked Computer Networks interview questions — rehearse them in OnJob's free AI mock interview.
Top 16 Computer Networks interview questions
Q1.What is the difference between TCP and UDP?
TCP is connection-oriented and reliable: it establishes a connection, guarantees ordered delivery, and retransmits lost packets, at the cost of overhead. UDP is connectionless and unreliable: it sends datagrams with no handshake, ordering, or retransmission, making it faster and lower-latency. TCP suits web and file transfer, while UDP suits streaming, gaming, and DNS.
Q2.Explain the OSI model and its layers.
The OSI model is a seven-layer conceptual framework for network communication: Physical, Data Link, Network, Transport, Session, Presentation, and Application. Each layer serves the one above it and is served by the one below, isolating concerns like bit transmission, addressing, and reliable delivery. It is a teaching model; real networks largely follow the simpler TCP/IP stack.
Q3.What happens when you type a URL into a browser?
The browser resolves the domain to an IP address via DNS, then opens a TCP connection (and a TLS handshake for HTTPS) to the server. It sends an HTTP request, the server returns the HTML response, and the browser parses it and fetches additional resources like CSS, JavaScript, and images. Finally it renders the page.
Q4.What is the TCP three-way handshake?
The three-way handshake establishes a TCP connection in three steps: the client sends a SYN, the server replies with SYN-ACK, and the client responds with ACK. This synchronizes sequence numbers and confirms both sides can send and receive. Only after it completes does data transfer begin.
Q5.What is the difference between an IP address and a MAC address?
An IP address is a logical, layer-3 address that can change and is used to route packets across networks. A MAC address is a physical, layer-2 address burned into a network interface and used for delivery within a single local network. IP gets a packet to the right network; MAC gets it to the right device on that network.
Q6.How does DNS work?
DNS translates human-readable domain names into IP addresses. A resolver queries a hierarchy starting at the root servers, then the top-level-domain servers, then the domain's authoritative servers, caching results along the way. This caching at multiple levels reduces lookups and speeds up resolution.
Q7.What is the difference between HTTP and HTTPS?
HTTP transmits data in plaintext, so it can be read or tampered with in transit. HTTPS layers TLS encryption over HTTP, encrypting the data, authenticating the server through certificates, and protecting integrity. HTTPS is now the standard because it secures user data and is favored by browsers and search engines.
Q8.What is a subnet mask?
A subnet mask divides an IP address into a network portion and a host portion, defining which addresses belong to the same local network. For example, a mask of 255.255.255.0 reserves the first three octets for the network and the last for hosts. Subnetting improves routing efficiency and security by segmenting a larger network into smaller ones.
Q9.What is the difference between a switch and a router?
A switch operates at layer 2 and forwards frames within a local network using MAC addresses. A router operates at layer 3 and forwards packets between different networks using IP addresses, choosing paths and connecting your network to the internet. In short, switches connect devices in one network; routers connect networks together.
Q10.What is the difference between TCP flow control and congestion control?
Flow control prevents a fast sender from overwhelming a slow receiver, managed through the receiver's advertised window. Congestion control prevents a sender from overwhelming the network itself, using mechanisms like slow start and congestion avoidance to adjust the sending rate. Flow control protects the endpoint; congestion control protects the shared network.
Q11.What is the difference between the OSI model and the TCP/IP model?
The OSI model has seven layers and is a theoretical reference, while the TCP/IP model has four (or five) layers and describes how the internet actually works. TCP/IP combines OSI's application, presentation, and session layers into one application layer. TCP/IP is protocol-driven and practical; OSI is conceptual and used for teaching.
Q12.What is a port number and why is it needed?
A port number is a 16-bit identifier that distinguishes multiple network services running on the same IP address. When a packet arrives, the transport layer uses the destination port to deliver it to the correct application, such as port 80 for HTTP or 443 for HTTPS. Ports let one host run many services and many simultaneous connections.
Q13.What is DHCP?
DHCP (Dynamic Host Configuration Protocol) automatically assigns IP addresses and network settings like gateway and DNS to devices joining a network. A client broadcasts a request, a DHCP server offers an address, the client requests it, and the server acknowledges, leasing it for a set time. This removes the need for manual IP configuration.
Q14.What is the difference between forward proxy and reverse proxy?
A forward proxy sits in front of clients and forwards their requests to the internet, often for filtering, caching, or anonymity. A reverse proxy sits in front of servers and forwards incoming requests to them, providing load balancing, caching, SSL termination, and security. The forward proxy hides clients; the reverse proxy hides servers.
Q15.What is latency versus bandwidth?
Latency is the time it takes for a single piece of data to travel from source to destination, measured in milliseconds. Bandwidth is the maximum amount of data that can be transferred per unit of time, measured in bits per second. A connection can have high bandwidth yet high latency, like a satellite link, which affects responsiveness differently than throughput.
Q16.What is the difference between symmetric and asymmetric encryption?
Symmetric encryption uses a single shared key to both encrypt and decrypt, making it fast but requiring a secure way to exchange the key. Asymmetric encryption uses a public-private key pair, where data encrypted with one key is decrypted with the other, solving key exchange but being slower. TLS combines both: asymmetric to exchange a key, then symmetric for the bulk data.
More interview topics
Practise & prepare
Practise Computer Networks out loud
Reading answers is step one. Rehearse them in OnJob's free AI mock interview, get instant feedback, then apply to AI-matched jobs in one click.