Getting everything ready for you…

Loading courses, problems and your progress. This takes just a moment.

0s

Interview questions › Computer Networks

Computer Networks interview questions

1. What is a computer network?

Easy

A set of devices (computers, phones, servers) connected so they can share data and resources using agreed rules called protocols. Examples: LAN at home, the Internet.

2. What are LAN, MAN and WAN?

Easy

LAN covers a small area like a home or office (high speed, private). MAN covers a city. WAN covers large geographic areas — the Internet is the largest WAN.

3. Name the network topologies.

Easy

Bus, star, ring, mesh, tree and hybrid. Star (all devices connected to a central switch) is most common in LANs; mesh gives the most redundancy.

4. What are the 7 layers of the OSI model?

Easy

Physical, Data Link, Network, Transport, Session, Presentation, Application (bottom to top). Each layer provides services to the one above it.

5. What is the TCP/IP model?

Easy

The practical 4-layer model used on the Internet: Network Access (link), Internet (IP), Transport (TCP/UDP) and Application (HTTP, DNS, SMTP).

6. OSI vs TCP/IP?

Medium

OSI is a 7-layer reference model; TCP/IP is a 4-layer implementation model used on the Internet. TCP/IP merges OSI's session, presentation and application layers into one application layer, and physical + data link into network access.

7. TCP vs UDP?

Easy

TCP is connection-oriented and reliable (ordered delivery, acknowledgements, retransmission, flow and congestion control) — used by HTTP, email, file transfer. UDP is connectionless, faster with no guarantees — used for video calls, gaming, DNS, live streaming.

8. Explain the TCP 3-way handshake.

Easy

Client sends SYN (seq x) → server replies SYN-ACK (seq y, ack x+1) → client sends ACK (ack y+1). After this, both sides have agreed on initial sequence numbers and the connection is established.

9. How is a TCP connection terminated?

Medium

With a 4-way exchange: one side sends FIN, the other ACKs; then the other side sends its own FIN, which is ACKed. The side that closed first waits in TIME_WAIT before fully closing.

10. What is flow control vs congestion control?

Medium

Flow control prevents the sender from overwhelming the receiver (receiver-advertised window). Congestion control prevents overloading the network (slow start, congestion avoidance, fast retransmit/recovery).

11. What is an IP address? IPv4 vs IPv6?

Easy

A logical address that identifies a device on a network. IPv4 is 32-bit (~4.3 billion addresses, dotted decimal). IPv6 is 128-bit (huge space, hex notation), with built-in auto-configuration and no need for NAT.

12. What is a MAC address?

Easy

A 48-bit hardware address burned into a network interface card, written in hex (e.g. 00:1A:2B:3C:4D:5E). It identifies a device on the local network (data link layer).

13. IP address vs MAC address?

Easy

An IP address is logical, can change, works at layer 3 and is used for routing across networks. A MAC address is physical, fixed to the NIC, works at layer 2 and is used for delivery within a local network.

14. What is ARP?

Easy

Address Resolution Protocol finds the MAC address for a given IP address on the local network by broadcasting a request; the owner replies with its MAC.

15. What is DNS and how does it work?

Easy

The Domain Name System translates domain names to IP addresses. A resolver checks caches, then asks a root server → TLD server (.com) → authoritative server for the domain, and caches the answer for its TTL.

16. What is DHCP?

Medium

Dynamic Host Configuration Protocol automatically gives devices an IP address, subnet mask, gateway and DNS server. Process: Discover → Offer → Request → Acknowledge (DORA).

17. What is NAT?

Medium

Network Address Translation lets many devices with private IPs share one public IP. The router rewrites addresses/ports in packets and keeps a translation table. It saves IPv4 addresses and hides internal hosts.

18. What is subnetting?

Medium

Dividing a network into smaller sub-networks by borrowing host bits for the network part. It improves organisation, security and reduces broadcast traffic. Example: /26 gives 64 addresses (62 usable hosts).

19. What is a subnet mask?

Easy

A 32-bit value that separates the network and host parts of an IP address, e.g. 255.255.255.0 (/24): the first 24 bits are network, the last 8 are host.

20. What are private IP ranges?

Easy

10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. They are used inside local networks and are not routed on the public Internet.

21. Hub vs switch vs router?

Easy

A hub (layer 1) repeats data to all ports. A switch (layer 2) forwards frames only to the right port using MAC addresses. A router (layer 3) connects different networks and forwards packets using IP addresses.

22. What is a gateway?

Easy

A device (usually the router) that connects a local network to other networks and translates between them. Your device sends traffic for outside addresses to the default gateway.

23. What is a firewall?

Easy

A security system that monitors and filters incoming and outgoing traffic based on rules (IPs, ports, protocols). It can be hardware or software and protects networks from unauthorised access.

24. What is HTTP?

Easy

HyperText Transfer Protocol — a stateless, request-response application protocol used by the web. A client sends a request (method, URL, headers, body) and the server returns a response (status code, headers, body).

25. HTTP vs HTTPS?

Easy

HTTPS is HTTP over TLS: data is encrypted, its integrity is protected, and the server is authenticated with a certificate. HTTP uses port 80, HTTPS uses port 443.

26. What is SSL/TLS and how does the handshake work?

Hard

TLS secures communication. In the handshake the client and server agree on a cipher suite, the server proves its identity with a certificate, and they derive shared session keys (using asymmetric crypto); after that, data is encrypted with fast symmetric encryption.

27. What are the common HTTP methods?

Easy

GET (read), POST (create), PUT (replace), PATCH (partial update), DELETE (remove), plus HEAD and OPTIONS. GET, PUT and DELETE are idempotent; POST is not.

28. GET vs POST?

Easy

GET requests data, sends parameters in the URL, is cacheable, bookmarkable and idempotent. POST sends data in the request body to create/process something, is not cached and not idempotent.

29. What are HTTP status code classes?

Easy

1xx informational, 2xx success (200, 201, 204), 3xx redirect (301, 302, 304), 4xx client error (400, 401, 403, 404, 429), 5xx server error (500, 502, 503).

30. 401 vs 403?

Easy

401 Unauthorized means the client is not authenticated (login needed or token invalid). 403 Forbidden means the client is authenticated but not allowed to access the resource.

31. What happens when you type a URL in the browser?

Medium

URL parsing → DNS lookup → TCP handshake → TLS handshake (HTTPS) → HTTP request → server processes it (load balancer, app, DB) → HTTP response → browser parses HTML/CSS/JS, builds the DOM, renders and fetches other resources.

32. What are cookies and sessions?

Easy

HTTP is stateless. A cookie is small data the server asks the browser to store and send back with each request. A session keeps user state on the server, identified by a session ID stored in a cookie.

33. What is a socket?

Medium

An endpoint for communication defined by an IP address + port (and protocol). A TCP connection is identified by the pair of sockets on both ends.

34. What is a port? Name common ones.

Easy

A 16-bit number that identifies a specific process/service on a host. HTTP 80, HTTPS 443, SSH 22, FTP 21, SMTP 25, DNS 53, MySQL 3306, MongoDB 27017.

35. What is ICMP? How does ping work?

Easy

Internet Control Message Protocol carries error and diagnostic messages. ping sends ICMP Echo Request packets and measures the time until Echo Reply comes back; traceroute uses TTL expiry to discover hops.

36. What is bandwidth vs latency vs throughput?

Easy

Bandwidth is the maximum data rate of a link. Latency is the delay for data to travel from source to destination. Throughput is the actual data rate achieved.

37. What is a VPN?

Easy

A Virtual Private Network creates an encrypted tunnel over the Internet between your device and a VPN server, hiding traffic from the local network and making it appear to come from the server's IP.

38. What is a proxy server? Forward vs reverse proxy?

Medium

A server that acts as an intermediary. A forward proxy sits in front of clients (filtering, caching, anonymity). A reverse proxy sits in front of servers (load balancing, SSL termination, caching) — e.g. Nginx.

39. What is a load balancer?

Easy

A device/service that spreads incoming traffic across multiple servers using algorithms like round robin or least connections, improving availability and scalability.

40. What is CSMA/CD?

Medium

Carrier Sense Multiple Access with Collision Detection, used in classic Ethernet: a device listens before sending, detects collisions while sending, and retries after a random back-off.

41. What is the difference between unicast, broadcast and multicast?

Easy

Unicast: one sender → one receiver. Broadcast: one sender → all devices on the network. Multicast: one sender → a selected group of receivers.

42. What is the sliding window protocol?

Hard

A flow-control method where the sender can send multiple frames (up to the window size) before waiting for acknowledgements, improving link utilisation. Variants: Go-Back-N and Selective Repeat.

43. Go-Back-N vs Selective Repeat?

Hard

In Go-Back-N a lost frame causes the sender to resend that frame and all frames after it. In Selective Repeat only the lost frames are resent; the receiver buffers out-of-order frames.

44. What is routing? Static vs dynamic?

Medium

Routing is choosing the path for packets across networks. Static routes are configured manually. Dynamic routing protocols (RIP, OSPF, BGP) learn and update routes automatically.

45. Distance vector vs link state routing?

Hard

Distance vector (RIP): routers share their routing tables with neighbours and use Bellman-Ford; simple but slow to converge. Link state (OSPF): routers share link information with everyone and compute paths with Dijkstra; faster and more scalable.

46. What is BGP?

Hard

Border Gateway Protocol is the routing protocol of the Internet that exchanges routes between autonomous systems (ISPs, large networks) based on policies.

47. What is a MAC table / CAM table in a switch?

Medium

A table mapping MAC addresses to switch ports. The switch learns it from the source addresses of incoming frames and uses it to forward frames only to the correct port.

48. What is an IP packet's TTL?

Easy

Time To Live is a counter in the IP header decreased by 1 at every router; when it reaches 0 the packet is dropped and an ICMP message is sent back. It prevents packets from looping forever.

49. What is the difference between HTTP/1.1, HTTP/2 and HTTP/3?

Hard

HTTP/1.1 uses text and one request at a time per connection (keep-alive). HTTP/2 is binary with multiplexing many requests over one TCP connection and header compression. HTTP/3 runs over QUIC (UDP) to avoid TCP head-of-line blocking.

50. What is a CDN?

Easy

A Content Delivery Network stores copies of static content (images, JS, videos) on edge servers worldwide so users download from a nearby server — faster loads and less load on the origin.

More topics