🎓 BookMCQ
← Back to 29. Peer to Peer Paradigm

📝 Distributed Hash Table DHT in P2P (17 MCQs)

📖 From Data Communication and Networks • 29. Peer to Peer Paradigm • 17 questions available

What is Distributed Hash Table DHT in P2P?

A Distributed Hash Table is a decentralized data structure that maps keys to values across multiple peers in a network, enabling efficient storage and retrieval of information without requiring a central directory or database.

4
Easy
9
Medium
4
Hard

📝 All Distributed Hash Table DHT in P2P MCQs

Q1. In the LZW encoding process described, what is the initial dictionary size before any new entries are added?

A.2 ✅
B.4
C.8
D.16
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The alphabet consists of only two symbols, A and B. LZW starts with a dictionary that contains each individual symbol, so the initial number of entries equals the size of the alphabet, which is 2. This baseline is required before any multi‑character strings are added during encoding.

Q2. If a DHT uses consistent hashing with 8 nodes (IDs 0–7) and a key hashes to value 6, which node stores the key assuming each node owns keys from its ID up to but not including the next node’s ID?

A.Node 5
B.Node 6 ✅
C.Node 7
D.Node 0
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Consistent hashing assigns each key to the first node whose identifier is equal to or follows the key’s hash on the identifier circle. With IDs 0‑7, the interval for node 6 covers keys 6 up to 7, so the key with hash 6 is stored on node 6.

Q3. Compare the growth rate of the LZW dictionary during encoding of the string “BAABABBBAABBBBAA” with the number of entries that would be added to a DHT when each new node joins the network. Which statement is accurate?

A.The LZW dictionary grows linearly while DHT entries grow exponentially.
B.The LZW dictionary grows exponentially while DHT entries grow linearly. ✅
C.Both grow linearly.
D.Both grow exponentially.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: LZW adds a new entry for each previously unseen substring, leading to rapid (near‑exponential) growth for a short message. In contrast, a DHT only adds a single routing entry for each joining node, so the total number of entries increases linearly with the number of nodes.

Q4. Applying the principle of finger tables in a Chord DHT, what is the maximum number of hops required to locate a key in a network of 16 nodes?

A.4 ✅
B.5
C.8
D.16
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Chord’s finger table gives a logarithmic search bound. With N=16N = 16 nodes, the maximum number of hops is log2N=log216=4\lceil \log_2 N \rceil = \lceil \log_2 16 \rceil = 4. Each hop halves the remaining identifier space, guaranteeing the search completes within four steps.

Q5. During LZW decoding, when a codeword is not yet in the dictionary, the decoder constructs the missing entry by concatenating the previous output string with its first character. If the previous output was “AB” and the missing code corresponds to “ABA”, what string does the decoder output?

A.AB
B.ABA ✅
C.AAB
D.BA
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: When the decoder encounters an undefined code, it uses the rule: output = previous + first character(previous). The previous string is “AB”; its first character is “A”. Concatenating yields “ABA”, which is both the output and the new dictionary entry.

Q6. Evaluate the impact on lookup latency if a DHT’s finger table entries become outdated due to node churn. Which outcome is most likely?

A.Latency decreases because routes become shorter
B.Latency remains unchanged
C.Latency may increase due to stale entries ✅
D.Latency drops to zero
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: When finger tables contain obsolete pointers, a lookup may follow an incorrect hop and must fall back to slower corrective mechanisms, such as successor traversal. This extra work typically raises the overall latency rather than reducing it.

Q7. Given a DHT where the hash function is h(key)=(keymod24)h(key) = (key \bmod 2^4) and keys 22 and 38 are stored, to which node IDs (0‑15) will they map?

A.Both map to node 6 ✅
B.22 → 6, 38 → 7
C.22 → 7, 38 → 6
D.Both map to node 7
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Compute the modulo: 22mod16=622 \bmod 16 = 6 and 38mod16=638 \bmod 16 = 6. Both keys therefore resolve to identifier 6, meaning the same node (ID 6) is responsible for storing each value.

Q8. Assume a DHT with 32 nodes arranged in a ring. A lookup for key K traverses nodes 5 → 12 → 20 → 27 → 31. If node 20 fails after the lookup has reached node 27, what is the minimum additional hops required to still reach the responsible node?

A.0
B.1 ✅
C.2
D.3
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: When node 20 crashes, node 27 can use its finger table to jump directly to the next viable predecessor of the target, typically the node that would have been reached via the failed hop. This adds a single extra hop, moving from 27 straight to the successor of 20.

Q9. Contrast the worst‑case space complexity of LZW encoding for a binary alphabet with the worst‑case routing table size in a Chord DHT of N nodes. Which expression correctly represents each?

A.LZW O(L)O(L), Chord O(logN)O(\log N)
B.LZW O(2L)O(2^{L}), Chord O(N)O(N)
C.LZW O(N)O(N), Chord O(L)O(L)
D.LZW O(logL)O(\log L), Chord O(2N)O(2^{N})
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: In the worst case, LZW can create a distinct entry for each new substring, giving a linear bound O(L)O(L) where L is the input length. Chord’s routing table (finger table) stores log2N\lceil\log_2 N\rceil pointers, yielding a logarithmic space requirement O(logN)O(\log N).

Q10. Synthesize a hybrid protocol that uses LZW compression before storing values in a DHT. What primary benefit does this provide regarding network bandwidth?

A.Improves security
B.Reduces bandwidth consumption ✅
C.Increases latency
D.Eliminates need for routing
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Compressing data with LZW before transmission shrinks the payload size, so fewer bits travel across the network. This directly lowers bandwidth usage, which is especially valuable in bandwidth‑constrained environments or when many peers exchange large values.

Q11. If a DHT node with ID 9 receives a lookup request for key hash 3, and its finger table correctly points to node 12 as the closest preceding node, what is the next hop?

A.Node 12 ✅
B.Node 3
C.Node 9
D.Node 0
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The finger table’s purpose is to forward the request to the node with the largest identifier that precedes the target hash. Since node 12 is the closest preceding node to hash 3 (wrapping around the ring), the request is forwarded to node 12.

Q12. When comparing resilience to node failures, which property distinguishes a DHT from LZW compression?

A.DHT stores data redundantly, LZW does not ✅
B.LZW provides fault tolerance, DHT does not
C.Both have identical resilience
D.Neither handles failures
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: A DHT’s overlay maintains multiple routing paths and often replicates key‑value pairs across successors, giving it inherent fault tolerance. LZW is a compression technique that does not incorporate any redundancy; a lost or corrupted dictionary entry can corrupt the entire decoded stream.

Q13. Apply the concept of successor pointers in a DHT to explain how the system ensures that every key has a responsible node even after a node leaves.

A.Successor pointers replicate data
B.Successor pointers ensure each key has a next node that takes over ✅
C.Successor pointers balance load
D.Successor pointers encrypt keys
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: When a node departs, its immediate successor inherits responsibility for the departing node’s identifier interval. The successor pointer guarantees that the interval is never orphaned, because the next node on the identifier circle automatically becomes the new owner of those keys.

Q14. During LZW decoding, suppose the decoder has just output the string “BA” and the next codeword corresponds to the dictionary entry “BAB”. If the dictionary does not yet contain “BAB”, what entry will be added to the dictionary?

A.Add “BA” to the dictionary
B.Add “BAB” to the dictionary ✅
C.Add “AB” to the dictionary
D.Add “B” to the dictionary
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: When the decoder encounters a code not yet in the dictionary, it creates a new entry by appending the first character of the newly decoded string (“BAB”) to the previous output (“BA”). The resulting concatenation is “BAB”, which is then stored as the new dictionary entry.

Q15. Given two DHT implementations, one using a flat hash table and another using a hierarchical tree (e.g., Pastry), which implementation typically offers lower average lookup cost and why?

A.Flat hash table lower cost because O(1)
B.Hierarchical tree lower cost because O(log N) ✅
C.Both have the same cost
D.Flat hash table higher cost
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: A hierarchical tree structure provides logarithmic routing: each hop reduces the identifier space, yielding an average cost of O(logN)O(\log N). A flat hash table requires scanning or broadcasting across all nodes in the worst case, leading to linear cost O(N)O(N).

Q16. What principle does a DHT rely on to distribute keys uniformly across nodes?

A.Consistent hashing ✅
B.Round‑robin assignment
C.Random assignment
D.Fixed partitioning
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Consistent hashing maps both nodes and keys onto the same identifier circle, then assigns each key to the first node encountered clockwise. This approach spreads keys evenly despite node joins or leaves, avoiding hot spots and ensuring balanced load distribution.

Q17. Analyze the effect on overall system throughput when LZW‑compressed data is stored in a DHT versus storing raw data, assuming network bandwidth is the bottleneck.

A.Throughput decreases due to decompression overhead
B.Throughput increases because less data is transmitted ✅
C.Throughput remains unchanged
D.Throughput becomes unpredictable
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: When bandwidth limits the system, transmitting fewer bits per operation directly raises the number of operations that can be completed per unit time. Although decompression adds CPU work, the dominant factor is the reduced volume of data moving across the network, so throughput improves.

🔗 Related Topics (MCQs)