edited by
17,723 views
36 36 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

6 Answers

Best answer
51 51 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
11 11 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 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
1 1 vote

Statement 1: Is correct

A hash function takes a message of arbitrary length and generates a fixed length code because it is working on method of (mod )

for example if we take (mod 10) then code will come in 0 ,1,2,3 …..up to 9 always so its give the fixed length 

statement 2: statement 2 is contrapositive of S1 so if s1 IS  true then 2 will be false

statement 3:a hash function may give the same hash value for distinct message

yes it may because its always generate fixed length so it will be possible 

–6 –6 votes
I think answer is B.... Correct me if wrong
edited by
Answer:
Position:
Show:

Related questions

60 60 votes
4 answers 4 answers
24.9k
24.9k views
Arjun asked Feb 12, 2020
24,929 views
Consider a double hashing scheme in which the primary hash function is $h_1(k)= k \text{ mod } 23$, and the secondary hash function is $h_2(k)=1+(k \text{ mod } 19)$. Ass...
57 57 votes
3 answers 3 answers
16.7k
16.7k views
Ishrat Jahan asked Nov 1, 2014
16,702 views
An array $X$ of n distinct integers is interpreted as a complete binary tree. The index of the first element of the array is $0$. If the root node is at level $0$, the le...
63 63 votes
6 answers 6 answers
21.4k
21.4k views
Ishrat Jahan asked Nov 1, 2014
21,373 views
An array $X$ of $n$ distinct integers is interpreted as a complete binary tree. The index of the first element of the array is $0$. The index of the parent of element $X[...
38 38 votes
6 answers 6 answers
26.5k
26.5k views
Ishrat Jahan asked Oct 31, 2014
26,468 views
Suppose that we have numbers between $1$ and $100$ in a binary search tree and want to search for the number $55$. Which of the following sequences CANNOT be the sequence...