📝 Asymmetric key encryption RSA (47 MCQs)
📖 From Data Communication and Networks • 31. Cryptography and Network Security • 47 questions available
What is Asymmetric key encryption RSA?
Asymmetric key encryption uses a pair of mathematically linked keys—a public key for encryption and a private key for decryption—with RSA being a foundational algorithm that enables secure key exchange and digital signatures without sharing secret keys over insecure channels.
📝 All Asymmetric key encryption RSA MCQs
Q1. What is the initial size of the dictionary for an alphabet consisting of 256 symbols?
📖 Explanation: The dictionary is initialized with one entry for each possible character in the message, so for an alphabet of 256 symbols the initial size is 256 entries. This follows directly from the LZW initialization rule, making the answer 256.
Q2. During LZW encoding, which operation occurs when the concatenation of the current string S and the next character is not found in the dictionary?
📖 Explanation: When S+char is absent, the algorithm adds the new sequence to the dictionary, emits the code for the longest known sequence S, and restarts S with the new character. This three‑step process is essential to LZW encoding.
Q3. In the LZW example with alphabet {A,B}, what is the first code emitted for the message \BAAB...\?
📖 Explanation: The first unmatched concatenation occurs after reading \B\ followed by \A\ (forming \BA\), which is not yet in the dictionary. The algorithm outputs the code for the longest known sequence \B\, whose code in the example is 110.
Q4. If the dictionary reaches its maximum size of 4096 entries, what is the typical action taken by most LZW implementations?
📖 Explanation: Most implementations reset the dictionary when the maximum size (often 2^12 = 4096) is reached, allowing the algorithm to reuse code space and avoid overflow. This reset preserves synchronization between encoder and decoder.
Q5. Which of the following best describes why LZW does not need to transmit the dictionary to the receiver?
📖 Explanation: Although the dictionary is built dynamically, the encoder and decoder follow identical deterministic rules; therefore they stay synchronized without explicit transmission. The receiver reconstructs entries exactly as the encoder does.
Q6. If a message contains a long repetitive pattern, how does LZW’s dictionary growth affect compression ratio compared to a static Huffman code?
📖 Explanation: LZW dynamically adds longer repeated substrings as single codes, reducing the number of symbols needed for long patterns, whereas static Huffman can only assign shorter codes to individual symbols, making LZW more efficient for such data.
Q7. Suppose during encoding the concatenation S+char is always found in the dictionary. What can be inferred about the message structure?
📖 Explanation: If S+char is always present, the encoder never adds new entries, implying that every possible substring already exists in the dictionary. This can only happen if the message uses only patterns already represented, preventing dictionary expansion.
Q8. In LZW decoding, why is it necessary for the decoder to add the same new entry to its dictionary at the same point as the encoder?
📖 Explanation: The decoder must mirror the encoder’s dictionary updates exactly; otherwise, subsequent codes would reference different entries, causing a cascade of errors. Synchronized dictionary growth ensures both sides interpret each code identically.
Q9. If the code length is increased from 9 bits to 10 bits after the dictionary reaches 512 entries, what is the immediate effect on the compression ratio for the next 100 symbols?
📖 Explanation: Increasing code length adds one extra bit to each emitted code, which slightly reduces the compression ratio until the longer codes are justified by a larger dictionary. The immediate effect is a modest increase in transmitted size per symbol.
Q10. When the encoder encounters a character that forms a new two‑character sequence not yet in the dictionary, what must happen before the next character is processed?
📖 Explanation: The algorithm outputs the code for the longest known sequence (the first character), adds the new two‑character sequence to the dictionary, and then starts a new string with the second character.
Q11. If an LZW‑encoded stream is corrupted such that a single code is altered, what is the most likely outcome during decoding?
📖 Explanation: A single erroneous code will produce an incorrect substring, but because dictionary updates continue deterministically, the decoder can re‑synchronize after that point, limiting the impact to a localized region.
Q12. Compare LZW with Run‑Length Encoding (RLE) for a file consisting of alternating characters \ABABAB...\. Which statement is accurate?
📖 Explanation: The alternating pattern does not contain long runs, so RLE cannot compress effectively, and LZW cannot create long dictionary entries either. Consequently, both methods yield sizes close to the original, making their performance comparable.
Q13. Evaluate the impact of initializing the dictionary with only a subset of the alphabet (e.g., omitting rarely used symbols). How does this affect encoding of messages containing those omitted symbols?
📖 Explanation: If the initial dictionary lacks certain symbols, the encoder will add them the first time they appear, but the initial codes for those symbols will be longer than if they had been present from the start, slightly reducing compression efficiency.
Q14. Differentiate the effect of using a fixed‑size code (e.g., 12 bits) versus a variable‑size code that grows with the dictionary. Which scenario yields better compression for very large texts?
📖 Explanation: A variable‑size code expands only when needed, keeping early codes short and reducing overhead for early portions of the text. For large texts, this adaptive behavior typically outperforms a static 12‑bit code that may be unnecessarily large for early dictionary entries.
Q15. In a scenario where two separate LZW encoders compress the same data but start with different initial dictionaries, what is the most likely result when attempting to decode one stream with the other's decoder?
📖 Explanation: Since the initial dictionaries differ, the first code values will reference different strings, causing immediate misinterpretation. Without identical starting dictionaries, the decoder cannot correctly reconstruct the original data.
Q16. Assess why LZW is considered a lossless compression method, yet it can be less efficient than entropy‑based methods for highly random data. Which explanation is correct?
📖 Explanation: LZW builds a dictionary of repeated patterns; when data lacks repetition, the algorithm spends bits adding seldom‑used entries, leading to overhead that outweighs any compression benefit, whereas entropy coders adapt to symbol probabilities and handle randomness more efficiently.
Q17. Apply the LZW principle to compress a sequence of IPv4 addresses that share common prefixes. Which step of the algorithm most directly exploits the shared prefix?
📖 Explanation: When the prefix becomes a known dictionary entry, subsequent addresses can be represented by a code that references the prefix plus a new suffix, effectively compressing the shared part and only transmitting the differing suffix.
Q18. Synthesize a hybrid scheme that first applies LZW compression and then encrypts the result with a symmetric cipher. What advantage does this ordering provide?
📖 Explanation: Compressing before encryption reduces the plaintext size, meaning fewer bits are processed by the symmetric cipher, which saves computational resources and bandwidth. Encryption after compression also ensures that the compressed structure is not exposed.
Q19. Explain how the LZW decoding process can reconstruct a dictionary entry that was just added by the encoder, even if the entry references the current code being defined. Which property enables this?
📖 Explanation: When the encoder adds a new entry consisting of the previous string plus its first character, the decoder can recreate that entry using the already known previous string and the first character of the current code, ensuring both sides stay synchronized.
Q20. Given a stream of codes produced by LZW, how would you detect a synchronization loss without external checksums?
📖 Explanation: If a code references an index larger than the dictionary size at that point, it indicates that the encoder and decoder have diverged, revealing a synchronization loss.
Q21. Suppose you modify LZW to reset the dictionary every 1000 symbols. How does this affect the algorithm’s ability to compress long‑range repetitions?
📖 Explanation: Frequent resets discard previously learned long‑range patterns, so any repetition that occurs after a reset must be relearned, reducing the algorithm’s ability to capture and compress distant repetitions.
Q22. Why does LZW require that both encoder and decoder process the input stream in exactly the same order?
📖 Explanation: Dictionary entries are added based on the sequence of processed symbols; any deviation in order would cause the decoder to construct a different dictionary, leading to mismatched code meanings.
Q23. If an LZW encoder encounters a sequence where the next character repeats the previous one (e.g., \AA\), what is the most likely immediate effect on the dictionary?
📖 Explanation: When the concatenation of the current string and the next character is not present, the algorithm adds that new concatenated sequence as a dictionary entry, so \AA\ would be inserted as a new code.
Q24. In a scenario where the dictionary reaches its maximum size and the encoder continues without resetting, what type of error is most likely to occur?
📖 Explanation: If the dictionary cannot grow further, the encoder will stop adding new entries but will continue emitting codes. The decoder, expecting potential new entries, may misinterpret subsequent codes, leading to synchronization loss.
Q25. Assume the initial dictionary contains only the characters '0' and '1'. When encoding the binary string \001001\, which of the following codes will be emitted first?
📖 Explanation: The first character read is \0\, and the concatenation \00\ is not yet in the dictionary, so the encoder outputs the code for the longest known sequence, which is just \0\.
Q26. If during decoding a code refers to an entry that has just been added in the same step, how does the decoder resolve the reference?
📖 Explanation: LZW specifies that when a code references the entry being defined, the decoder can reconstruct it by appending the first character of the previous entry to itself, ensuring the new entry can be generated without ambiguity.
Q27. Compare the memory requirements of LZW versus Huffman coding for a large alphabet of 1024 symbols. Which statement is correct?
📖 Explanation: LZW’s dictionary expands with each new unique substring, potentially reaching many thousands of entries, whereas Huffman only stores a static tree based on symbol frequencies. For a large alphabet, the dynamic dictionary of LZW generally consumes more memory.
Q28. Evaluate why LZW is less suitable for real‑time streaming of high‑resolution video compared to arithmetic coding. Which factor is most critical?
📖 Explanation: In real‑time video, latency is crucial; LZW must constantly update and search its dictionary, which can introduce delays, whereas arithmetic coding processes symbols sequentially with predictable computational cost, making it more appropriate for low‑latency streaming.
Q29. Differentiate the effect of using a larger initial code length (e.g., 10 bits) versus a smaller one (e.g., 8 bits) on the early compression ratio of short texts. Which outcome is expected?
📖 Explanation: Starting with a larger code length means each emitted symbol consumes more bits, which hurts compression on short inputs where few dictionary entries are created to offset the overhead.
Q30. Suppose two LZW encoders compress the same text but one uses a reset threshold of 500 entries while the other uses 2000 entries. Which encoder is likely to achieve higher overall compression for a highly repetitive file?
📖 Explanation: A higher reset threshold allows the dictionary to grow larger, capturing more long repeated patterns before resetting. For highly repetitive data, retaining those entries yields better compression than frequent resets that discard useful patterns.
Q31. Synthesize an approach to combine LZW with a block cipher in a way that prevents known‑plaintext attacks on the compressed data. Which strategy is most secure?
📖 Explanation: Encrypting the plaintext before compression obscures patterns that could be exploited in known‑plaintext attacks, ensuring that the subsequent LZW process works on ciphertext that appears random, thereby enhancing security.
Q32. Explain why LZW can be considered a universal lossless compressor for any finite alphabet. Which principle supports this claim?
📖 Explanation: LZW’s ability to dynamically generate entries for any observed substring means it can compress any finite alphabet without pre‑knowledge, embodying the universal property of lossless compressors.
Q33. If you were to design a variant of LZW that limits dictionary entries to a maximum length of 4 characters, how would this affect compression of long repetitive strings?
📖 Explanation: Restricting entry length prevents the dictionary from storing longer repeated substrings, forcing the encoder to emit multiple shorter codes for what could have been a single entry, thereby reducing compression efficiency for long repetitions.
Q34. If during encoding the next character causes the concatenated string to exceed the current dictionary size limit, what must the encoder do before adding the new entry?
📖 Explanation: When the dictionary is full, the encoder typically expands the code width (e.g., from 9 to 10 bits) to allow additional entries, ensuring that new substrings can still be added without resetting.
Q35. Consider a scenario where the encoder and decoder start with identical dictionaries but the decoder receives a corrupted code that maps to an out‑of‑range index. What is the most likely immediate result?
📖 Explanation: An out‑of‑range index indicates that the decoder cannot resolve the code to any known dictionary entry, causing it to raise an error or abort processing because it cannot safely continue.
Q36. If an LZW encoder processes a message where every new character is unique, what will be the size of the dictionary after encoding the entire message of length N?
📖 Explanation: Each new unique character creates a new entry (the concatenation of the previous string and the new character). Starting with the alphabet size entries, the dictionary grows by one for each of the N characters, resulting in |alphabet| + N entries.
Q37. When the LZW decoder receives a code that equals the next available dictionary index, what special case does the algorithm handle?
📖 Explanation: This situation occurs when the encoder emits a code for a string that is being defined simultaneously. The decoder reconstructs the string by appending the first character of the previous entry to the previous entry itself.
Q38. Compare the effect on compression ratio when using LZW on English text versus binary executable data. Which outcome is expected?
📖 Explanation: English text contains many repeated substrings (common words, phrases), which LZW can capture efficiently, whereas binary executables often appear more random, limiting the algorithm’s ability to find repeatable patterns.
Q39. Evaluate why increasing the maximum dictionary size beyond a certain point (e.g., from 4096 to 8192 entries) yields diminishing returns for typical text files. Which factor explains this phenomenon?
📖 Explanation: Most common substrings in typical text are already represented once the dictionary reaches a moderate size. Adding more entries captures increasingly rare patterns, providing little additional compression while increasing code length and overhead.
Q40. In a modified LZW algorithm that uses a sliding window to limit dictionary growth, what trade‑off is introduced?
📖 Explanation: A sliding window discards older entries to keep memory bounded, which saves space but prevents the algorithm from reusing patterns that occur beyond the window, thereby sacrificing compression of long‑range repetitions.
Q41. Apply LZW to compress a DNA sequence consisting of the alphabet {A,C,G,T}. Which characteristic of DNA makes LZW particularly effective?
📖 Explanation: DNA often contains recurring motifs and short repeated subsequences (e.g., tandem repeats), which LZW can capture as dictionary entries, leading to effective compression.
Q42. Synthesize a method to detect whether a given compressed file was produced by LZW without external metadata. Which heuristic is most reliable?
📖 Explanation: LZW codes start at the size of the initial alphabet and then increase as new entries are added. Observing a sequence of codes that incrementally exceed the initial alphabet size suggests the progressive dictionary growth characteristic of LZW.
Q43. Explain why LZW cannot be directly applied to encrypt data without first compressing it, focusing on the relationship between compression and security. Which statement is accurate?
📖 Explanation: By eliminating predictable repetitions, LZW reduces the amount of exploitable structure in the plaintext, thereby making subsequent encryption more resistant to attacks that rely on known patterns.
Q44. What does LZW stand for?
Q45. Which step initializes the string S in the LZW encoding pseudocode?
Q46. In the LZW encoding process, what is the purpose of the variable 'char'?
Q47. When the concatenation S+char is found in the dictionary, what action is taken?