📝 Configuration management in networking (14 MCQs)
📖 From Data Communication and Networks • 27. Network Management • 14 questions available
What is Configuration management in networking?
Configuration management involves tracking and controlling the setup of network devices and software, including inventorying hardware, managing device settings, and ensuring consistent configurations across the network to prevent errors and support troubleshooting.
📝 All Configuration management in networking MCQs
Q1. Which system call is used to accept a new connection from a client?
📖 Explanation: The `accept` system call extracts the first pending connection request from the listening queue and returns a new socket descriptor for communication. It is distinct from `bind` (which assigns an address), `listen` (which marks a socket as passive), and `connect` (used by clients). Hence, option A is correct.
Q2. What is the purpose of the statement `close(s);` in the server loop?
📖 Explanation: `close(s);` terminates the connection associated with descriptor `s` and returns the descriptor to the operating system, allowing it to be reused. It does not send data, allocate memory, or bind addresses. Therefore, releasing the socket descriptor (option B) is the correct purpose.
Q3. If the `recv` call returns , what can be inferred about the state of the TCP connection?
📖 Explanation: A return value of from `recv` indicates an error such as a network failure, an interrupted system call, or a socket error, suggesting the connection might be broken. It does not mean a graceful closure or timeout, making option D the accurate inference.
Q4. Suppose `maxLen` becomes zero before the loop ends; what will subsequent `recv` calls return?
📖 Explanation: When `maxLen` is zero, the buffer length argument to `recv` is zero, so the call returns 0 without reading data. It does not block, nor produce an error, and it does not crash; thus option C correctly describes the behavior.
Q5. If the pointer update `ptr += n;` is omitted, what logical error will occur in later iterations of the receive loop?
📖 Explanation: Without advancing `ptr`, each `recv` writes to the same buffer location, overwriting previously received bytes and causing loss of earlier data. The loop still terminates when `recv` returns 0, so the primary issue is data loss, making option B correct.
Q6. Given that the server runs indefinitely, what is the impact on system resources if the socket descriptor `s` is not closed after each client session?
📖 Explanation: Each client session consumes a file descriptor. If `close(s);` is omitted, descriptors accumulate until the process hits the per‑process limit, preventing new connections. This is a classic descriptor leak, making option A the correct impact.
Q7. Compare the error handling strategies used after the `accept` call and inside the `recv` loop. Which approach provides more robust fault tolerance?
📖 Explanation: The `accept` block aborts the whole server (`exit(1)`) on a single failure, whereas the `recv` loop merely stops reading and proceeds to echo whatever was received. Continuing operation after a recoverable error (as in the `recv` loop) is more fault‑tolerant, so option B correctly identifies the weaker `accept` handling.
Q8. Evaluate the effect of using `while ((n = recv(...)) > 0)` versus a fixed‑count `for` loop for receiving data. Which construct better accommodates variable message sizes?
📖 Explanation: The `while` condition reads until no more data is available, automatically matching the message length regardless of size. A fixed‑count `for` loop assumes a predetermined byte count, which can either truncate or block unnecessarily. Hence, option D correctly describes the advantage of the `while` construct.
Q9. Differentiate the configuration management implications of hard‑coding the error message string in `perror` versus retrieving it from an external resource file.
📖 Explanation: When an error message is embedded directly in source code, any modification requires editing the code and rebuilding the binary, increasing effort and risk of regression. Externalizing strings allows changes without recompilation, facilitating smoother configuration management. Therefore, option C accurately captures the implication.
Q10. Assess how compiler optimization that reorders statements could affect the correctness of the `if (s = accept(... ) < 0);` line. Which part of the code is most vulnerable to such reordering?
📖 Explanation: The expression mixes assignment and comparison without parentheses, and the trailing semicolon creates an empty statement. Optimizations that reorder or split the expression can change the intended precedence, making the `accept` line the most vulnerable. Option A correctly identifies this risk.
Q11. Applying the principle of least privilege, which system privileges should the echo server retain after successfully binding its listening socket?
📖 Explanation: After binding, the server only needs permission to accept incoming connections on its specific port. Retaining broader privileges (root or admin) violates the least‑privilege principle and increases risk. Thus, option D correctly describes the minimal required privilege set.
Q12. Explain how a version control system supports configuration management for the echo server source code.
📖 Explanation: Version control records every modification, allows developers to revert to earlier versions, and maintains a detailed change log—all core aspects of configuration management. The other options describe unrelated effects, making option A the correct explanation.
Q13. In a configuration management plan that includes automated testing, code review, and deployment, at which stage would the missing quotation mark in the `perror` call most likely be detected?
📖 Explanation: A syntax error such as an unmatched quotation mark prevents successful compilation. While automated tests may catch it, the most reliable detection point is manual or peer code review, where developers examine source for such defects before committing. Hence, option C is the stage most likely to catch the issue.
Q14. Using the concept of immutable infrastructure, how could the deployment of this echo server be redesigned to prevent configuration drift?
📖 Explanation: Immutable infrastructure advocates deploying whole, unchangeable images (e.g., Docker containers). When a change is needed, a new image is built and redeployed, eliminating drift caused by ad‑hoc modifications. Option B accurately reflects this strategy.