🎓 BookMCQ
← Back to 31. Cryptography and Network Security

📝 Message integrity in network security (14 MCQs)

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

What is Message integrity in network security?

Message integrity in network security guarantees that data remains unchanged during transmission by using hash functions and checksums to detect any accidental or malicious modifications to the original message.

4
Easy
4
Medium
6
Hard

📝 All Message integrity in network security MCQs

Q1. What does the dictionary entry for the string 'BA' contain after it is added during LZW encoding?

A.PreS + char ✅
B.char only
C.codeword of BA
D.index of B
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: In LZW, a new entry is created by appending the current character to the previous string (PreS). Thus the entry for 'BA' is stored as the concatenation of the previous entry 'B' and the character 'A', i.e., PreS + char.

Q2. In the example, what is the codeword output for the first character 'B'?

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

📖 Explanation: The example's Table 28.2 shows the first codeword generated for the character 'B' as the value 3. This reflects the initial dictionary indexing used in the demonstration, where 'B' is assigned codeword 3 before any new entries are added.

Q3. If the current dictionary entry is 'AB' with index 4 and the next input character is 'A', what new dictionary entry will be created in the else‑clause?

A.AB A
B.AB+A
C.AB A (concatenated) ✅
D.AB
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: When the else‑clause executes, LZW adds a new entry formed by the previous string plus the next character. Here the previous string is 'AB' and the next character is 'A', so the new entry becomes the concatenation 'ABA', which matches option C.

Q4. Compare the actions taken in the if‑clause versus the else‑clause during LZW decoding. Which statement is true?

A.Both clauses output a character
B.Only the else‑clause adds a new dictionary entry ✅
C.Only the if‑clause adds a new entry
D.Neither clause modifies the dictionary
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: During LZW decoding, the if‑clause handles the normal case where the incoming codeword already exists, so no new entry is created. The else‑clause is triggered when the codeword is not yet in the dictionary, and it is the only branch that adds a new entry, making statement B correct.

Q5. In LZW decoding, if the next codeword is 5 but index 5 is not yet defined, what does the decoder output?

A.It outputs the previous string plus its first character ✅
B.It raises an error
C.It outputs the codeword as is
D.It resets the dictionary
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: When a codeword is encountered that is not yet in the dictionary, LZW specifies that the decoder should output the previous decoded string followed by its first character. This special case ensures continuity of the output stream, corresponding to option A.

Q6. Evaluate how the presence of an incorrect codeword (e.g., 7) in the compressed stream affects the integrity of the decoded message.

A.The message will be identical because LZW ignores unknown codes
B.A single wrong code corrupts the remainder of the output ✅
C.Only the symbol corresponding to the wrong code is lost
D.The decoder substitutes a placeholder
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: An invalid codeword disrupts the synchronization between encoder and decoder. Once the decoder misinterprets a codeword, subsequent dictionary look‑ups are based on a wrong state, causing the rest of the output to be corrupted. Hence a single erroneous code typically corrupts the remainder of the message.

Q7. Applying the principle of message integrity, which technique can be combined with LZW to detect accidental alterations after decompression?

A.RSA signature
B.Cyclic Redundancy Check (CRC) ✅
C.Run‑length encoding
D.Frequency analysis
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: A CRC computes a short checksum over the original data and can be verified after decompression. Because CRC detection is independent of the compression algorithm, it reliably reveals any accidental bit flips that may have occurred, making it a suitable companion for LZW when integrity verification is required.

Q8. Suppose you compute a hash of the original uncompressed data before LZW compression. After decompression, you compare hashes. Which statement best describes the impact on integrity verification?

A.Hash comparison is invalid because compression changes data
B.Hashes will match only if no transmission errors occurred ✅
C.Hashes are always different due to dictionary variations
D.Hashing the compressed data is more reliable
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The hash is calculated on the original plaintext; after successful decompression the same plaintext is recovered, so the hashes will be identical provided the transmission was error‑free. Any discrepancy indicates tampering or corruption, confirming integrity when the hashes match.

Q9. Given the following sequence of codewords: 2, 3, 2, 5, 6, where the dictionary after processing the first three codes contains entries: 0='A',1='B',2='AB',3='BA',4='ABA'. Determine the string produced by the decoder after processing codeword 5.

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

📖 Explanation: Processing 2 yields 'AB', 3 yields 'BA', and 2 again yields 'AB'. After these steps the decoder has added entry 4='ABA'. Codeword 5 refers to the newly created entry 5='ABAB' (previous string 'AB' plus first character of 'AB'), so the output after codeword 5 is 'ABAB'.

Q10. Analyze the effect of a dictionary overflow (exceeding the maximum code size of 12 bits) on message integrity. Which outcome is most likely?

A.The encoder stops adding new entries, causing repeated patterns
B.The decoder discards excess bits, leading to loss of data
C.Both encoder and decoder wrap around, preserving integrity
D.A synchronization error occurs, corrupting subsequent symbols ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: When the dictionary reaches the limit imposed by the code size, further additions cannot be represented correctly. This mismatch between encoder and decoder leads to loss of synchronization, causing subsequent symbols to be decoded incorrectly and thereby compromising message integrity.

Q11. Design a scheme that uses LZW compression together with a Merkle tree to guarantee message integrity. Which step is essential for the scheme to detect tampering?

A.Hash each dictionary entry before transmission
B.Include the root hash of the Merkle tree in the header ✅
C.Encrypt the compressed data with a symmetric key
D.Send the dictionary size separately
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: A Merkle tree provides a hierarchical set of hashes; by placing the root hash in the message header, any alteration to any part of the compressed data or dictionary will change the root hash, allowing the receiver to detect tampering by recomputing and comparing this value.

Q12. If an attacker modifies a single codeword in the compressed stream, what is the minimum number of output symbols that can be altered after decompression?

A.1
B.2
C.Variable, depending on dictionary state ✅
D.All subsequent symbols
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: The impact of a single altered codeword depends on where it occurs relative to the dictionary construction. In some cases the decoder may recover after the next correctly defined codeword, altering only a few symbols; in other cases the error propagates further. Hence the number of altered symbols is variable, not fixed.

Q13. Compare the error propagation characteristics of LZW versus Huffman coding when a bit error occurs. Which statement is accurate?

A.LZW errors affect only the erroneous symbol, Huffman errors affect the whole stream
B.Both cause errors that propagate to the end of the message
C.LZW errors can cause a cascade of wrong dictionary lookups, while Huffman errors are confined ✅
D.Huffman coding is more vulnerable to error propagation
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: A single bit error in Huffman coding typically desynchronizes the variable‑length code boundaries, causing the rest of the stream to be misinterpreted. LZW, however, may continue decoding correctly after the erroneous codeword because the dictionary can recover, but the wrong entry can trigger a cascade of incorrect look‑ups before synchronization is restored.

Q14. Which of the following best explains why integrating a cryptographic hash with LZW compressed data improves integrity without compromising compression efficiency?

A.Hashing the compressed data adds redundancy that aids compression
B.The hash validates the exact bit sequence after decompression, ensuring no alteration
C.Hashes are independent of the data size, so they do not affect compression
D.Combining hash and LZW allows early detection of errors before decoding ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: By appending a cryptographic hash of the compressed payload (or of the original data) to the transmitted packet, the receiver can verify integrity immediately after reception. This check occurs before decompression, allowing any tampering to be detected without needing to modify the LZW algorithm or its compression ratio.

🔗 Related Topics (MCQs)