🎓 BookMCQ
← Back to 29. Peer to Peer Paradigm

📝 Pastry identifier space (10 MCQs)

Node IDs and Keys in a Positional Identifier Space

Pastry represents node identifiers and destination keys as sequences of digits in a common identifier space. The digit base is determined by a configuration parameter, so identifiers can be interpreted as binary-derived digit strings. Routing uses shared prefixes, while final responsibility is based on numerical closeness among live node IDs. Prefix matches direct logical progress; physical proximity remains a separate consideration.

Digit Base and Prefix Length

If each digit contains b bits, the identifier is represented in base 2^b. A prefix of length l means that the first l digits match. The routing table organizes entries by the matching prefix and the next differing digit, allowing the node to select a peer that extends the match. Sets organize routing state by prefix, proximity, and identifier order.

Mapping Names and Comparing Identifier Values

An application hashes a resource name to create a key in the Pastry identifier space. A node also has a unique ID. Routing compares their digit sequences and numeric values; the destination is the live node with the closest ID to the key, not necessarily a node with an identical identifier. Every hop must improve the prefix or satisfy the fallback rule.

Interpreting a Hexadecimal Prefix

With four bits per digit, identifiers can be written in hexadecimal. If a local ID is 7A30 and a key is 7AF2, the first two digits match. A routing entry whose ID begins 7AF can extend the common prefix from two digits to three, moving the lookup closer in prefix terms. The selected peer advances the key's shared prefix match at this stage.

Identifier Distribution and Routing Balance

Hashing helps distribute keys and node IDs across the identifier space, reducing bias from meaningful resource names. Prefix-based routing can then make progress in a number of stages related to identifier length. Actual performance also depends on node population, missing entries, and the health of the overlay. The application remains responsible for stored data and service permissions.

Prefix Similarity Is Not Numeric Equality

'A matching prefix means the node owns the key' is false because many IDs can share a prefix. 'The key must equal a node ID' is also wrong; Pastry routes to the numerically closest live node. 'Hexadecimal changes the identifier value' confuses notation with the underlying number. Identifier order and network proximity remain separate routing criteria in Pastry.

Digit Conversion and Prefix Comparison

Be able to identify the digit base, count shared leading digits, and compare node IDs numerically when given a key and a set of peers. Do not treat prefix length as the same thing as numerical distance. Explain how the identifier space supports both routing-table organization and final node selection. Name the routing table row, fallback candidate, and leaf set decision clearly.

Pastry Identifier and Prefix Terminology

  • Identifier space - Set of possible node and key IDs..
  • Digit base - Number system for identifier digits..
  • Prefix - Initial sequence of matching digits..
  • Node ID - Unique identifier of an overlay peer..
  • Destination key - Hashed identifier for requested resource..
  • Numerical closeness - Difference between identifier values..
3
Easy
5
Medium
2
Hard

📝 All Pastry identifier space MCQs

Q1. In lossless compression, if a file is compressed using run‑length encoding and then decompressed, what can be inferred about the original data?

A.Some bits may be lost
B.The data is identical to the original ✅
C.The data becomes longer
D.Compression fails
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Because run‑length encoding and its inverse are exact inverses, the decompression restores every symbol exactly as it appeared before compression, guaranteeing that the reconstructed file matches the original byte‑for‑byte without any loss of information.

Q2. When comparing run‑length coding (RLE) and Huffman coding for a data stream that contains long sequences of the same symbol, which statement is most accurate?

A.RLE usually yields better compression because it directly encodes the length of runs ✅
B.Huffman coding always outperforms RLE regardless of run length
C.Both methods give identical compression ratios
D.RLE is ineffective for any type of data
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: RLE replaces each contiguous run of identical symbols with a count and the symbol itself, which is highly efficient when runs are long. Huffman coding builds a variable‑length prefix tree based on symbol frequencies and does not exploit run length directly, so RLE often compresses such data more effectively.

Q3. Given a set of symbols with known probabilities, which coding technique guarantees the minimum possible average code length?

A.Fixed‑length coding
B.Run‑length coding
C.Huffman coding ✅
D.Arithmetic coding
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Huffman coding constructs an optimal prefix code for a known probability distribution, ensuring that no other prefix code can achieve a lower average length. While arithmetic coding can approach the entropy even more closely, Huffman coding is provably optimal among all prefix‑free codes, making it the guaranteed minimum for that class.

Q4. A lossy image compression algorithm discards high‑frequency components during quantization. What is the most likely visual effect on the reconstructed image?

A.Increased color saturation
B.Reduced file size only
C.Improved contrast
D.Loss of fine detail and reduced sharpness ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: High‑frequency components correspond to rapid changes in intensity, such as edges and textures. Removing them smooths these variations, causing the image to appear less sharp and causing fine details to disappear, even though the file size is reduced.

Q5. Statement: 'Applying a lossless compression step after a lossy compression always reduces the final file size.' Which assessment is correct?

A.True for all data
B.False for all data
C.It depends on the characteristics of the already compressed data ✅
D.Not applicable
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Lossless compression can further shrink data only if there remains redundancy after the lossy stage. Some lossy outputs are already near entropy‑limited, leaving little or no compressible pattern, so the additional lossless step may produce negligible gain or even a slight increase due to overhead.

Q6. To compress a data stream that alternates between long runs of identical symbols and highly varied symbols, which order of applying RLE and Huffman coding generally yields the greatest overall compression?

A.Apply RLE first, then Huffman on the RLE output ✅
B.Apply Huffman first, then RLE
C.Apply both independently and choose the smaller result
D.Use only Huffman coding
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: RLE first collapses long runs into count‑symbol pairs, creating a new symbol sequence with many repeated count symbols. Huffman coding can then efficiently encode this reduced alphabet, capturing any remaining statistical redundancy. Reversing the order would miss the opportunity to compress the runs themselves.

Q7. If arithmetic coding produces an average code length of 3.23.2 bits per symbol for a source whose entropy is 33 bits per symbol, what can be inferred about the coding efficiency?

A.100 % efficient
B.Approximately 94 % efficient ✅
C.Approximately 106 % efficient
D.Efficiency cannot be determined
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Coding efficiency is defined as the ratio of source entropy to average code length. Here, 3/3.2=0.93753 / 3.2 = 0.9375, or about 93.75 %, indicating the arithmetic coder is close to optimal but not perfectly efficient, as some overhead remains.

Q8. For a text file containing many repeated substrings, which compression method typically achieves better size reduction?

A.Run‑length coding
B.Fixed‑length coding
C.Dictionary‑based coding such as LZW ✅
D.Arithmetic coding
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Dictionary‑based methods like LZW build a table of previously seen substrings, allowing repeated patterns to be replaced by short references. This exploits the redundancy of repeated substrings more directly than run‑length or fixed‑length schemes, often resulting in superior compression for textual data.

Q9. In a distributed hash table that uses a 160‑bit identifier space, what is the probability that two randomly chosen node identifiers differ by at most 2202^{20}?

A.2−1402^{-140} ✅
B.2−1202^{-120}
C.2−1002^{-100}
D.2−802^{-80}
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The total number of possible identifiers is 21602^{160}. The set of identifiers within distance 2202^{20} from a given point contains 2202^{20} values. The probability that a second random identifier falls in that range is the ratio 220/2160=2−1402^{20}/2^{160}=2^{-140}.

Q10. What does the abbreviation RLE stand for in the context of lossless compression?

A.Recursive Linear Encoding
B.Run‑length Encoding ✅
C.Randomized List Enumeration
D.Reduced Length Expansion
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: RLE is the common shorthand for Run‑length Encoding, a simple lossless compression technique that replaces consecutive repetitions of the same symbol with a count and the symbol itself.

🔗 Related Topics (MCQs)