InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What is a hash table?(a) A structure that maps values to keys(b) A structure that maps keys to values(c) A structure used for storage(d) A structure used to implement stack and queueMy query is from Hash Tables topic in chapter Hash Tables of Data Structures & Algorithms IThis question was addressed to me during a job interview. |
|
Answer» Correct OPTION is (b) A structure that MAPS keys to values |
|
| 2. |
If several elements are competing for the same bucket in the hash table, what is it called?(a) Diffusion(b) Replication(c) Collision(d) DuplicationI'm obligated to ask this question of Hash Tables in section Hash Tables of Data Structures & Algorithms IThis question was addressed to me by my school principal while I was bunking the class. |
|
Answer» Right ANSWER is (c) Collision |
|
| 3. |
What is direct addressing?(a) Distinct array position for every possible key(b) Fewer array positions than keys(c) Fewer keys than array positions(d) Same array position for all keysI want to ask this question from Hash Tables topic in section Hash Tables of Data Structures & Algorithms IThe question was posed to me by my college director while I was bunking the class. |
|
Answer» Correct option is (a) Distinct ARRAY position for EVERY possible KEY |
|
| 4. |
What is the search complexity in direct addressing?(a) O(n)(b) O(logn)(c) O(nlogn)(d) O(1)Asked question is from Hash Tables in division Hash Tables of Data Structures & Algorithms IThis question was addressed to me in a national level competition. |
|
Answer» Correct option is (d) O(1) |
|
| 5. |
What is a hash function?(a) A function has allocated memory to keys(b) A function that computes the location of the key in the array(c) A function that creates an array(d) A function that computes the location of the values in the arrayThe origin of the question is Hash Tables in portion Hash Tables of Data Structures & Algorithms IThis question was addressed to me during an interview. |
|
Answer» RIGHT choice is (b) A function that computes the LOCATION of the key in the array Easy explanation - In a hash table, there are FEWER array positions than the KEYS, so the POSITION of the key in the array has to be computed, this is done using the hash function. |
|
| 6. |
Which of the following is not a technique to avoid a collision?(a) Make the hash function appear random(b) Use the chaining method(c) Use uniform hashing(d) Increasing hash table sizeMy question is taken from Hash Tables topic in section Hash Tables of Data Structures & Algorithms II got this question by my school teacher while I was bunking the class. |
|
Answer» CORRECT choice is (d) Increasing hash table size To explain: On increasing hash table size, space complexity will increase as we NEED to reallocate the memory size of hash table for every collision. It is not the best TECHNIQUE to avoid a collision. We can avoid collision by MAKING hash FUNCTION random, chaining method and uniform hashing. |
|
| 7. |
What is the load factor?(a) Average array size(b) Average key size(c) Average chain length(d) Average hash table lengthQuestion is from Hash Tables in division Hash Tables of Data Structures & Algorithms IThis question was addressed to me in homework. |
|
Answer» The correct ANSWER is (c) Average chain length |
|
| 8. |
What is simple uniform hashing?(a) Every element has equal probability of hashing into any of the slots(b) A weighted probabilistic method is used to hash elements into the slots(c) Elements has Random probability of hashing into array slots(d) Elements are hashed based on priorityQuery is from Hash Tables topic in section Hash Tables of Data Structures & Algorithms IThis question was addressed to me by my college professor while I was bunking the class. |
|
Answer» The correct answer is (a) EVERY element has equal probability of hashing into any of the slots |
|
| 9. |
In simple uniform hashing, what is the search complexity?(a) O(n)(b) O(logn)(c) O(nlogn)(d) O(1)My question is from Hash Tables in division Hash Tables of Data Structures & Algorithms II have been asked this question in an international level competition. |
|
Answer» The CORRECT answer is (d) O(1) |
|
| 10. |
In simple chaining, what data structure is appropriate?(a) Singly linked list(b) Doubly linked list(c) Circular linked list(d) Binary treesI want to ask this question from Hash Tables in division Hash Tables of Data Structures & Algorithms IThis question was posed to me in exam. |
|
Answer» The correct CHOICE is (b) Doubly LINKED list |
|
| 11. |
The case in which a key other than the desired one is kept at the identified location is called?(a) Hashing(b) Collision(c) Chaining(d) Open addressingMy question is based upon Hash Tables topic in portion Hash Tables of Data Structures & Algorithms IThis question was addressed to me by my college professor while I was bunking the class. |
|
Answer» Right choice is (b) Collision |
|
| 12. |
What data organization method is used in hash tables?(a) Stack(b) Array(c) Linked list(d) QueueThis intriguing question originated from Hash Tables topic in section Hash Tables of Data Structures & Algorithms II have been asked this question in an online quiz. |
|
Answer» Correct option is (c) Linked LIST |
|
| 13. |
The task of generating alternative indices for a node is called?(a) Collision handling(b) Collision detection(c) Collision recovery(d) Closed hashingThe origin of the question is Hash Tables in division Hash Tables of Data Structures & Algorithms IThis question was addressed to me by my college professor while I was bunking the class. |
|
Answer» The correct OPTION is (a) Collision handling |
|
| 14. |
Which of the following is not a collision resolution technique?(a) Separate chaining(b) Linear probing(c) Quadratic probing(d) HashingThe query is from Hash Tables in chapter Hash Tables of Data Structures & Algorithms IThis question was addressed to me in final exam. |
|
Answer» The correct choice is (d) HASHING |
|
| 15. |
Hashing is the problem of finding an appropriate mapping of keys into addresses.(a) True(b) FalseThis is a very interesting question from Hash Tables in chapter Hash Tables of Data Structures & Algorithms II have been asked this question in homework. |
|
Answer» CORRECT option is (a) True Easiest explanation - HASHING is a DATA structure which is used to locate data in a table BASED on a key value. |
|
| 16. |
In a hash table of size 10, where is element 7 placed?(a) 6(b) 7(c) 17(d) 16I'd like to ask this question from Hash Tables topic in division Hash Tables of Data Structures & Algorithms IThe question was posed to me in exam. |
|
Answer» The correct option is (b) 7 |
|
| 17. |
What should be the load factor for separate chaining hashing?(a) 0.5(b) 1(c) 1.5(d) 2The question is from Hash Tables topic in chapter Hash Tables of Data Structures & Algorithms IThis question was addressed to me during an internship interview. |
|
Answer» Right option is (b) 1 |
|
| 18. |
Which of the following operations are done in a hash table?(a) Insert only(b) Search only(c) Insert and search(d) ReplaceI'm obligated to ask this question of Hash Tables in chapter Hash Tables of Data Structures & Algorithms II got this question in a national level competition. |
|
Answer» Correct answer is (c) Insert and search |
|
| 19. |
Which of the following is identical to that of a separate chaining hash node?(a) Linked list(b) Array(c) Stack(d) QueueI'm obligated to ask this question of Hash Tables in division Hash Tables of Data Structures & Algorithms IThis question was addressed to me during an internship interview. |
|
Answer» The correct answer is (a) Linked LIST |
|
| 20. |
Which of the following is the hashing function for separate chaining?(a) H(x)=(hash(x)+f(i)) mod table size(b) H(x)=hash(x)+i^2mod table size(c) H(x)=x mod table size(d) H(x)=x mod (table size * 2)This interesting question is from Hash Tables in chapter Hash Tables of Data Structures & Algorithms IThe question was posed to me in final exam. |
|
Answer» The correct option is (c) H(x)=x mod table size |
|
| 21. |
What is the correct notation for a load factor?(a) Ω(b) ∞(c) ∑(d) ⅄The query is from Hash Tables topic in division Hash Tables of Data Structures & Algorithms IThis question was addressed to me during an interview. |
|
Answer» The CORRECT option is (d) ⅄ |
|
| 22. |
In hash tables, how many traversal of links does a successful search require?(a) 1+⅄(b) 1+⅄^2(c) 1+ (⅄/2)(d) ⅄^3My query is from Hash Tables topic in portion Hash Tables of Data Structures & Algorithms II had been asked this question by my school principal while I was bunking the class. |
|
Answer» Right option is (C) 1+ (⅄/2) |
|
| 23. |
Which of the following is a disadvantage of using separate chaining using linked lists?(a) It requires many pointers(b) It requires linked lists(c) It uses array(d) It does not resolve collisionThe query is from Hash Tables topic in chapter Hash Tables of Data Structures & Algorithms IThe question was asked during an interview. |
|
Answer» Correct choice is (a) It requires MANY POINTERS |
|
| 24. |
What is the worst case search time of a hashing using separate chaining algorithm?(a) O(N log N)(b) O(N)(c) O(N^2)(d) O(N^3)The above asked question is from Hash Tables topic in portion Hash Tables of Data Structures & Algorithms II got this question in unit test. |
|
Answer» RIGHT answer is (b) O(N) For explanation: The worst CASE search time of SEPARATE chaining algorithm using linked lists is mathematically FOUND to be O(N). |
|
| 25. |
Which of the following is used in hash tables to determine the index of any input record?(a) hash function(b) hash linked list(c) hash tree(d) hash chainingQuery is from Hash Tables in division Hash Tables of Data Structures & Algorithms IThis question was posed to me in semester exam. |
|
Answer» Right option is (a) hash function |
|
| 26. |
What is the advantage of a hash table as a data structure?(a) faster access of data(b) easy to implement(c) very efficient for less number of entries(d) exhibit good locality of referenceMy enquiry is from Hash Tables topic in chapter Hash Tables of Data Structures & Algorithms IThe question was asked in homework. |
|
Answer» Right CHOICE is (a) faster access of data |
|
| 27. |
What is the use of a hash function?(a) to calculate and return the index of corresponding data(b) to store data(c) to erase data(d) to change dataMy question is taken from Hash Tables in division Hash Tables of Data Structures & Algorithms IThe question was asked in my homework. |
|
Answer» The correct answer is (a) to CALCULATE and return the index of corresponding DATA |
|
| 28. |
What is the time complexity of insert function in a hash table using a doubly linked list?(a) O(1)(b) O(n)(c) O(log n)(d) O(n log n)My question is taken from Hash Tables in division Hash Tables of Data Structures & Algorithms IThis question was addressed to me in quiz. |
|
Answer» The correct option is (a) O(1) |
|
| 29. |
What is the time complexity of search function in a hash table using a doubly linked list?(a) O(1)(b) O(n)(c) O(log n)(d) O(n log n)This interesting question is from Hash Tables in section Hash Tables of Data Structures & Algorithms II have been asked this question in examination. |
|
Answer» RIGHT ANSWER is (a) O(1) To explain: Time complexity of search function in a HASH table is O(1). Condition is that the number of collisions should be LOW. |
|
| 30. |
What is the time complexity of delete function in the hash table using a doubly linked list?(a) O(1)(b) O(n)(c) O(log n)(d) O(n log n)This key question is from Hash Tables in portion Hash Tables of Data Structures & Algorithms IThis question was addressed to me during an online exam. |
|
Answer» Right OPTION is (a) O(1) |
|
| 31. |
Hashing can be used to encrypt and decrypt digital signatures.(a) true(b) falseThe origin of the question is Hash Tables in division Hash Tables of Data Structures & Algorithms II had been asked this question in an online quiz. |
|
Answer» Right option is (a) true |
|
| 32. |
What is the advantage of using a doubly linked list for chaining over singly linked list?(a) it takes less memory(b) it is easy to implement(c) it makes the process of insertion and deletion faster(d) it causes less collisionsThis interesting question is from Hash Tables in chapter Hash Tables of Data Structures & Algorithms II had been asked this question during an online interview. |
|
Answer» CORRECT option is (c) it makes the PROCESS of insertion and DELETION faster Easiest explanation - Using a doubly linked list reduces time complexity significantly. THOUGH it USES more memory to store the extra pointer. |
|
| 33. |
Which of the following technique stores data in the hash table itself in case of a collision?(a) Open addressing(b) Chaining using linked list(c) Chaining using doubly linked list(d) Chaining using binary treeI want to ask this question from Hash Tables in division Hash Tables of Data Structures & Algorithms IThe question was asked in quiz. |
|
Answer» Correct answer is (a) Open ADDRESSING |
|
| 34. |
Which of the following technique stores data in a separate entity in case of a collision?(a) Open addressing(b) Chaining using doubly linked list(c) Linear probing(d) Double hashingThis is a very interesting question from Hash Tables in portion Hash Tables of Data Structures & Algorithms II got this question during an online interview. |
|
Answer» CORRECT answer is (b) Chaining using doubly linked list Best EXPLANATION: Chaining using doubly linked list is used to store data in a separate entity (doubly linked list in this CASE) in case of a COLLISION. Whereas open addressing stores it in the table itself. |
|
| 35. |
Collision is caused due to the presence of two keys having the same value.(a) True(b) FalseThis interesting question is from Hash Tables topic in division Hash Tables of Data Structures & Algorithms IThe question was asked in final exam. |
|
Answer» Right choice is (a) True |
|
| 36. |
Which of the following variant of a hash table has the best cache performance?(a) hash table using a linked list for separate chaining(b) hash table using binary search tree for separate chaining(c) hash table using open addressing(d) hash table using a doubly linked list for separate chainingEnquiry is from Hash Tables in section Hash Tables of Data Structures & Algorithms IThe question was posed to me in quiz. |
|
Answer» The correct choice is (c) hash table using open ADDRESSING |
|
| 37. |
What is the advantage of hashing with chaining?(a) cache performance is good(b) uses less space(c) less sensitive to hash function(d) has a time complexity of O(n) in the worst caseThis key question is from Hash Tables in division Hash Tables of Data Structures & Algorithms IThe question was asked during an online interview. |
|
Answer» The correct CHOICE is (c) LESS sensitive to hash FUNCTION |
|
| 38. |
What is the disadvantage of hashing with chaining?(a) not easy to implement(b) takes more space(c) quite sensitive to hash function(d) table gets filled up easilyQuestion is taken from Hash Tables in division Hash Tables of Data Structures & Algorithms II had been asked this question in an interview. |
|
Answer» Right choice is (B) TAKES more space |
|
| 39. |
What is the time complexity of insert function in a hash table using a binary tree?(a) O(1)(b) O(n)(c) O(log n)(d) O(n log n)My question comes from Hash Tables in division Hash Tables of Data Structures & Algorithms II had been asked this question in homework. |
|
Answer» Right ANSWER is (a) O(1) |
|
| 40. |
What is the time complexity of the search function in a hash table using a binary tree?(a) O(1)(b) O(n)(c) O(log n)(d) O(n log n)Question is from Hash Tables in division Hash Tables of Data Structures & Algorithms II had been asked this question in unit test. |
|
Answer» RIGHT CHOICE is (a) O(1) BEST EXPLANATION: Time complexity of search function in a hash table is O(1). Condition is that the number of COLLISIONS should be low. |
|
| 41. |
What is the time complexity of the delete function in the hash table using a binary tree?(a) O(1)(b) O(n)(c) O(log n)(d) O(n log n)Question is from Hash Tables in section Hash Tables of Data Structures & Algorithms II got this question in an interview. |
|
Answer» The correct choice is (a) O(1) |
|
| 42. |
What is the advantage of a hash table over BST?(a) hash table has a better average time complexity for performing insert, delete and search operations(b) hash table requires less space(c) range query is easy with hash table(d) easier to implementI want to ask this question from Hash Tables in portion Hash Tables of Data Structures & Algorithms IThe question was posed to me in an online interview. |
|
Answer» Right answer is (a) hash table has a better average time complexity for PERFORMING insert, delete and search OPERATIONS |
|
| 43. |
What is the disadvantage of BST over the hash table?(a) BST is easier to implement(b) BST can get the keys sorted by just performing inorder traversal(c) BST can perform range query easily(d) Time complexity of hash table in inserting, searching and deleting is less than that of BSTI want to ask this question from Hash Tables topic in section Hash Tables of Data Structures & Algorithms II have been asked this question during an online exam. |
|
Answer» CORRECT option is (d) TIME complexity of hash table in inserting, searching and deleting is less than that of BST To explain: BST has an advantage that it is easier to implement, can get the keys sorted by just performing in-order traversal and can perform range query easily. Hash table has LESSER time complexity for performing insert, DELETE and search OPERATIONS. |
|
| 44. |
Which of the following technique stores data separately in case of a collision?(a) Open addressing(b) Double hashing(c) Quadratic probing(d) Chaining using a binary treeThis is a very interesting question from Hash Tables in section Hash Tables of Data Structures & Algorithms IThis question was addressed to me in an interview. |
|
Answer» Correct option is (d) Chaining using a binary tree |
|
| 45. |
Separate chaining is easier to implement as compared to open addressing.(a) true(b) falseMy question is from Hash Tables in division Hash Tables of Data Structures & Algorithms II got this question in quiz. |
|
Answer» Correct answer is (a) true |
|
| 46. |
In open addressing the hash table can never become full.(a) True(b) FalseMy doubt stems from Hash Tables in section Hash Tables of Data Structures & Algorithms II had been asked this question during an internship interview. |
|
Answer» Correct option is (B) False |
|
| 47. |
Which of the following helps keys to be mapped into addresses?(a) hash function(b) separate chaining(c) open addressing(d) chaining using a linked listThis question is from Hash Tables topic in division Hash Tables of Data Structures & Algorithms II had been asked this question by my college director while I was bunking the class. |
|
Answer» The CORRECT answer is (a) hash function |
|
| 48. |
What is the advantage of the hash table over a linked list?(a) faster access of data(b) easy to implement(c) very efficient for less number of entries(d) exhibit good locality of referenceThe query is from Hash Tables topic in division Hash Tables of Data Structures & Algorithms IThe question was posed to me during an internship interview. |
|
Answer» Right ANSWER is (a) faster access of data |
|
| 49. |
Which of the following trait of a hash function is most desirable?(a) it should cause less collisions(b) it should cause more collisions(c) it should occupy less space(d) it should be easy to implementQuery is from Hash Tables topic in portion Hash Tables of Data Structures & Algorithms II got this question in an internship interview. |
|
Answer» Correct option is (a) it should CAUSE less collisions |
|
| 50. |
What is the time complexity of insert function in a hash table using list head?(a) O(1)(b) O(n)(c) O(log n)(d) O(n log n)The above asked question is from Hash Tables topic in division Hash Tables of Data Structures & Algorithms IThe question was posed to me during an interview for a job. |
|
Answer» CORRECT answer is (a) O(1) The best I can explain: TIME complexity of insert function in a HASH table is O(1). Condition is that the number of collisions should be LOW. |
|