🎓 BookMCQ
← Back to 31. Cryptography and Network Security

📝 Digital signature in cryptography (28 MCQs)

📖 From Data Communication and Networks • 31. Cryptography and Network Security • 28 questions available

What is Digital signature in cryptography?

A digital signature is a cryptographic value created using a sender’s private key that allows recipients to verify the sender’s identity and confirm that the message has not been modified, providing authentication, integrity, and non-repudiation.

8
Easy
12
Medium
8
Hard

📝 All Digital signature in cryptography MCQs

Q1. What does the PreS buffer store during LZW decoding?

A.The previous string from the prior iteration ✅
B.The previous codeword from the prior iteration
C.The next codeword to be processed
D.It stores nothing
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The PreS buffer is designed to keep the string generated in the previous step so that when a new codeword is read the algorithm can reference that string for dictionary updates or output generation.

Q2. In Huffman coding, symbols with higher frequency receive ____ codes.

A.Longer
B.Shorter ✅
C.Equal length
D.Random length
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Huffman coding assigns shorter binary patterns to the most frequent symbols, reducing the overall bit count needed for the message. This principle directly follows the frequency‑based optimization that the algorithm performs.

Q3. Which step adds a new entry to the dictionary when the current codeword is found in the dictionary?

A.Step 1
B.Step 2a
C.Step 2b ✅
D.Step 3
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: When a codeword already exists in the dictionary (step 2a), the decoder concatenates the previous string with the first character of the entry for the new codeword and inserts this concatenated string as a new dictionary entry.

Q4. If during LZW decoding a codeword C is not yet in the dictionary, what string is output?

A.The previous string concatenated with its first character ✅
B.The previous string alone
C.The first character of C only
D.No output is produced
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: When the decoder encounters an undefined codeword, it follows the special case rule: output the previous string followed by its first character, which also becomes the new dictionary entry.

Q5. Suppose the dictionary currently contains entries for codewords 0–5. The next codeword read is 6, which is not in the dictionary. Which of the following best describes the new dictionary entry created?

A.Previous string plus its first character ✅
B.Previous string plus the next codeword’s first character
C.Previous codeword concatenated with next codeword
D.No new entry is created
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The undefined codeword triggers the special case where the decoder forms a new entry by appending the first character of the previous string to that same string.

Q6. During LZW decoding, if the previous string S is \AB\ and the current codeword corresponds to entry \ABC\, what character is appended to the dictionary for the next entry?

A.A
B.B
C.C ✅
D.AB
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: The algorithm adds a new entry formed by the previous string (\AB\) plus the first character of the current entry (\C\), so the character appended is \C\.

Q7. If a Huffman tree assigns code \0\ to symbol X and \10\ to symbol Y, which statement is true about their frequencies?

A.X occurs more frequently than Y ✅
B.Y occurs more frequently than X
C.Both have equal frequency
D.Frequency cannot be inferred from the codes
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Shorter codes are given to more frequent symbols; therefore the single‑bit code for X indicates a higher occurrence probability than the two‑bit code for Y.

Q8. Consider an LZW decoder where the dictionary size limit is 4096 entries. If the decoder reaches this limit, what is the most appropriate action to continue decoding correctly?

A.Continue without changes
B.Reset the dictionary to its initial state ✅
C.Stop decoding and report an error
D.Ignore new entries and overwrite old ones
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: When the dictionary is full, the standard approach is to re‑initialize it to the original set of single‑character entries, allowing the decoder to keep processing without overflow.

Q9. When the decoder encounters a codeword that equals the next available dictionary index, what special case occurs?

A.The codeword is not yet in the dictionary ✅
B.The codeword is already present in the dictionary
C.The decoder outputs an empty string
D.An error is thrown
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: If the codeword equals the index that will be assigned to the next new entry, the decoder treats it as the undefined‑codeword case and outputs the previous string plus its first character.

Q10. Compare the handling of an unknown codeword in LZW encoding vs LZW decoding. Which statement correctly captures the difference?

A.Encoding never sees an unknown codeword
B.Decoding creates a new dictionary entry for the unknown codeword ✅
C.Both encoding and decoding create new entries
D.Both raise an error when an unknown codeword appears
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: During decoding, an undefined codeword triggers the special case that adds a new entry; the encoder never generates an undefined codeword because it builds the dictionary synchronously.

Q11. Evaluate the impact of using a larger initial dictionary on the compression ratio of LZW. Which outcome is most likely?

A.Higher compression ratio ✅
B.Lower compression ratio
C.No change in ratio
D.The effect is unpredictable
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: A larger initial dictionary already contains many common substrings, so the encoder can reference them with fewer bits, typically improving the overall compression ratio.

Q12. Given two messages, one with uniform symbol distribution and another with highly skewed distribution, which message benefits more from Huffman coding and why?

A.The uniform‑distribution message
B.The skewed‑distribution message ✅
C.Both benefit equally
D.Neither benefits from Huffman coding
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Huffman coding exploits frequency differences; a skewed distribution provides clear high‑frequency symbols that receive short codes, yielding greater size reduction than a uniform distribution where all symbols have similar frequencies.

Q13. Differentiate between the role of the first character of the string S in steps 2a and 2b of LZW decoding. Which statement is accurate?

A.It is used only in step 2a
B.It is used only in step 2b
C.It is used in both steps ✅
D.It is not used in either step
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Both the normal case (2a) and the special case (2b) require the first character of the previous string to form the new dictionary entry, ensuring consistency regardless of whether the codeword is already defined.

Q14. If the LZW decoder incorrectly uses the previous codeword instead of the previous string when forming a new dictionary entry, what type of error will most likely appear in the output?

A.Shifted characters
B.Missing characters
C.Duplicated characters
D.A garbled sequence of characters ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: Using a codeword rather than the actual string breaks the dependency chain, causing subsequent outputs to be constructed from wrong substrings, which typically results in a garbled and unreadable sequence.

Q15. Assess why Huffman coding may not be optimal for real‑time streaming applications compared to LZW. Which factor is most critical?

A.The need for a static tree
B.Variable‑length codes cause latency ✅
C.Dictionary size grows unbounded
D.The algorithm requires heavy computation
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Variable‑length codes can require bit‑level buffering and cannot be processed in fixed‑size blocks, introducing latency that is undesirable for low‑delay streaming, whereas LZW works with fixed‑size indices.

Q16. Suppose an LZW decoder is modified to output the index of the first character of each new entry instead of the full string. How would this affect the decoding process?

A.It would produce the same output as before
B.It would produce a shorter output
C.It would cause loss of information ✅
D.It would require extra steps to reconstruct the original message
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Outputting only an index discards the actual character data needed to rebuild the original string, so the decoded message would be incomplete and incorrect.

Q17. In the given decoding algorithm, what is the effect of initializing the dictionary with all single‑character strings versus initializing it empty?

A.Decoding starts faster because common symbols are already present ✅
B.The dictionary becomes unnecessarily large
C.There is no effect on decoding speed
D.The decoder would raise an error
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Having all single‑character entries from the start lets the decoder immediately translate the first few codewords without having to create those basic entries on the fly.

Q18. Apply the LZW decoding steps to the code sequence [65, 66, 256] assuming initial dictionary contains ASCII codes. What is the third output string?

A.AB ✅
B.A
C.B
D.AB?
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Code 65 outputs “A”, code 66 outputs “B” and adds entry 256 = “AB”. When code 256 is read, the entry exists and the decoder outputs “AB”.

Q19. Synthesize a scenario where using LZW decoding without resetting the dictionary after a reset in the encoder leads to security vulnerabilities in a digital signature system. Which issue arises?

A.Signature mismatch ✅
B.Increased collision probability
C.Dictionary overflow error
D.Unauthorized modification of the message
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: If the verifier’s decoder dictionary diverges from the signer’s encoder dictionary, the reconstructed message differs, causing the signature verification to fail and exposing the system to potential denial‑of‑service attacks.

Q20. Explain how the concept of a digital signature can be integrated with Huffman coding to ensure both integrity and compression. Which approach is valid?

A.Sign the original uncompressed data
B.Sign the compressed data ✅
C.Compress the signed data
D.None of the above
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Signing the compressed bitstream means the verifier checks the hash of exactly what was transmitted, guaranteeing integrity while still benefiting from the size reduction provided by Huffman coding.

Q21. If a digital signature algorithm uses a hash of the original message before Huffman coding, what is the effect on verification if the Huffman tree is changed after signing?

A.Verification fails ✅
B.Verification still passes
C.The effect is unchanged
D.It depends on the key length
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The hash was computed on the pre‑compressed message; altering the Huffman tree changes the encoded bits, so the verifier’s hash will not match, causing verification to fail.

Q22. Apply the principle of cause‑effect to explain why an error in the PreC buffer during LZW decoding propagates to subsequent output characters.

A.The error is isolated to one character
B.The error propagates because later entries depend on earlier strings ✅
C.The error is automatically corrected by the algorithm
D.The error has no effect on later output
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Each new dictionary entry builds on the previous string; a mistake in the stored previous codeword (PreC) changes the base string, causing every following entry that references it to be incorrect.

Q23. Given that LZW decoding relies on previously decoded strings, construct an argument for why tampering with early codewords can invalidate the entire decoded message.

A.Because of the dependency chain among entries ✅
B.Because the dictionary size becomes too large
C.Because a checksum is violated
D.Because randomness is introduced
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Early codewords determine the initial dictionary entries; any alteration corrupts those entries, and because later entries are constructed from them, the corruption cascades, rendering the whole message unreliable.

Q24. How would you modify the LZW decoding algorithm to support Unicode characters beyond the basic ASCII set while preserving digital signature verification?

A.Expand the dictionary size only
B.Use a multibyte encoding only
C.Both expand the dictionary and use multibyte encoding ✅
D.Do not modify the algorithm
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Unicode requires more symbols, so the dictionary must be enlarged and the algorithm must handle multibyte characters; these changes keep the decoding consistent, allowing signatures that were generated on the expanded alphabet to verify correctly.

Q25. If the codeword sequence includes a repeated pattern that maps to the same dictionary entry, how does LZW decoding ensure that the output remains consistent?

A.By referencing the same dictionary entry each time ✅
B.By recomputing the string from scratch
C.By resetting the dictionary after each repeat
D.By ignoring repeated codewords
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: When a codeword repeats, the decoder simply looks up the existing entry and outputs the stored string, guaranteeing identical output for each occurrence.

Q26. During LZW decoding, suppose the dictionary entry for code 300 is \XYZ\ and the next code read is 301 which is not yet defined. What string will be output for code 301?

A.XYZX
B.XYZY ✅
C.XYZ
D.An error is signaled
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The undefined‑codeword rule outputs the previous string (\XYZ\) plus its first character (\X\), resulting in \XYZX\.

Q27. Synthesize an approach to combine LZW compression with RSA‑based digital signatures such that the signature verifies the compressed data integrity. Which step is essential?

A.Sign the hash of the compressed data ✅
B.Sign the original data then compress
C.Compress the signed data
D.None of the above
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Computing a hash of the compressed bitstream and then signing that hash ensures that any alteration of the compressed data will be detected during verification.

Q28. Evaluate the security implications if an attacker can manipulate the dictionary initialization in LZW before a digital signature verification. Which vulnerability is most likely?

A.Chosen‑prefix attack
B.Dictionary collision ✅
C.Replay attack
D.Key leakage
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Altering the initial dictionary can cause the decoder to generate different strings for the same codewords, potentially leading to collisions that allow an attacker to craft a message that matches a legitimate signature.

🔗 Related Topics (MCQs)