📝 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.
📝 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?
📖 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)?
📖 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 . This value matches option C, making it the correct answer.
Q3. Which statement correctly distinguishes run‑length coding from LZW dictionary coding?
📖 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?
📖 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?
📖 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?
📖 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?
📖 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?
📖 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.