Explore topic-wise InterviewSolutions in .

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.

51.

What is the time complexity of search function in a hash table using list head?(a) O(1)(b) O(n)(c) O(log n)(d) O(n log n)I'm obligated to ask this question of Hash Tables in division Hash Tables of Data Structures & Algorithms IThe question was posed to me during a job interview.

Answer»

Correct ANSWER is (a) O(1)

The BEST explanation: Time complexity of search function in a hash table is O(1). Condition is that the NUMBER of COLLISIONS should be low.

52.

What is the time complexity of delete function in the hash table using list head?(a) O(1)(b) O(n)(c) O(log n)(d) O(n log n)My question comes from Hash Tables topic in section Hash Tables of Data Structures & Algorithms IThis question was posed to me in final exam.

Answer»

Correct CHOICE is (a) O(1)

To explain: Time complexity of delete function in a hash table is O(1). CONDITION is that the hash function should be such that the NUMBER of collisions should be low.

53.

A hash table may become full in the case when we use open addressing.(a) true(b) falseI'd like to ask this question from Hash Tables in chapter Hash Tables of Data Structures & Algorithms IThe question was posed to me in semester exam.

Answer» CORRECT CHOICE is (a) true

The EXPLANATION is: A hash table may become full in the case when we use OPEN ADDRESSING. But when we use separate chaining it does not happen.
54.

What is the advantage of using linked list over the doubly linked list for chaining?(a) it takes less memory(b) it causes more collisions(c) it makes the process of insertion and deletion faster(d) it causes less collisionsThe query is from Hash Tables topic in division Hash Tables of Data Structures & Algorithms IThe question was posed to me in homework.

Answer»

The correct choice is (a) it takes less memory

Easy explanation - SINGLY linked list takes LESSER space as compared to DOUBLY linked list. But the time COMPLEXITY of the singly linked list is more than a doubly linked list.

55.

What is the worst case time complexity of insert function in the hash table when the list head is used for chaining?(a) O(1)(b) O(n log n)(c) O(log n)(d) O(n)I want to ask this question from Hash Tables topic in section Hash Tables of Data Structures & Algorithms II had been asked this question in quiz.

Answer» CORRECT option is (d) O(n)

The best I can EXPLAIN: Worst case time complexity of insert function in the hash table when the list HEAD is used for chaining is O(n). It is caused when a number of COLLISIONS are very high.
56.

Which of the following technique is used for handling collisions in a hash table?(a) Open addressing(b) Hashing(c) Searching(d) Hash functionThe origin of the question is Hash Tables in portion Hash Tables of Data Structures & Algorithms II had been asked this question during an interview.

Answer» RIGHT ANSWER is (a) Open addressing

To explain: Open addressing is the technique which is used for HANDLING COLLISIONS in a hash table. Separate CHAINING is another technique which is used for the same purpose.
57.

By implementing separate chaining using list head we can reduce the number of collisions drastically.(a) True(b) FalseI'd like to ask this question from Hash Tables topic in section Hash Tables of Data Structures & Algorithms IThe question was posed to me in my homework.

Answer»

Correct answer is (b) False

Easy EXPLANATION - Collision is caused when a hash function returns repeated values. So collisions can be REDUCED by developing a better hash function. Whereas separate CHAINING using list head is a collision HANDLING technique so it has no relation with a NUMBER of collisions taking place.

58.

Which of the following is an advantage of open addressing over separate chaining?(a) it is simpler to implement(b) table never gets full(c) it is less sensitive to hash function(d) it has better cache performancePlease explain the answer as well.

Answer»

Correct choice is (a) it is simpler to implement

For explanation: Open ADDRESSING is the TECHNIQUE which is used for handling collisions in a hash table. It has a BETTER cache performance as EVERYTHING is STORED in the same table.

59.

How is a bit vector better compared to a normal array for implementing the hash table?(a) It saves time(b) It saves space(c) It saves both time and space(d) It reduces code complexityMy query is from Direct Addressing Tables in portion Hash Tables of Data Structures & Algorithms IThis question was posed to me at a job interview.

Answer»

Correct option is (B) It saves SPACE

The best I can EXPLAIN: A bit vector is an array of BITS of only 0s and 1s, a bit vector of length m takes much less space than an array of m pointers. The complexity to implement bit vector is larger than in normal case.

60.

What is the time complexity to delete an element from the direct address table?(a) O(n)(b) O(logn)(c) O(nlogn)(d) O(1)Question is taken from Direct Addressing Tables in chapter Hash Tables of Data Structures & Algorithms II have been asked this question during an internship interview.

Answer»

Right choice is (d) O(1)

The explanation is: As every KEY has a unique array POSITION, it takes constant time to delete an element, although the DELETED position must be SPECIFIED by nil.

61.

What is the advantage of using a dynamic set in direct addressing?(a) It saves time(b) It saves space(c) It saves both time and space(d) It reduces code complexityEnquiry is from Direct Addressing Tables topic in division Hash Tables of Data Structures & Algorithms II had been asked this question in an internship interview.

Answer»

The correct CHOICE is (b) It saves space

Explanation: Using a dynamic set, the size of the ARRAY is restricted to the number of keys, hence saves space. The complexity to implement dynamic array is LARGER than in NORMAL case.

62.

What is the time complexity to insert an element into the direct address table?(a) O(n)(b) O(logn)(c) O(nlogn)(d) O(1)This is a very interesting question from Direct Addressing Tables in chapter Hash Tables of Data Structures & Algorithms IThis question was posed to me in examination.

Answer»

Right choice is (d) O(1)

The best I can explain: As every KEY has a unique array POSITION, it takes CONSTANT TIME to insert an element.

63.

What is the search complexity in direct addressing?(a) O(n)(b) O(logn)(c) O(nlogn)(d) O(1)This interesting question is from Direct Addressing Tables in chapter Hash Tables of Data Structures & Algorithms II had been asked this question in examination.

Answer»

The CORRECT answer is (d) O(1)

For explanation: Since every key has a UNIQUE ARRAY position, SEARCHING TAKES a constant time.

64.

When is it appropriate to use direct addressing?(a) When the array is comparatively large(b) When the universe U of keys is reasonably small(c) When the universe U of keys is reasonably large(d) When the array is comparatively smallThe doubt is from Direct Addressing Tables in portion Hash Tables of Data Structures & Algorithms IThis question was addressed to me in homework.

Answer»

Right CHOICE is (b) When the universe U of keys is reasonably SMALL

The best explanation: Since each key is associated with a SLOT in the array, it is better to use direct addressing when the universe of keys is small as the array size grows with the increase in number of keys.

65.

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) Distinct array positions for keys based on priorityQuestion is from Direct Addressing Tables in division Hash Tables of Data Structures & Algorithms IThis question was posed to me during an interview.

Answer» RIGHT option is (a) Distinct array position for every possible KEY

For explanation: Direct ADDRESSING is possible only when we can afford to ALLOCATE an array that has ONE position for every possible key.
66.

Did Google conduct a large evaluation for comparing the performance by two technique MinHash and SimHash.(a) True(b) FalseThis key question is from Hash Tables topic in division 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) True

Best explanation: MinHash was originally used to remove the duplicate webpages from a search engine. But in data MINING, MinHash used as a tool for ASSOCIATION RULE LEARNING by Cohen at 2001. Google conducted a survey to compare the PERFORMANCE by two technique MinHash and SimHash.

67.

Is MinHash used as a tool for association rule learning.(a) True(b) FalseThis intriguing question originated from Hash Tables topic in chapter Hash Tables of Data Structures & Algorithms IThe question was asked by my college professor while I was bunking the class.

Answer»

Right option is (a) True

The explanation is: MinHash was originally used to remove the duplicate webpages from a search ENGINE. But in DATA MINING, MinHash used as a TOOL for ASSOCIATION rule learning by Cohen at 2001.

68.

How many bits are needed to specify the single permutation by min-wise independent family?(a) O (log n!)(b) O (n!)(c) Ω (n^2)(d) Ω (n)Asked question is from Hash Tables topic in chapter Hash Tables of Data Structures & Algorithms IThis question was addressed to me in final exam.

Answer»

The correct CHOICE is (d) Ω (n)

Explanation: The TIME REQUIRED for single variant hashing to maintain the MINIMUM hash queue is O (n). Ω (n) bits are NEEDED to specify the single permutation by min-wise independent family.

69.

What is the time required for single variant hashing to maintain the minimum hash queue?(a) O (log n!)(b) O (n!)(c) O (n^2)(d) O (n)The question is from Hash Tables topic in chapter Hash Tables of Data Structures & Algorithms II have been asked this question during an online exam.

Answer»

Right choice is (d) O (n)

The EXPLANATION is: The expected error for estimating the Jaccard index using MinHash SCHEME for k DIFFERENT hash functions is O (1/k½). The TIME required for single variant hashing to maintain the MINIMUM hash queue is O (n).

70.

What is the expected error by the estimator Chernoff bound on the samples performed without replacement?(a) O (log k!)(b) O (k!)(c) O (k^2)(d) O (1/k½)This interesting question is from Hash Tables topic in section Hash Tables of Data Structures & Algorithms II had been asked this question during an online exam.

Answer»

The CORRECT choice is (d) O (1/k½)

The BEST explanation: The expected ERROR for estimating the Jaccard index USING MinHash scheme for K different hash functions is O (1/k½). The expected error by the estimator Chernoff bound on the samples performed without replacement is O (1/k½).

71.

How many hashes will be needed for calculating Jaccard index with an expected error less than or equal to 0.05?(a) 100(b) 200(c) 300(d) 400My doubt stems from Hash Tables topic in chapter Hash Tables of Data Structures & Algorithms IThe question was posed to me by my college professor while I was bunking the class.

Answer»

The correct ANSWER is (d) 400

Easy EXPLANATION - The expected error for estimating the Jaccard index using MinHash scheme for k different hash functions is O (1/k½). 400 hashes will be needed for calculating Jaccard index with an expected error less than or equal to 0.05.

72.

What is the expected error for estimating the Jaccard index using MinHash scheme for k different hash functions?(a) O (log k!)(b) O (k!)(c) O (k^2)(d) O (1/k½)My query is from Hash Tables topic in portion Hash Tables of Data Structures & Algorithms II got this question by my school teacher while I was bunking the class.

Answer»

Right option is (d) O (1/k½)

Best explanation: Jaccard Coefficient Index is defined as the ratio of total elements of intersection and UNION of two sets. For two DISJOINT sets, the value of the Jaccard index is zero. The EXPECTED error for ESTIMATING the Jaccard index using MinHash scheme for k DIFFERENT hash functions is O (1/k½).

73.

When are the members of two sets more common relatively?(a) Jaccard Index is Closer to 1(b) Jaccard Index is Closer to 0(c) Jaccard Index is Closer to -1(d) Jaccard Index is Farther to 1Query is from Hash Tables topic in division Hash Tables of Data Structures & Algorithms II got this question during an online exam.

Answer»

The correct option is (a) Jaccard INDEX is CLOSER to 1

Easy explanation - Jaccard Coefficient Index is defined as the ratio of total elements of intersection and union of two sets. For two disjoint sets, the value of the Jaccard index is zero. The MEMBERS of two set more common relatively when the Jaccard Index is Closer to 1.

74.

What is the value of the Jaccard index when the two sets are disjoint?(a) 1(b) 2(c) 3(d) 0This is a very interesting question from Hash Tables topic in chapter Hash Tables of Data Structures & Algorithms II had been asked this question in semester exam.

Answer»

Correct answer is (d) 0

For explanation: MinHash HELPS in the quick estimation of similarity between two sets. Jaccard Coefficient is used for the similarity between two sets. Jaccard Coefficient INDEX is defined as the ratio of TOTAL elements of intersection and union of two sets. For two disjoint sets, the value of the Jaccard index is ZERO.

75.

Which of the following is defined as the ratio of total elements of intersection and union of two sets?(a) Rope Tree(b) Jaccard Coefficient Index(c) Tango Tree(d) MinHash CoefficientMy question comes from Hash Tables topic in chapter Hash Tables of Data Structures & Algorithms IThis question was addressed to me in a job interview.

Answer»

Right option is (b) Jaccard Coefficient Index

For EXPLANATION: MinHash helps in the quick estimation of similarity between two sets. Jaccard Coefficient is used for similarity between two sets. Jaccard Coefficient Index is defined as the RATIO of TOTAL elements of INTERSECTION and UNION of two sets.

76.

Which indicator is used for similarity between two sets?(a) Rope Tree(b) Jaccard Coefficient(c) Tango Tree(d) MinHash CoefficientOrigin of the question is Hash Tables in division Hash Tables of Data Structures & Algorithms IThis question was posed to me in an interview for job.

Answer» RIGHT choice is (b) Jaccard Coefficient

For explanation: In computer SCIENCE as WELL as data mining, to find the SIMILARITY between two given sets, a technique called MinHash or min-wise independent permutation scheme is used. It helps in the quick estimation of similarity between two sets. Jaccard Coefficient is used for similarity between two sets.
77.

Which technique was firstly used clustering documents using the similarity of two words or strings?(a) MinHash(b) Stack(c) Priority Queue(d) PAT TreeMy enquiry is from Hash Tables in portion Hash Tables of Data Structures & Algorithms IThe question was asked in quiz.

Answer»

Right choice is (a) MinHash

Easiest explanation - In computer science as well as data MINING, to find the similarity between two given sets, a technique called MinHash or min-wise independent PERMUTATION SCHEME is used. It HELPS in the quick estimation of similarity between two sets. It is used in CLUSTERING documents using the similarity of two words or strings.

78.

Which technique was firstly used to remove duplicate web pages from search results in AltaVista search engine?(a) MinHash(b) Stack(c) Priority Queue(d) PAT TreeThe query is from Hash Tables topic in division Hash Tables of Data Structures & Algorithms II had been asked this question during an interview.

Answer»

Right answer is (a) MinHash

The best explanation: In computer science as well as data mining, to FIND the similarity between two given sets, a technique called MinHash or min-wise independent permutation SCHEME is USED. It helps in the quick estimation of the similarity between two sets. It is used in removing duplicate WEB pages from search RESULTS in AltaVista search engine.

79.

Who invented the MinHash technique?(a) Weiner(b) Samuel F. B. Morse(c) Friedrich Clemens Gerke(d) Andrei BroderThe above asked question is from Hash Tables topic in chapter Hash Tables of Data Structures & Algorithms II had been asked this question in an interview for job.

Answer»

The correct answer is (d) Andrei BRODER

Easiest EXPLANATION - In COMPUTER science as well as data MINING, to find the similarity between two given sets, a TECHNIQUE called MinHash or min-wise independent permutation scheme is used. It helps in the quick estimation of the similarity between two sets. It was invented by Andrei Broder in 1997.

80.

Which technique is used for finding similarity between two sets?(a) MinHash(b) Stack(c) Priority Queue(d) PAT TreeMy doubt stems from Hash Tables in section Hash Tables of Data Structures & Algorithms IThe question was posed to me in an international level competition.

Answer»

Right option is (a) MinHash

The best explanation: In computer SCIENCE as well as data MINING, to find the SIMILARITY between two given sets, a technique called MinHash or min-wise INDEPENDENT permutation scheme is used. It helps in the quick ESTIMATION of the similarity between two sets.

81.

Hash tree is used in data synchronisation. In the worst case the data synchronisation takes ______ time.(a) O(logn)(b) O(n^2)(c) O(nlogn)(d) O(n)My enquiry is from Hash Tables in section Hash Tables of Data Structures & Algorithms II had been asked this question by my college professor while I was bunking the class.

Answer»

The correct ANSWER is (d) O(n)

The best explanation: In average scenarios, the SYNCHRONISATION takes O(logn) because it is BASED on the traversal and SEARCHING. The worst case occurs when there are no NODES in common, so the synchronisation takes O(n) time.

82.

Sequential access in a Hash tree is faster than in B-trees.(a) True(b) FalseMy question comes from Hash Tables in chapter Hash Tables of Data Structures & Algorithms IThe question was asked in semester exam.

Answer»

Right OPTION is (a) True

For explanation: The sequential access in the HASH TREE is more efficient and faster than in B-tree. Because while constructing the hash tree in the expansions and contractions of the FILE is an estimated.

83.

What is the worst case time complexity of the insertion in the hash tree?(a) O(logk(n))(b) O(n^2)(c) O(nlogk(n))(d) O(kn)This interesting question is from Hash Tables in division Hash Tables of Data Structures & Algorithms II had been asked this question by my school principal while I was bunking the class.

Answer»

The CORRECT choice is (a) O(logk(n))

For explanation: To insert a RECORD in the hash tree the key is compressed and hashed to get the slot for the ENTRY. So, a hash tree with branching FACTOR k takes O(logk(n)) for INSERTION in worst case.

84.

Where is the hash tree used?(a) in digital currency(b) in sorting of large data(c) for indexing in databases(d) in encryption of dataThe question is from Hash Tables topic in section Hash Tables of Data Structures & Algorithms II have been asked this question during an internship interview.

Answer»

Correct option is (a) in digital currency

The BEST I can explain: Using Hash tree the DATA VERIFICATION, data SYNCHRONISATION and the consistency verification can be done efficiently. So, the hash tree are digital CURRENCIES to organise the transactions.

85.

What will be the height of the hash tree with branching factor 2 and with 8 records?(a) 3(b) 5(c) 4(d) 6This interesting question is from Hash Tables in portion Hash Tables of Data Structures & Algorithms II got this question in exam.

Answer»

Right option is (c) 4

The BEST I can explain: Consider 8 RECORDS A B C D E F G H. These records are stored in Hash tree in as SHOWN in FIGURE below.

86.

Hash tree is also known as _____(a) Merkle tree(b) T -tree(c) Hash table(d) B^x-treeMy question is based upon Hash Tables topic in portion Hash Tables of Data Structures & Algorithms II have been asked this question in an interview for internship.

Answer»

The correct choice is (a) Merkle TREE

To explain: Hash tree is generally known as Merkle tree after RALPH Merkle who patented it in 1979. Typically Merkle trees have a branching factor of 2, meaning that each NODE has up to 2 children.

87.

Which of the following is true for a Hash tree?(a) Hashing is used for sequential access(b) Indexing is used for direct access(c) Hash tree allows only sequential access(d) Hashing is used for direct accessMy question comes from Hash Tables in portion Hash Tables of Data Structures & Algorithms IThis question was addressed to me by my school teacher while I was bunking the class.

Answer»

The correct option is (d) HASHING is used for direct ACCESS

Easiest explanation - Hash tree allows direct as WELL as SEQUENTIAL access of the records. Hashing is used for direct access and indexing is GENERALLY used for the sequential access.

88.

Which of the following is a widely used form of the hash tree?(a) B+ – tree(b) T tree(c) Tiger tree hash(d) HtreeThe question is from Hash Tables in portion Hash Tables of Data Structures & Algorithms IThe question was posed to me in an internship interview.

Answer» CORRECT option is (c) Tiger tree hash

The explanation is: The general form the hash tree which is used widely is the Tiger tree hash. It USES a binary hash tree, USUALLY has a data block size of 1024 BYTES and uses the Tiger hash.
89.

Hash tree is used in effective data verification in distributed systems.(a) True(b) FalseMy query 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 choice is (a) True

The explanation is: HASH trees are used in DISTRIBUTED SYSTEMS for efficient data verification. Hash TREE used hashes instead of the full files, hence they are efficient. Because Hashes are ways of ENCODING files that are much smaller than the actual file itself.

90.

Hash tree is generalization of ______(a) Heap(b) Hash list(c) BST(d) B – treeThis intriguing question originated from Hash Tables topic in division Hash Tables of Data Structures & Algorithms IThe question was posed to me in homework.

Answer»

Correct choice is (b) Hash list

Best EXPLANATION: Hash list is the list of HASHES of the BLOCKS in a set file. Hash tree is a GENERALIZATION of the hash list in which leaves are labeled with the hash of a data block and every non-leaf node is hash of the labels of its children.

91.

What is the value of m’ if the value of m is 19?(a) 11(b) 18(c) 17(d) 15I'm obligated to ask this question of Hash Tables topic in portion Hash Tables of Data Structures & Algorithms II had been asked this question in homework.

Answer»

Right CHOICE is (C) 17

Best explanation: The value of m’ is chosen as a PRIME number SLIGHTLY less than the value of m. Here the value of m is 19, hence the value of m’ can be chosen as 17.

92.

Double hashing is one of the best methods available for open addressing.(a) True(b) FalseThe query is from Hash Tables topic in division Hash Tables of Data Structures & Algorithms II have been asked this question in an international level competition.

Answer»

Right option is (a) True

To EXPLAIN: Double hashing is ONE of the best methods for open addressing because the permutations produced have MANY CHARACTERISTICS of RANDOMLY chosen permutations.

93.

Collisions can be reduced by choosing a hash function randomly in a way that is independent of the keys that are actually to be stored.(a) True(b) FalseI would like to ask this question from Hash Tables topic in section Hash Tables of Data Structures & Algorithms IThe question was posed to me during an internship interview.

Answer» CORRECT ANSWER is (a) True

Explanation: Because of randomization, the algorithm can BEHAVE differently on each execution, providing GOOD average case PERFORMANCE for any input.
94.

What is the average retrieval time when n keys hash to the same slot?(a) Theta(n)(b) Theta(n^2)(c) Theta(nlog n)(d) Big-Oh(n^2)My doubt is from Hash Tables in portion Hash Tables of Data Structures & Algorithms IThe question was posed to me in unit test.

Answer»

The correct option is (a) Theta(n)

Easy explanation - The AVERAGE RETRIEVAL TIME when n keys HASH to the same slot is given by Theta(n) as the COLLISION occurs in the hash table.

95.

What is the table size when the value of p is 7 in multiplication method of creating hash functions?(a) 14(b) 128(c) 49(d) 127This intriguing question comes from Hash Tables in division Hash Tables of Data Structures & Algorithms IThe question was posed to me in unit test.

Answer»

Correct CHOICE is (b) 128

To explain: In MULTIPLICATION method of CREATING hash functions the table SIZE can be taken in integral POWERS of 2.

m = 2^p

m= 2^7

m = 128.

96.

What is the advantage of the multiplication method?(a) only 2 steps are involved(b) using constant(c) value of m not critical(d) simple multiplicationThis key question is from Hash Tables topic in chapter Hash Tables of Data Structures & Algorithms IThis question was addressed to me in an online quiz.

Answer»

Right answer is (C) VALUE of m not critical

For explanation: The value of m can be simply in POWERS of 2 since we can easily implement the FUNCTION in most computers. m=2^p where p is an integer.

97.

What is the hash function used in multiplication method?(a) h(k) = floor( m(kA mod 1))(b) h(k) = ceil( m(kA mod 1))(c) h(k) = floor(kA mod m)(d) h(k) = ceil( kA mod m)Origin of the question is Hash Tables topic in portion Hash Tables of Data Structures & Algorithms II got this question in an internship interview.

Answer» RIGHT choice is (a) h(k) = floor( m(kA MOD 1))

Explanation: The HASH function can be COMPUTED by multiplying m with the fractional part of kA (kA mod 1) and then computing the floor value of the result.
98.

How many steps are involved in creating a hash function using a multiplication method?(a) 1(b) 4(c) 3(d) 2My doubt is from Hash Tables in chapter Hash Tables of Data Structures & Algorithms IThe question was asked in quiz.

Answer»

The correct CHOICE is (d) 2

Easy explanation - In multiplication method 2 steps are INVOLVED. FIRST multiplying the key value by a CONSTANT. Then multiplying this value by m.

99.

Using division method, in a given hash table of size 157, the key of value 172 be placed at position ____(a) 19(b) 72(c) 15(d) 17I would like to ask this question from Hash Tables topic in section Hash Tables of Data Structures & Algorithms IThis question was addressed to me during an interview for a job.

Answer»

The correct option is (c) 15

Easy explanation - The KEY 172 can be placed at POSITION 15 by using the formula

H(k) = k MOD m

H(k) = 172 mod 157

H(k) = 15.

100.

Which scheme provides good performance?(a) open addressing(b) universal hashing(c) hashing by division(d) hashing by multiplicationQuestion is from Hash Tables in chapter Hash Tables of Data Structures & Algorithms IThis question was posed to me in an international level competition.

Answer»

Correct choice is (b) universal HASHING

Easiest explanation - Universal hashing scheme provides better PERFORMANCE than other schemes because it USES a UNIQUE randomisation approach.