edited by
12,050 views
28 votes
28 votes

Which of the following statement(s) is TRUE?

  1. A hash function takes a message of arbitrary length and generates a fixed length code.
  2. A hash function takes a message of fixed length and generates a code of variable length.
  3. A hash function may give the same hash value for distinct messages.
    1. I only
    2. II and III only
    3. I and III only
    4. II only
edited by

6 Answers

Best answer
40 votes
40 votes

Answer is (C).

  1. A hash function takes a message of arbitrary length and generates a fixed length code.. This is correct, this is directly from definition of hash function.   Ref: https://en.wikipedia.org/wiki/Hash_function
     
  2. As I is correct II is wrong !
     
  3. This is true. example: Hash function $N \%10$, this will generate same values for $1$ as well as $11$.

(Even in cryptographic hash functions collision happens, just that it is not easy to find colliding instances.)

edited by
9 votes
9 votes

for reference, hash function $f(x)$:
$$f(x) = x \text{ mod } 7$$

Statement I is true.
give hash function a number $x$ no matter big or small and it will map it to some fixed value(slot).

Statement III is true.
yes, it happens often that same number are mapped to same slots, giving rise to collisions in some cases.

Statement II maybe true.
we can code such a hash function too.

But since, I and III are given together as separate options then we choose option C as true.

4 votes
4 votes
Option is C because

i) its right because we can get value of variable length which will be divided by Hash Table size in further steps

ii)Its wrong because we will get a fixed value by dividing the value by HTS

iii)Yeah it may be same that's  what we called collision

so i and iii is right
Answer:

Related questions

57 votes
57 votes
11 answers
4
Ishrat Jahan asked Oct 31, 2014
25,856 views
In a binary tree, the number of internal nodes of degree $1$ is $5$, and the number of internal nodes of degree $2$ is $10$. The number of leaf nodes in the binary tree i...