Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Which of the following statement(s) is TRUE? ... Start Learning for Free
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.
  • a)
    I only
  • b)
    II and III only
  • c)
    I and III only
  • d)
    II only
Correct answer is option 'C'. Can you explain this answer?
Verified Answer
Which of the following statement(s) is TRUE? A hash function takes a m...
Hash function is defined as any function that can be used to map data of arbitrary size of data to a fixed size data.. The values returned by a hash function are called hash values, hash codes, digests, or simply hashes  : Statement 1 is correct Yes, it is possible that a Hash Function maps a value to a same location in the memmory that's why collision occurs and we have different technique to handle  this problem : Statement 3 is coorect. eg : we have hash function, h(x) = x mod 3 Acc to Statement 1, no matter what the value of 'x' is h(x) results in a fixed mapping location. Acc. to Statement 3, h(x) can result in same mapping mapping location for different value of 'x' e.g. if x = 4 or x = 7 , h(x) = 1 in both the cases, although collision occurs.
View all questions of this test
Most Upvoted Answer
Which of the following statement(s) is TRUE? A hash function takes a m...
Statement Analysis:
The question presents three statements about hash functions and asks which one(s) is true. We will analyze each statement separately to determine its validity.

Statement 1: A hash function takes a message of arbitrary length and generates a fixed length code.
Explanation: A hash function is a mathematical function that takes an input (message) and produces a fixed-size string of characters, which is typically a hash code or hash value. This statement is true because hash functions are designed to generate a fixed length code regardless of the length of the input message.

Statement 2: A hash function takes a message of fixed length and generates a code of variable length.
Explanation: This statement is false. Hash functions always produce a fixed length code regardless of the length of the input message. The purpose of a hash function is to provide a unique representation of the input message, and a variable length code would not fulfill this requirement.

Statement 3: A hash function may give the same hash value for distinct messages.
Explanation: This statement is true. Hash functions can produce the same hash value for different input messages, which is known as a hash collision. However, a good hash function should minimize the likelihood of collisions, ensuring that distinct messages have distinct hash values.

Conclusion:
Based on the analysis of the three statements, we can conclude that statement 1 and statement 3 are true. Therefore, the correct answer is option 'C' (I and III only).
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Top Courses for Computer Science Engineering (CSE)

Which of the following statement(s) is TRUE? A hash function takes a message of arbitrary length and generates a fixed length code. A hash function takes a message of fixed length and generates a code of variable length. A hash function may give the same hash value for distinct messages.a)I onlyb)II and III onlyc)I and III onlyd)II onlyCorrect answer is option 'C'. Can you explain this answer?
Question Description
Which of the following statement(s) is TRUE? A hash function takes a message of arbitrary length and generates a fixed length code. A hash function takes a message of fixed length and generates a code of variable length. A hash function may give the same hash value for distinct messages.a)I onlyb)II and III onlyc)I and III onlyd)II onlyCorrect answer is option 'C'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about Which of the following statement(s) is TRUE? A hash function takes a message of arbitrary length and generates a fixed length code. A hash function takes a message of fixed length and generates a code of variable length. A hash function may give the same hash value for distinct messages.a)I onlyb)II and III onlyc)I and III onlyd)II onlyCorrect answer is option 'C'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Which of the following statement(s) is TRUE? A hash function takes a message of arbitrary length and generates a fixed length code. A hash function takes a message of fixed length and generates a code of variable length. A hash function may give the same hash value for distinct messages.a)I onlyb)II and III onlyc)I and III onlyd)II onlyCorrect answer is option 'C'. Can you explain this answer?.
Solutions for Which of the following statement(s) is TRUE? A hash function takes a message of arbitrary length and generates a fixed length code. A hash function takes a message of fixed length and generates a code of variable length. A hash function may give the same hash value for distinct messages.a)I onlyb)II and III onlyc)I and III onlyd)II onlyCorrect answer is option 'C'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of Which of the following statement(s) is TRUE? A hash function takes a message of arbitrary length and generates a fixed length code. A hash function takes a message of fixed length and generates a code of variable length. A hash function may give the same hash value for distinct messages.a)I onlyb)II and III onlyc)I and III onlyd)II onlyCorrect answer is option 'C'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Which of the following statement(s) is TRUE? A hash function takes a message of arbitrary length and generates a fixed length code. A hash function takes a message of fixed length and generates a code of variable length. A hash function may give the same hash value for distinct messages.a)I onlyb)II and III onlyc)I and III onlyd)II onlyCorrect answer is option 'C'. Can you explain this answer?, a detailed solution for Which of the following statement(s) is TRUE? A hash function takes a message of arbitrary length and generates a fixed length code. A hash function takes a message of fixed length and generates a code of variable length. A hash function may give the same hash value for distinct messages.a)I onlyb)II and III onlyc)I and III onlyd)II onlyCorrect answer is option 'C'. Can you explain this answer? has been provided alongside types of Which of the following statement(s) is TRUE? A hash function takes a message of arbitrary length and generates a fixed length code. A hash function takes a message of fixed length and generates a code of variable length. A hash function may give the same hash value for distinct messages.a)I onlyb)II and III onlyc)I and III onlyd)II onlyCorrect answer is option 'C'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Which of the following statement(s) is TRUE? A hash function takes a message of arbitrary length and generates a fixed length code. A hash function takes a message of fixed length and generates a code of variable length. A hash function may give the same hash value for distinct messages.a)I onlyb)II and III onlyc)I and III onlyd)II onlyCorrect answer is option 'C'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev