🎓 BookMCQ
← Back to 27. Network Management

📝 SNMP protocol in computer networks (11 MCQs)

📖 From Data Communication and Networks • 27. Network Management • 11 questions available

What is SNMP protocol in computer networks?

SNMP (Simple Network Management Protocol) is a standard application-layer protocol used to monitor and manage network devices by allowing a central manager to collect status information and configure devices using a simple request-response model over UDP.

3
Easy
5
Medium
3
Hard

📝 All SNMP protocol in computer networks MCQs

Q1. If the recv loop terminates because recv returns 0, what does the variable len contain?

A.-1 (error)
B.Unchanged from its initial value
C.0 (no data)
D.The total number of bytes received before the connection closed ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: When recv returns 0 it signals an orderly shutdown by the peer. The loop stops, leaving len as the sum of all bytes accumulated in previous iterations, which represents the total bytes successfully received.

Q2. Which SNMP operation would you use to periodically retrieve the number of bytes processed by this echo server?

A.Use an SNMP SET request on a custom OID
B.Issue an SNMP TRAP when the count changes ✅
C.Perform an SNMP GET request on a custom OID that tracks byte count
D.SNMP cannot monitor runtime counters in this application
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: An SNMP GET request reads the current value of a managed object. By defining a custom OID that the server updates with the byte count, a management station can poll that OID regularly to monitor the server’s traffic volume.

Q3. When walking through a table of active connections, which SNMP request is most appropriate?

A.SNMP GET request for each exact OID
B.SNMP SET request to modify the table
C.SNMP GETNEXT request to retrieve the next entry sequentially ✅
D.SNMP INFORM request for reliable notifications
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: SNMP GETNEXT returns the next OID in lexicographic order, making it ideal for iterating over a table of entries such as active connections. Using GETNEXT avoids needing to know every exact OID in advance, unlike GET which requires a specific OID each time.

Q4. If the bind call fails because the address is already in use, which socket option should be set before bind to allow reuse?

A.SO_REUSEADDR
B.SO_KEEPALIVE ✅
C.SO_LINGER
D.SO_BROADCAST
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The SO_REUSEADDR flag permits a socket to bind to an address that is already in use, typically when a previous instance of the server is in TIME_WAIT state. Setting this option before the bind call prevents the “address already in use” error and enables rapid restarts.

Q5. To send an SNMP trap when a client disconnects unexpectedly, where should the code be inserted?

A.After the send() call that echoes data
B.Before the accept() loop starts
C.Immediately after the recv() loop exits, before close() ✅
D.Inside the error‑handling block for accept()
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: An unexpected client disconnect is detected when the recv() loop ends without receiving further data. Placing trap‑generation code right after this loop (and before closing the socket) ensures the event is captured promptly, allowing the server to notify the manager of the abrupt termination.

Q6. Evaluating the risk of hard‑coding SNMP community strings in the echo server’s source, which statement is most accurate?

A.There is no security risk because community strings are public
B.The risk is moderate; only experienced attackers might exploit it
C.The risk is high; anyone with source access can read the strings and gain unauthorized access ✅
D.The risk exists only if the strings are transmitted without encryption
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Community strings act as passwords for SNMP v1/v2c. Embedding them in source code exposes them to anyone who can view or decompile the binary, enabling unauthorized read or write operations on managed objects, which constitutes a high security vulnerability.

Q7. If the server receives a packet larger than the current maxLen, how does the while loop handle the excess data?

A.The data is truncated and lost
B.The data is split across multiple iterations, each reading up to maxLen ✅
C.A buffer overflow occurs, corrupting memory
D.recv() returns an error and the loop exits
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Each iteration of the loop reads at most maxLen bytes, then updates maxLen and the buffer pointer. When a packet exceeds the remaining buffer capacity, recv() reads only the portion that fits, and the loop continues until the entire packet has been consumed, preventing overflow.

Q8. What security improvement does SNMP v3 provide over SNMP v2c for managing this server?

A.It adds encryption and strong authentication mechanisms ✅
B.It introduces community strings for access control
C.It timestamps each message for replay protection
D.It makes no additional security changes
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: SNMP v3 incorporates user‑based security models that support authentication (e.g., HMAC‑SHA) and privacy (encryption) of messages, addressing the weak, clear‑text community‑string model of v2c. This enhancement protects management traffic for the echo server against eavesdropping and tampering.

Q9. Which statement best describes the typical transport protocol choice for SNMP?

A.SNMP can use both UDP and TCP equally
B.UDP is the default because of its low overhead ✅
C.TCP is preferred for all SNMP messages due to reliability
D.SNMP only operates over TCP
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: SNMP was originally designed to run over UDP, which provides minimal latency and overhead suitable for frequent polling. Although newer versions allow TCP for reliability, the standard and most common deployment still rely on UDP as the transport layer.

Q10. What structure does an OID use to uniquely identify a managed object in SNMP?

A.A hierarchical numeric tree ✅
B.A human‑readable string name
C.An IP address of the device
D.A MAC address of the interface
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Object Identifiers (OIDs) are expressed as a series of numbers separated by dots, forming a hierarchical tree that uniquely identifies each managed object across all devices. This numeric representation enables consistent referencing regardless of vendor or platform.

Q11. What does the acronym SNMP stand for?

A.Simple Network Management Protocol ✅
B.Secure Network Management Procedure
C.System Network Monitoring Protocol
D.Simple Node Management Protocol
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: SNMP stands for Simple Network Management Protocol, a widely used Internet‑standard protocol that enables network devices to be monitored and managed from a centralized location.

🔗 Related Topics (MCQs)