📝 Security services and techniques in networks (12 MCQs)
Security Services That Protect Network Communication
Security services describe protections provided to users, systems, and transmitted information. Common services include authentication, access control, data confidentiality, data integrity, and non-repudiation. A service states the protection required; a security mechanism implements it. For example, encryption provides confidentiality, while a message authentication code can provide integrity and data-origin authentication between parties sharing a secret. Services are often combined within secure protocols so users receive several protections during one exchange.
Mechanisms Used to Deliver Security Services
Cryptographic mechanisms include encryption, hashing, message authentication codes, and digital signatures. Non-cryptographic controls include firewalls, access permissions, auditing, physical safeguards, and traffic filtering. Authentication may use passwords, cryptographic challenges, or multi-factor methods. A complete design combines mechanisms according to the service required instead of assuming one technique solves every security problem.
From Identity Verification to Protected Data Exchange
A network service may first authenticate a user or peer, then authorize requested operations. The communicating endpoints establish keys and select protection algorithms before exchanging sensitive information. Encryption conceals content, while an integrity mechanism detects unauthorized changes. Logs and access policies support accountability and help administrators investigate unusual activity after the communication session.
Example: Confidential and Authenticated Client Communication
A client connects to a server using a protocol that authenticates the server and establishes session keys. Encrypted records protect content, and an authenticated encryption mode detects tampering. The server separately checks the client's account permissions before returning private data. This example combines authentication, confidentiality, integrity, and access control as distinct services.
How Security Services Relate to Network Layers
Security can be applied at several layers. Link encryption protects a particular communication link, while network-layer or transport security can protect traffic across multiple network segments. Application security can authenticate users and protect specific records. The selected layer affects which devices, endpoints, and data fields receive protection, so services must be matched to system architecture.
Misconceptions About Security Services and Mechanisms
'A service is the same as an algorithm' is incorrect; a service states the protection, while an algorithm is one implementation tool. 'A hash encrypts data' is false; hashing is not reversible encryption. 'A digital signature hides a message' is false; signatures support verification, not confidentiality. Security decisions should therefore be based on the actual property each control provides.
Exam Focus: Matching Services to Mechanisms
Given a requirement, select the relevant service and an appropriate mechanism. Associate encryption with confidentiality, MACs with integrity and shared-key origin authentication, and digital signatures with integrity and public-key verification. Distinguish identification, authentication, and authorization, and explain why firewalls or audit logs complement rather than replace cryptographic protection. in practice.
Security Service and Mechanism Terms
- Service - Protection offered to a communicating entity.
- Mechanism - Technique implementing a security service.
- Hash - Fixed-length digest of input data.
- MAC - Keyed tag protecting message authenticity.
- Signature - Publicly verifiable cryptographic signing value.
- Audit - Recorded evidence of system activity.
📝 All Security services and techniques in networks MCQs
Q1. In the context of Huffman coding, what does it mean for a code to be a \prefix code\?
📖 Explanation: A prefix code guarantees that no code word is the beginning of another code word. This property prevents ambiguity during decoding because the moment a complete code is recognized, the decoder can output the symbol without needing to look ahead. It is a fundamental characteristic of Huffman codes.
Q2. Suppose a Huffman tree yields the codes 00, 010, 011, 10, and 11. Which of the following statements is logically implied?
📖 Explanation: Because the set {00,010,011,10,11} satisfies the prefix property, none of the shorter codes (00,10,11) can start any longer code. Therefore, each code can be identified uniquely as soon as its bits are read, confirming that no code is a prefix of any other.
Q3. If the symbol frequencies are A:40%, B:30%, C:20%, D:10% for four symbols, which coding scheme yields a lower average code length?
📖 Explanation: The Huffman algorithm assigns the shortest code to the most frequent symbol (A) and longer codes to less frequent symbols. With lengths 1,2,3,3 bits, the weighted average becomes 0.4·1+0.3·2+0.2·3+0.1·3 = 1.9 bits, which is less than the fixed 2‑bit average.
Q4. Given symbols X, Y, Z with probabilities 0.5, 0.3, 0.2, what is the optimal Huffman code length for each symbol?
📖 Explanation: The two lowest probabilities (0.3 and 0.2) are combined first, giving a node of weight 0.5. This node and the highest‑probability symbol (0.5) are then merged. The resulting tree gives X a depth of 1 bit, while Y and Z each have depth 2, matching the optimal Huffman lengths.
Q5. A message of 100 characters encoded with a fixed‑length 3‑bit code occupies 300 bits. Using the Huffman code shown in the passage (average length 2.1 bits per character), what is the percentage reduction in transmitted bits?
📖 Explanation: The fixed‑length representation needs 300 bits. The Huffman representation needs 100 × 2.1 = 210 bits. The reduction is (300 − 210) / 300 = 0.30, or 30 %. This demonstrates the compression benefit achieved by exploiting symbol frequencies with Huffman coding.
Q6. Why does the absence of a code being a prefix of another guarantee that Huffman decoding can be performed instantaneously?
📖 Explanation: When no code word is a prefix of another, the decoder can decide as soon as a complete code appears in the bit stream. There is no ambiguity, so the decoder never has to retract bits or look ahead, eliminating back‑tracking and enabling immediate symbol identification.
Q7. Design a Huffman code for the alphabet {A,B,C,D,E} with frequencies {0.4,0.2,0.2,0.1,0.1}. Which of the following sets of code lengths is feasible?
📖 Explanation: The Kraft inequality must hold for any prefix code. For the set {1,3,3,4,4}, the sum is 2⁻¹+2⁻³+2⁻³+2⁻⁴+2⁻⁴ = 0.5+0.125+0.125+0.0625+0.0625 = 0.875 ≤ 1, so it is feasible. The other options exceed 1, making them impossible for a prefix‑free Huffman code.
Q8. If a Huffman code assigns the 2‑bit code 00 to symbol X, which of the following statements must be true about any other symbol's code?
📖 Explanation: Because Huffman codes are prefix‑free, once a code word (00) is assigned, no other code can start with the same bit pattern. Otherwise, the decoder could not uniquely determine where the first symbol ends, violating the prefix property essential for instantaneous decoding.
Q9. A text string contains 50 occurrences of 'A', 30 of 'B', 15 of 'C', and 5 of 'D'. Using Huffman coding, what is the total number of bits needed to encode the string if the resulting code lengths are 1,2,3,3 bits respectively?
📖 Explanation: Compute the weighted sum: 50 × 1 = 50, 30 × 2 = 60, 15 × 3 = 45, 5 × 3 = 15. Adding these yields 50+60+45+15 = 170 bits. This total reflects the efficiency of Huffman coding compared with a fixed‑length scheme that would require 4 × 100 = 400 bits.
Q10. How does the average length of an optimal Huffman code relate to the source entropy for a set of symbols?
📖 Explanation: The optimal Huffman code achieves an average length that satisfies . This bound follows from the fact that Huffman coding produces a prefix code whose expected length cannot be shorter than the entropy, yet it never exceeds the entropy by more than one bit per symbol.
Q11. For a five‑character alphabet, the minimum fixed‑length code requires bits per symbol. What is this number?
📖 Explanation: The binary logarithm of 5 is approximately 2.32. Taking the ceiling gives the smallest integer not less than this value, which is 3. Therefore, any fixed‑length binary representation for five distinct symbols must use at least 3 bits per symbol.
Q12. Compared to a Shannon‑Fano code for the same symbol probabilities, a Huffman code is guaranteed to be:
📖 Explanation: Huffman coding constructs the optimal prefix code by repeatedly merging the two least‑probable symbols, guaranteeing the minimal possible average code length. Shannon‑Fano, which splits symbols based on cumulative probability, may produce longer average lengths. Consequently, Huffman's average length is always less than or equal to that of Shannon‑Fano for the same distribution.