Q13.Marks: +2.0UGC NET Paper 2: Computer Science 2020
Which among the following statement(s) is (are) true?
(A) A hash function takes a message of arbitrary length and generates a fixed length code.
(B) A hash function takes a message of fixed length and generates a code of variable length.
(C) A hash function may give same hash value for distinct messages.
Choose the correct answer from the options given below:
1.(A) only
2.(B) and (C) only
3.(A) and (C) only✓ Correct
4.(B) only
Solution
The correct answer is option 3.
Key Points
A hash function is defined as any function that can be used to map data of the arbitrary size of data to fixed-size data.
Definition of hash function Statement 1 is correct and Statement 1 is incorrect.
A hash function may give the same hash value for distinct messages. Yes, it's true. If N%10 is a Hash function. It gives the same values for 101, 11,21,31 as 1.
Hence statement C is correct. ∴ Hence the correct answer is (A) and (C) only.