Questions: Sockets and Network Inter-Process Communication

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A DNS server needs to respond to thousands of short queries per second from many clients. Occasional packet loss is acceptable because clients retry automatically. Which socket type is most appropriate?

ATCP (SOCK_STREAM), because reliability is important for DNS correctness
BUDP (SOCK_DGRAM), because low latency and connectionless operation suit short, retry-tolerant queries
CUnix domain sockets, because DNS servers and clients run on the same machine
DTCP with SO_LINGER set to zero, to avoid the three-way handshake overhead
Question 2 Multiple Choice

A web application server and its database run on the same physical machine. The developer is choosing between TCP loopback (127.0.0.1) and a Unix domain socket for their connection. What is the primary advantage of the Unix domain socket?

AUnix domain sockets support both TCP and UDP semantics simultaneously
BUnix domain sockets bypass the network stack entirely, reducing overhead and latency
CUnix domain sockets are more secure because they cannot be accessed over a network
DUnix domain sockets allow multiple processes to share a single file descriptor
Question 3 True / False

Unix domain sockets use IP addresses and port numbers to identify communication endpoints.

TTrue
FFalse
Question 4 True / False

A TCP server must call listen() and accept() before a client can connect, establishing a connection through a three-way handshake.

TTrue
FFalse
Question 5 Short Answer

Why might a production system prefer Unix domain sockets over TCP loopback for communication between two processes running on the same machine?

Think about your answer, then reveal below.