Krazy Kaksha

Interview Prep

Computer Networks Quick Revision for Placement Interviews: OSI, TCP/IP, Protocols and 25 Must-Know Questions

Krazy Kaksha 5 min read

Computer Networks Quick Revision for Placement Interviews: OSI, TCP/IP, Protocols and 25 Must-Know Questions

Computer Networks (CN) questions in interviews are predictable: layers, TCP vs UDP, what happens when you type a URL, and a few protocols. Revise this page the night before your interview and you will be able to answer most of them confidently.

OSI model in one table

LayerWhat it doesExamples
7. ApplicationServices for the userHTTP, FTP, SMTP, DNS
6. PresentationFormat, encryption, compressionSSL/TLS, JPEG, ASCII
5. SessionOpens, manages and closes sessionsNetBIOS, RPC
4. TransportEnd-to-end delivery, portsTCP, UDP
3. NetworkLogical addressing and routingIP, ICMP, routers
2. Data LinkFrames, MAC addresses, error detectionEthernet, switches
1. PhysicalBits on the wireCables, hubs, signals

Trick to remember (top to bottom): All People Seem To Need Data Processing.

TCP/IP model

Four layers: Application (OSI 5-7), Transport, Internet (Network) and Network Access (Data Link + Physical). Real networks use TCP/IP; OSI is a teaching model.

TCP vs UDP

TCPUDP
Connection-oriented (3-way handshake)Connectionless
Reliable: acknowledgements, retransmissionNo guarantee of delivery
Ordered deliveryPackets may arrive out of order
Slower, more overheadFaster, less overhead
Web, email, file transferVideo calls, gaming, DNS queries, live streaming

3-way handshake: client sends SYN, server replies SYN-ACK, client sends ACK. Connection closing uses FIN and ACK (4-way).

IP addressing basics

  • IPv4 is 32-bit (for example 192.168.1.10); IPv6 is 128-bit, written in hexadecimal.
  • Private ranges: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.
  • Subnet mask separates the network part from the host part. /24 means 255.255.255.0 and gives 254 usable hosts.
  • Usable hosts formula: 2^(host bits) – 2 (network and broadcast addresses are reserved).
  • NAT lets many private devices share one public IP.

Common protocols and ports

ProtocolPortUse
HTTP80Web pages
HTTPS443Secure web pages
FTP20, 21File transfer
SSH22Secure remote login
SMTP25Sending email
DNS53Domain name to IP
DHCP67, 68Automatic IP assignment
POP3 / IMAP110 / 143Receiving email

25 questions interviewers ask

1. What is a computer network? Two or more devices connected to share data and resources.

2. LAN, MAN, WAN? LAN covers a building or campus, MAN a city, WAN a country or the world (the internet).

3. What are network topologies? Bus, star, ring, mesh, tree and hybrid. Star is the most common today.

4. Hub vs switch vs router? A hub sends data to all ports; a switch sends it only to the right device using MAC addresses; a router connects different networks using IP addresses.

5. MAC address vs IP address? MAC is a fixed physical address of the network card (48-bit). IP is a logical address given by the network and can change.

6. What is ARP? It finds the MAC address for a given IP address in a local network.

7. What is DNS? The internet’s phone book: it converts a domain name into an IP address.

8. What is DHCP? It automatically gives IP addresses and other settings to devices joining a network.

9. What happens when you type a URL and press Enter? The browser finds the IP through DNS, opens a TCP connection (and a TLS handshake for HTTPS), sends an HTTP request, the server sends the response, and the browser renders the page.

10. HTTP vs HTTPS? HTTPS is HTTP over TLS: data is encrypted and the server’s identity is verified by a certificate.

11. What is a port? A number that identifies a specific service on a device, like 443 for HTTPS.

12. What is a socket? The combination of IP address and port used as one end of a connection.

13. What is bandwidth vs latency? Bandwidth is how much data can be sent per second; latency is how long one packet takes to reach.

14. What is a firewall? Hardware or software that filters traffic based on rules to block unwanted access.

15. What is a VPN? A secure, encrypted tunnel over the internet between your device and another network.

16. What is ICMP? A protocol for error and diagnostic messages; ping and traceroute use it.

17. What is flow control vs congestion control? Flow control stops a fast sender from overwhelming a slow receiver (sliding window). Congestion control stops senders from overloading the network (slow start, AIMD).

18. What is a sliding window? A method in TCP where the sender can send several packets before needing an acknowledgement.

19. What is subnetting? Dividing one big network into smaller networks for better management and security.

20. What is the difference between a website’s IP and its domain? The IP is the actual address of the server; the domain is a human-friendly name that points to it.

21. What is CSMA/CD? In Ethernet, a device listens before sending and stops and retries if a collision is detected.

22. Unicast, broadcast and multicast? One to one, one to all, and one to a selected group.

23. What is a proxy server? A server that sends requests on behalf of clients, used for caching, filtering and hiding the client’s IP.

24. What is a CDN? A network of servers in many cities that keeps copies of content near users so websites load faster.

25. What is the difference between IPv4 and IPv6? IPv6 has a much larger address space (128-bit), built-in security support and no need for NAT.

Last-minute tips

Doubts? Ask here

Leave a comment

Your email is not shown. Comments appear after a quick check.