๐ Fault management in computer networks (12 MCQs)
๐ From Data Communication and Networks โข 27. Network Management โข 12 questions available
What is Fault management in computer networks?
Fault management is the process of detecting, isolating, correcting, and logging network failures or abnormalities to minimize downtime and maintain service availability through tools like alarms, diagnostics, and automated recovery mechanisms.
๐ All Fault management in computer networks MCQs
Q1. In the echo server code, if the call to accept() fails, what immediate action does the program take?
๐ Explanation: When accept() returns a negative value, the code enters the ifโblock, calls perror to display the system error message, and then invokes exit(1). This sequence halts the program immediately, preventing any further processing of client connections.
Q2. Considering the infinite for(;;) loop, which of the following best describes the effect on fault detection when a client disconnects unexpectedly?
๐ Explanation: The for(;;) construct repeats the acceptโreceiveโsend cycle indefinitely. If a client drops the connection, the recv() loop ends, the socket is closed, and control returns to the top of the loop where a new accept() is issued, allowing the server to handle subsequent clients without terminating.
Q3. If the pointer 'ptr' is advanced by n bytes in each iteration without resetting before the next client connection, what fault is most likely to occur after several connections?
๐ Explanation: Each connection assumes 'ptr' points to the start of a fresh buffer. Failing to reset it causes subsequent writes to occur beyond the allocated region, corrupting adjacent memory. After enough iterations this overflow triggers a segmentation fault, a classic crash resulting from accessing invalid addresses.
Q4. Compare the error handling of the accept() call and the recv() call in the code. Which statement is true?
๐ Explanation: The accept() call is wrapped in an ifโstatement that tests for a return value less than zero; on failure it prints an error with perror and exits. In contrast, recv() is placed inside a while loop that continues while the return value is positive, exiting the loop when it becomes zero or negative, thereby handling errors differently.
Q5. Evaluate the impact of not resetting 'maxLen' to its original buffer size at the start of each new connection. Which outcome is most accurate?
๐ Explanation: 'maxLen' tracks the remaining space in the buffer. If it is not restored for a new client, the next recv() call may think the buffer is almost full and stop reading early, causing the server to accept fewer bytes than the client actually sends.
Q6. Differentiate between fault management strategies appropriate for TCP (as in this code) versus UDP. Which statement correctly reflects a key difference?
๐ Explanation: TCP establishes a reliable connection with acknowledgments and automatic retransmission, so fault management often focuses on connection errors. UDP is connectionless and does not guarantee delivery; therefore, applications must implement their own checks for loss, ordering, or corruption, making its faultโhandling strategy fundamentally different.
Q7. Which function in the code is primarily responsible for detecting runtime errors related to socket operations?
๐ Explanation: The perror() function examines the global errno variable set by preceding system calls (such as accept(), recv(), or send()) and prints a humanโreadable description of the error. It is the central mechanism in this program for reporting socketโrelated failures to the user.
Q8. Explain the relationship between the return value of recv() and the detection of a clientโinitiated closure. Which condition indicates that the client has closed the connection?
๐ Explanation: When the peer performs an orderly shutdown, recv() returns zero, signalling endโofโfile on the socket. A negative return indicates an error condition, while a positive value less than the requested size simply means fewer bytes were available, not that the connection has closed.
Q9. To improve fault tolerance, a developer proposes adding a check after send() to verify that the number of bytes sent equals 'len'. What advantage does this modification provide?
๐ Explanation: send() may transmit fewer bytes than requested when the underlying socket buffer cannot accommodate the entire payload. By comparing the return value with the intended length, the program can detect partial sends and retry, guaranteeing that the full echo is delivered before closing the connection.
Q10. In the context of this C program, what does the 'perror' function do?
๐ Explanation: perror() takes a custom prefix string, appends a description of the current errno value, and writes the combined message to the standard error stream. This provides immediate feedback about why a system call such as accept() failed.
Q11. Analyzing the code's resource management, which of the following best describes a potential fault if 'close(s)' were omitted after handling a client?
๐ Explanation: Each accepted connection consumes a file descriptor. Failing to close the descriptor after the client interaction leaves it allocated, and repeated omissions eventually exhaust the process's descriptor limit, preventing new connections and causing subsequent accept() calls to fail.
Q12. Given the code fragment, if 'recv()' returns -1 due to an interrupt signal, what logical step should the server ideally take to maintain robustness?
๐ Explanation: An EINTR error indicates the system call was interrupted by a signal but the socket remains valid. The robust approach is to repeat the recv() operation, allowing the server to continue receiving data without treating the interruption as a fatal failure.