🎓 BookMCQ
← Back to 29. Peer to Peer Paradigm

📝 Chord P2P applications (8 MCQs)

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

What is Chord P2P applications?

Chord P2P applications include distributed file storage, cooperative caching, and naming services, where its guaranteed lookup performance and scalability make it suitable for building reliable decentralized systems over dynamic networks.

2
Easy
4
Medium
2
Hard

📝 All Chord P2P applications MCQs

Q1. Using run‑length encoding, the string 'AAABBBBCDDDDDDEEE' becomes '3A4B1C6D3E'. What are the lengths of the original string and the encoded string respectively?

A.Original 17 characters, encoded 10 characters ✅
B.Original 15 characters, encoded 12 characters
C.Original 17 characters, encoded 12 characters
D.Original 15 characters, encoded 10 characters
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The original string contains 3 A + 4 B + 1 C + 6 D + 3 E = 17 symbols, so its length is 17. The encoded form stores each run as a count followed by a letter; there are five runs, each requiring two symbols (count and letter), giving 5 × 2 = 10 characters. Hence option A correctly states both lengths.

Q2. A binary pattern is compressed to the 16‑bit sequence 1100001100001000 using a fixed 4‑bit per digit scheme. If the original pattern required 26 bits, what is the compression ratio (original bits ÷ compressed bits)?

A.1.45
B.1.52
C.1.625 ✅
D.1.7
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Compression ratio is calculated as original size divided by compressed size. Here the original uses 26 bits and the compressed result uses 16 bits, so the ratio is 2616=1.625\frac{26}{16}=1.625. This value matches option C, making it the correct answer.

Q3. Which statement correctly distinguishes run‑length coding from LZW dictionary coding?

A.Run‑length coding replaces repeated symbols with a count, while LZW replaces repeated substrings with dictionary indexes.
B.Run‑length coding builds a dictionary of substrings, whereas LZW encodes each symbol individually. ✅
C.Both methods use fixed‑length codes, but only LZW adapts the code length during compression.
D.Run‑length coding is lossless, while LZW is lossy.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Run‑length coding works by collapsing consecutive identical symbols into a count‑value pair, whereas LZW constructs a dictionary of previously seen substrings and substitutes the substring with its dictionary index. Option B accurately captures this fundamental difference; the other statements either invert the mechanisms or introduce incorrect properties.

Q4. Consider a bitmap image where black pixels appear in long horizontal runs and white pixels are scattered randomly. Which compression method is likely to achieve a higher compression ratio?

A.Run‑length coding applied to the entire image
B.LZW dictionary coding on the raw pixel stream
C.Run‑length coding after reordering rows to group similar colors
D.Hybrid method combining run‑length for rows and LZW for remaining data ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: Long runs of identical pixels are ideal for run‑length coding, while scattered pixels benefit from dictionary substitution. By first applying run‑length to exploit the long black runs and then feeding the residual symbols to LZW, the hybrid approach captures both regularities, typically producing a higher overall ratio than either method alone.

Q5. Given the binary sequence 111100001111, apply run‑length encoding using a count followed by the bit value. What is the encoded result?

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

📖 Explanation: The sequence consists of four 1's, four 0's, then four 1's again. Run‑length encoding records each run as “count value”, producing “4 1 4 0 4 1”. This matches option C; the other options either swap counts and values or insert extra numbers.

Q6. A system first applies run‑length encoding to a binary stream and then compresses the resulting symbols with LZW. Which advantage does this two‑stage approach provide over using LZW alone?

A.It guarantees a higher compression ratio for any type of data.
B.It eliminates the need for a dictionary, making compression lossless.
C.It converts variable‑length codes into fixed‑length codes for easier decoding.
D.It reduces the alphabet size, allowing LZW to build a smaller dictionary faster. ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: Run‑length encoding collapses long runs into a single count‑value pair, dramatically shrinking the number of distinct symbols that LZW must handle. With a smaller alphabet, LZW can construct its dictionary more efficiently and often reaches a better compression ratio than when applied directly to the raw binary stream.

Q7. In the LZW algorithm, what is the initial size of the dictionary before processing the input?

A.256 entries representing all possible byte values ✅
B.128 entries for ASCII characters
C.16 entries for hexadecimal digits
D.0 entries, the dictionary is built from scratch
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: LZW starts with a dictionary that contains every possible single‑byte symbol; for an 8‑bit byte this means 2⁸ = 256 initial entries. This pre‑populated dictionary allows the algorithm to begin encoding longer substrings immediately.

Q8. If a run‑length encoded file contains the pattern '5A3B2C' and the decoder misinterprets the counts as characters, what would be the first incorrect character output?

A.A
B.5 ✅
C.B
D.3
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: When the decoder treats the count digits as literal characters, the very first symbol it reads is the digit '5'. Therefore the first character that appears incorrectly in the output stream is '5', corresponding to option B.

🔗 Related Topics (MCQs)