Fundamentals 51 min read

50 Common Computer Network Interview Questions and Answers

An extensive compilation of 50 essential computer networking interview questions covering HTTP status codes, request methods, network architecture, DNS resolution, TCP/UDP protocols, security concepts like CSRF and XSS, and detailed explanations of TCP handshakes, congestion control, and encryption mechanisms.

Wukong Talks Architecture
Wukong Talks Architecture
Wukong Talks Architecture
50 Common Computer Network Interview Questions and Answers

Computer Network Interview Questions

1. Common HTTP status codes and their meanings

This section lists the most frequently used HTTP status codes (e.g., 200 OK, 301 Moved Permanently, 302 Found, 404 Not Found) and explains when each should be used in everyday development.

2. HTTP request methods

The focus is on GET and POST, describing their purposes, how they differ in data transmission, and typical usage scenarios.

3. Ports and associated services

A quick overview of well‑known ports (e.g., 80 for HTTP, 443 for HTTPS, 53 for DNS) and the services that run on them.

4. Computer network architecture

Three models are compared: the ISO‑OSI 7‑layer model, the TCP/IP 4‑layer model, and a simplified 5‑layer model. Each layer’s responsibilities and typical protocols are summarized.

5. Why HTTP is stateless

Explains that each HTTP request is independent; the server does not retain client state unless mechanisms like cookies or tokens are added.

6. From URL entry to page display

Describes the full request flow: DNS resolution, TCP three‑way handshake, HTTP request, server response, browser rendering, and TCP four‑way termination.

7. Differences between HTTP/1.0, 1.1, and 2.0

HTTP/1.0 uses short connections by default; HTTP/1.1 introduces persistent connections, chunked transfer, and pipelining; HTTP/2.0 adds binary framing, multiplexing, header compression, and server push.

8. POST vs. GET

Compares data payload size, encoding, caching, bookmarkability, and security considerations.

9. Keeping a connection alive

Shows that setting the Connection: keep-alive header enables HTTP persistent connections.

10. Long‑lived HTTP connections and timeout

Discusses TCP keep‑alive parameters (tcp_keepalive_time, tcp_keepalive_intvl, tcp_keepalive_probes) and how servers configure keep‑alive timeouts.

11. HTTP vs. HTTPS

HTTPS adds SSL/TLS encryption to HTTP, providing confidentiality, integrity, and authentication.

12. HTTPS handshake process

Outlines the steps: client hello, server certificate, key exchange, generation of a symmetric session key, and encrypted data transfer.

13. 301 vs. 302 redirects

301 indicates a permanent move; browsers update bookmarks. 302 signals a temporary move; the original URL remains valid.

14. Digital signatures and certificates

Describes how a certificate contains a public key, identity information, and a signature from a Certificate Authority (CA).

15. Symmetric vs. asymmetric encryption

Symmetric encryption (e.g., AES, DES) uses a single key; asymmetric encryption (e.g., RSA) uses a public/private key pair.

16. DNS resolution process

Steps include browser cache lookup, local DNS server query, root server referral, TLD server referral, and authoritative server response.

17. CSRF attacks and mitigation

Cross‑Site Request Forgery tricks a logged‑in user into performing unwanted actions. Mitigations include checking the Referer header and adding anti‑CSRF tokens.

18. Five‑layer network protocol mapping

Provides a quick reference of which protocols operate at each OSI layer (e.g., HTTP at Application, TCP at Transport).

19. WebSocket vs. Socket

WebSocket is an application‑layer protocol that provides a persistent, full‑duplex channel over HTTP, while a raw socket is a lower‑level IP + port abstraction.

20. DoS, DDoS, and DRDoS attacks

Defines each denial‑of‑service variant and typical vectors such as SYN flood, ping of death, and reflection attacks.

21. XSS attacks and defenses

Cross‑Site Scripting injects malicious HTML/JS. Defenses include input sanitization, output encoding, and limiting link attributes.

22. Detailed HTTP request process

Repeats the DNS → TCP handshake → HTTP request → server response → rendering flow.

23. Forward vs. redirect in Java web

Forward is server‑side (single request), redirect is client‑side (two requests).

24. SQL injection mechanics and prevention

Shows how concatenating user input can alter SQL logic. Prevention techniques include using prepared statements (e.g., MyBatis #{} placeholders) and input validation.

name = "测试"; // input from front‑end
SQL = "select * from staff where name=" + name;

25. Session vs. Cookie

Cookies store small data on the client; sessions store server‑side state linked to a cookie‑based session ID.

26. IP address classes

Class A (1‑126), B (128‑191), C (192‑223), D (multicast), E (reserved).

27. ARP protocol operation

Maps IP addresses to MAC addresses via broadcast request and unicast reply.

28. Need for both IP and MAC addresses

IP provides logical routing; MAC provides link‑layer delivery within a LAN.

29. TCP vs. UDP application protocols

TCP: HTTP, FTP, SMTP, TELNET, SSH. UDP: DNS, TFTP, SNMP.

30. Keep‑alive timer purpose

Detects dead peers and frees resources after a period of inactivity.

31. Solving many CLOSE_WAIT sockets

Usually caused by not calling close() on the server side; fix by ensuring sockets are closed promptly.

32. URI vs. URL

URI uniquely identifies a resource; URL provides a means to locate it.

33. ICMP functions

Used for error reporting and diagnostics (e.g., ping).

35. Ping principle

Ping sends an ICMP Echo Request and measures the round‑trip time of the Echo Reply.

36. TCP three‑way handshake

Client sends SYN, server replies SYN‑ACK, client sends ACK; both sides enter ESTABLISHED state.

37. Why TCP uses three handshakes

Ensures both parties agree on initial sequence numbers and are ready to communicate.

38. TCP four‑way termination

FIN‑ACK exchange in four steps, ending with both sides in TIME_WAIT before closing.

39. Reason for four‑step termination

Allows each side to acknowledge the other's request to close, preventing data loss.

40. 2MSL wait before CLOSED

Ensures delayed packets from the old connection are discarded before the same socket can be reused.

41. TCP packet sticking and splitting

Explains why TCP may coalesce small writes or split large writes and how to avoid it (fixed‑length framing, delimiters, length headers).

42. TCP flow control

Uses the sliding window (receiver advertises win ) to prevent overflow of the receiver’s buffer.

43. Half‑open queue and SYN flood

Describes the SYN backlog, how a flood fills it, and mitigation techniques such as SYN cookies and SYN‑proxy firewalls.

44. TCP sliding window details

Shows sender variables ( SND.UNA , SND.NXT , SND.WND ) and receiver variables ( RCV.NXT , RCV.WND ).

45. TCP congestion control algorithms

Slow start, congestion avoidance, fast retransmit, and fast recovery are explained with window growth formulas.

46. TCP vs. UDP differences

TCP is connection‑oriented, reliable, and ordered; UDP is connection‑less, best‑effort, and unordered.

47. TCP reliability mechanisms

Three‑way handshake, sequence numbers, acknowledgments, retransmission, flow control, and congestion control ensure reliable delivery.

48. TCP header fields

Source/destination ports, sequence/ack numbers, data offset, flags (URG, ACK, PSH, RST, SYN, FIN), window size, checksum, urgent pointer.

49. Nagle algorithm and delayed ACK

Nagle coalesces small segments; delayed ACK waits briefly before sending an ACK to possibly piggyback data.

50. TCP retransmission mechanisms

Timeout retransmission (RTO calculated via Jacobson/Karels algorithm), fast retransmit (triggered by three duplicate ACKs), selective acknowledgment (SACK) and duplicate SACK (D‑SACK) for precise loss recovery.

SRTT = (1‑α) * SRTT + α * RTT
RTTVAR = (1‑β) * RTTVAR + β * |RTT‑SRTT|
RTO = SRTT + 4 * RTTVAR
TCPprotocolssecurityHTTPInterview QuestionsComputer Networks
Wukong Talks Architecture
Written by

Wukong Talks Architecture

Explaining distributed systems and architecture through stories. Author of the "JVM Performance Tuning in Practice" column, open-source author of "Spring Cloud in Practice PassJava", and independently developed a PMP practice quiz mini-program.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.