Skip to content
Home/Resources/Software Development/Computer networks interview questions
Interview prep ยท Software Development

Computer Networks Interview Questions and Answers for Freshers: 32 Model Answers

Younus FardeenBy Younus FardeenUpdated 1 Dec 202610 min read
Short answer

Computer networks interviews test the OSI and TCP/IP models, IP addressing and subnetting, TCP versus UDP, the three-way handshake, DNS, HTTP and HTTPS, and supporting protocols such as ARP, DHCP and NAT. These 32 answers are two to four sentences each. A Python script verifies the subnet maths and runs a real TCP and UDP exchange.

On this pageModels and devices (Q1 to Q7)IP addressing and subnetting (Q8 to Q14)Transport: TCP and UDP (Q15 to Q20)DNS, HTTP, HTTPS and the browser (Q21 to Q28)Link layer, errors and security (Q29 to Q32)Practice checklistFrequently asked questions

For B.Tech, BCA and MCA students preparing for campus and fresher interviews, where networking sits beside operating systems and DBMS in the theory round. Protocol facts come from the RFCs and the IANA registry, opened on 1 December 2026. The Python script was run on Python 3.9.6 and the output quoted is what it printed.

Trends India shows interview-question searches for Java, Python, SQL, React and Node peaking from January to March, and those pages rank among the hub's recurring winners. The Search Console export of 26 November 2026 has no direct row for this page, so the "most asked" picks below are our reading, not data. Three deeper explainers go with this list: OSI model explained, TCP vs UDP difference and how HTTPS works explained.

Models and devices (Q1 to Q7)

OSI layerJobTCP/IP layerExamples
7 ApplicationServices for the userApplicationHTTP, DNS, SMTP
6 PresentationEncoding, encryptionApplicationTLS, JSON
5 SessionOpen, keep, close sessionsApplicationSession tokens
4 TransportEnd-to-end delivery, portsTransportTCP, UDP
3 NetworkAddressing and routingInternetIP, ICMP
2 Data linkDelivery on one link, MAC addressesLinkEthernet, Wi-Fi, ARP
1 PhysicalBits on the mediumLinkCable, radio
  • Q1. What is a computer network, and what are LAN, MAN and WAN? A set of devices that exchange data over links. A LAN covers a building or campus, a MAN a city and a WAN a country or the world. The internet is a network of networks.
  • Q2. Explain the OSI model. Seven layers, from physical to application, each serving the one above. It is a teaching model, and the table above maps each layer to the TCP/IP layer that replaced it in practice. The full walkthrough is in OSI model explained.
  • Q3. How does the TCP/IP model differ from OSI? TCP/IP has four layers (link, internet, transport, application) and merges OSI's top three and bottom two. It describes the protocols the internet really runs. OSI is the reference vocabulary.
  • Q4. What is encapsulation? Each layer wraps the data from the layer above with its own header: data becomes a segment (transport), a packet (network) and a frame (link). The receiver unwraps in reverse.
  • Q5. Hub, switch and router: what is the difference? A hub repeats bits to every port. A switch learns MAC addresses and forwards frames to the right port only. A router forwards packets between networks using IP addresses.
  • Q6. What is bandwidth, latency and throughput? Bandwidth is the maximum rate of a link. Latency is the delay for one bit or packet to arrive. Throughput is the rate you actually get, which is lower than bandwidth because of overhead and loss.
  • Q7. What is the difference between unicast, broadcast and multicast? Unicast goes to one receiver, broadcast to all on the local network and multicast to a chosen group.

IP addressing and subnetting (Q8 to Q14)

  • Q8. IPv4 versus IPv6? IPv4 uses 32-bit addresses, about 4.3 billion in all, written as four numbers such as 192.168.1.5. IPv6 uses 128 bits, written in hexadecimal, and removes the need for NAT. Both run side by side today.
  • Q9. What are private IP ranges? RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for use inside networks. They are not routed on the public internet, which is why home routers use NAT.
  • Q10. What is a subnet mask and CIDR notation? The mask marks which bits are the network part. /26 means 26 network bits and a mask of 255.255.255.192. CIDR lets you split or join blocks at any bit boundary instead of fixed classes A, B and C.
  • Q11. How many usable hosts are in a /26? A /26 has 6 host bits, so 2 to the power 6 is 64 addresses. Subtract the network and broadcast addresses to get 62 usable. The script below confirms 64 and 62 for 192.168.10.0/26.
  • Q12. How do you split 192.168.10.0/24 into four subnets? Borrow 2 bits to get /26. The blocks start at .0, .64, .128 and .192. The script lists the second block as 192.168.10.64/26.
  • Q13. What is NAT? Network address translation lets many devices with private addresses share one public IP. The router rewrites addresses and ports on the way out and keeps a table to send replies back to the right device.
  • Q14. What is the default gateway? The router address a device sends traffic to when the destination is outside its own subnet.

Transport: TCP and UDP (Q15 to Q20)

PointTCPUDP
ConnectionConnection-oriented, handshake firstConnectionless
DeliveryReliable, ordered, retransmits lost dataBest effort, may drop or reorder
ControlFlow and congestion controlNone built in
Header20 bytes minimum8 bytes
Typical useWeb, email, file transferDNS queries, streaming, games, QUIC
  • Q15. TCP or UDP, and when would you pick each? TCP when every byte must arrive in order, such as web pages and file transfer. UDP when speed matters more than perfect delivery, or the application handles loss itself, such as voice, games and DNS lookups. See TCP vs UDP difference.
  • Q16. Explain the TCP three-way handshake. The client sends SYN, the server replies SYN-ACK and the client sends ACK. After that both sides know each other's starting sequence numbers and data can flow. Closing uses FIN and ACK from each side.
  • Q17. How does TCP make delivery reliable? Sequence numbers order the bytes, acknowledgements confirm them, a timer triggers retransmission and a checksum detects corruption. Flow control stops the sender from overrunning the receiver, and congestion control backs off when the network is busy.
  • Q18. What is a port, and what is a socket? A port is a 16-bit number that picks the application on a host. A socket is one end of a connection: an IP address plus a port, and with TCP the pair of both ends identifies the connection. The script opens a TCP and a UDP socket on localhost.
  • Q19. Name well-known ports. HTTP 80, HTTPS 443, DNS 53, SSH 22, FTP 21, SMTP 25 and Telnet 23. The IANA registry is the authority.
  • Q20. What is the difference between flow control and congestion control? Flow control protects the receiver, using the window it advertises. Congestion control protects the network, with the sender slowing down after loss or delay.
import ipaddress, socket, threading
n = ipaddress.ip_network("192.168.10.0/26")
print(n.netmask, n.num_addresses, n.num_addresses - 2, n.network_address, n.broadcast_address)
print(list(ipaddress.ip_network("192.168.10.0/24").subnets(new_prefix=26))[1])
print(ipaddress.ip_address("192.168.1.5").is_private, ipaddress.ip_address("8.8.8.8").is_private)

srv = socket.socket(); srv.bind(("127.0.0.1", 0)); srv.listen(1)
port = srv.getsockname()[1]
def serve():
    conn, _ = srv.accept(); conn.sendall(conn.recv(100).upper()); conn.close()
threading.Thread(target=serve).start()
cli = socket.create_connection(("127.0.0.1", port))
cli.sendall(b"hello tcp"); print("TCP reply:", cli.recv(100)); cli.close(); srv.close()

u = socket.socket(socket.AF_INET, socket.SOCK_DGRAM); u.bind(("127.0.0.1", 0))
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.sendto(b"hello udp", u.getsockname()); data, _ = u.recvfrom(100); print("UDP got:", data)

Output:

255.255.255.192 64 62 192.168.10.0 192.168.10.63
192.168.10.64/26
True False
TCP reply: b'HELLO TCP'
UDP got: b'hello udp'

DNS, HTTP, HTTPS and the browser (Q21 to Q28)

  • Q21. What happens when you type a URL and press Enter? The browser checks its cache, asks DNS for the IP, opens a TCP connection (with a TLS handshake for HTTPS), sends an HTTP request, receives the response and renders the page, loading further resources the same way. It is the most asked question here, so practise saying it in 60 seconds.
  • Q22. How does DNS work? DNS turns names into IP addresses. A resolver asks the root servers, then the top-level domain servers, then the domain's authoritative server, and caches the answer for its time to live (TTL). It normally uses UDP on port 53.
  • Q23. Name common DNS record types. A (name to IPv4), AAAA (IPv6), CNAME (alias), MX (mail servers), NS (name servers) and TXT (free text such as verification).
  • Q24. What is the difference between HTTP and HTTPS? HTTPS is HTTP inside a TLS-encrypted connection, so content cannot be read or altered on the way and the server proves its identity with a certificate. The default port changes from 80 to 443. See how HTTPS works explained.
  • Q25. Which HTTP methods and status codes should I know? Methods: GET reads, POST creates, PUT replaces, PATCH changes part, DELETE removes. Status classes: 2xx success (200, 201), 3xx redirect (301, 302), 4xx client error (400, 401, 403, 404) and 5xx server error (500, 503). RFC 9110 defines them. See also REST API explained.
  • Q26. What are HTTP/1.1, HTTP/2 and HTTP/3? HTTP/1.1 sends one request at a time per connection. HTTP/2 multiplexes many requests over one TCP connection. HTTP/3 (RFC 9114) runs over QUIC, which uses UDP, to avoid one lost packet blocking every stream.
  • Q27. What are cookies, and how are they different from sessions? A cookie is a small value the server asks the browser to store and send back. A session keeps the real data on the server and often uses a cookie that holds only a session id.
  • Q28. What does a TLS handshake achieve? The server's certificate is checked, both sides agree on keys and algorithms and the rest of the traffic is encrypted. TLS 1.3 (RFC 8446) needs one round trip for a new connection.
  • Q29. What is ARP? The Address Resolution Protocol finds the MAC address that goes with an IPv4 address on the local network, by broadcasting a request and caching the reply. A MAC address is 48 bits and identifies a network card on its link.
  • Q30. What is DHCP? It hands out an IP address, mask, gateway and DNS server automatically when a device joins a network, usually as a time-limited lease.
  • Q31. How are transmission errors detected? Parity bits, checksums and cyclic redundancy checks (CRC) add redundant bits the receiver recomputes. Ethernet frames carry a CRC and IP and TCP carry checksums.
  • Q32. What is a firewall, and what is a VPN? A firewall allows or blocks traffic by rules on addresses, ports and state. A VPN builds an encrypted tunnel so traffic crosses an untrusted network as if on a private one.

Practice checklist

  1. Draw the seven OSI layers with one protocol each, then map them to TCP/IP.
  2. Do three subnetting problems by hand and check with ipaddress in Python as the script does.
  3. Say the 'URL to page' answer aloud until it takes under a minute and includes DNS, TCP, TLS and HTTP.
  4. Write a tiny TCP echo server yourself. It turns sockets and ports from vocabulary into something you have done. Ideas are in backend project ideas.
  5. Finish with operating system interview questions and DBMS interview questions so all three theory subjects are covered.

Frequently asked questions

What are the most asked computer networks interview questions?

No company publishes its question bank, so this is our reading. Expect the OSI model, TCP versus UDP, the three-way handshake, what happens when you type a URL, DNS, HTTP versus HTTPS and a subnetting calculation. Questions 2, 15, 16, 21, 22 and 24 above are the ones to master first.

How do I prepare computer networks for a fresher interview?

Learn the layer model once, then follow one request through it: DNS, TCP, TLS, HTTP. Practise subnetting on paper and check yourself with a script. Read the three linked explainers last, and use the browser's network tab to see real requests.

Is subnetting asked in software developer interviews?

Rarely in depth. Written tests and networking-heavy roles ask for hosts per subnet and a CIDR split. For developer roles it is enough to explain a mask, CIDR and private ranges, and to compute a /24 split as shown in Q12.

What is the difference between OSI and TCP/IP in an interview answer?

OSI has seven layers and is a reference model for discussion. TCP/IP has four layers and describes the protocols the internet actually uses. Say that, then map the layers: OSI's top three become TCP/IP's application layer.

Do I need to know HTTP/3 and QUIC for freshers?

A one-line answer is enough: HTTP/3 runs over QUIC, which uses UDP, to avoid head-of-line blocking from TCP. It shows you follow current web practice. Deep QUIC internals are not expected from freshers.

Which networking topics matter for backend developer roles?

Our reading: HTTP methods and status codes, TLS, DNS, TCP behaviour, ports and sockets, load balancers and timeouts. These come up in API and system design discussions, as in system design interview preparation.

Learn this with mentors

Programmes for builders and engineers with admissions open: live classes, mentors and project work.

Continue learning

Concept

OSI model

Seven OSI layers, TCP/IP mapping and one web request traced layer by layer

7 min read
Concept

TCP vs UDP

TCP vs UDP with a handshake walk-through and socket demos you can run

6 min read
Concept

How HTTPS works

HTTPS and TLS 1.3 explained, with a Python certificate reader

7 min read