🎓 BookMCQ
← Back to 29. Peer to Peer Paradigm

📝 Pastry applications in P2P (8 MCQs)

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

What is Pastry applications in P2P?

Pastry applications in P2P include secure data storage, multicast communication, and location-independent naming, leveraging its deterministic routing and locality awareness to build robust and efficient decentralized services.

2
Easy
4
Medium
2
Hard

📝 All Pastry applications in P2P MCQs

Q1. In a set of symbols with frequencies A:45A:45, B:13B:13, C:12C:12, D:16D:16, and E:9E:9, which two symbols are combined first when building the Huffman tree?

A.A and B
B.C and E ✅
C.D and E
D.B and C
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The Huffman algorithm always merges the two lowest‑frequency nodes. Here the smallest frequencies are E=9E=9 and C=12C=12; merging them yields a new node of weight 2121. No other pair has a combined weight lower than 2121, so the correct pair is C and E.

Q2. Compared to a fixed‑length code of 3 bits per symbol, which statement correctly describes the average bits per symbol for the Huffman code built from the frequencies in the previous question?

A.The Huffman average is greater than 3 bits
B.The Huffman average equals exactly 3 bits
C.The Huffman average is less than 3 bits
D.The Huffman average cannot be determined without the tree ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: Because Huffman coding assigns shorter codes to high‑frequency symbols and longer codes to low‑frequency ones, the weighted average length is always lower than the uniform length of a fixed‑length code when symbol frequencies are non‑uniform. Hence the average bits per symbol is less than 3.

Q3. Given symbols X:20X:20, Y:30Y:30, Z:50Z:50 and constructing a Huffman tree, which binary code is assigned to symbol YY?

A.0 ✅
B.1
C.10
D.11
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: First, combine the two smallest frequencies X=20X=20 and Y=30Y=30 to create a node of weight 5050. This node and Z=50Z=50 are then merged at the root. Assigning 0 to the left branch and 1 to the right, the path to YY is left‑left, yielding the code 0000.}

Q4. During LZW decoding, if the current codeword does not yet exist in the dictionary, what string should the decoder output?

A.The previous string concatenated with its first character
B.The previous string duplicated twice
C.The previous string concatenated with the first character of the previous string ✅
D.An empty string
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: When a codeword is absent, the decoder follows the special rule: output the previous string plus its own first character. This constructs the new entry that will later be added to the dictionary, preserving the algorithm’s consistency.

Q5. If the frequency of a symbol in a Huffman tree is increased, what is the most likely effect on the length of its codeword?

A.The codeword length increases
B.The codeword length stays the same ✅
C.The codeword length decreases
D.The codeword length becomes unpredictable
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Increasing a symbol's frequency makes it more likely to be merged earlier with other low‑frequency nodes, moving it closer to the root. Consequently, the path from root to that leaf shortens, reducing the number of bits required to represent the symbol.

Q6. Which of the following sequences correctly describes the steps to construct a Huffman coding table from a set of symbol frequencies?

A.Sort frequencies → Build tree → Assign bits → Generate table
B.Assign bits → Build tree → Sort frequencies → Generate table
C.Generate table → Sort frequencies → Build tree → Assign bits
D.Build tree → Generate table → Sort frequencies → Assign bits ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: The proper workflow is: first build the Huffman tree by repeatedly merging the two lowest‑frequency nodes; then traverse the completed tree to assign binary digits to each branch, producing the code for each symbol; finally, compile these codes into a coding table.

Q7. Using the Huffman tree where A=00, B=01, C=10, and D=11, what is the encoded bitstring for the message \ABCA\?

A.11000 ✅
B.100110
C.100100
D.11001
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Encode each character sequentially: A→00, B→01, C→10, A→00. Concatenating yields 00 01 10 00, i.e., the bitstring \00011000\. Any other arrangement would mismatch the defined codes.

Q8. In an LZW compression example, the decoder outputs \ABAB\ instead of the expected \ABBA\. Which step is most likely the source of the error?

A.Using an incorrect initial dictionary
B.Failing to add the new entry after each output
C.Misinterpreting the codeword size increase ✅
D.Skipping the special \not‑in‑dictionary\ rule
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: When the codeword size is not updated at the correct point, later codewords are read with the wrong number of bits, causing misalignment. This typically leads to the decoder interpreting subsequent codes incorrectly, producing a string like \ABAB\ instead of the intended \ABBA\.

🔗 Related Topics (MCQs)