Engineering Questions with Answers - Multiple Choice Questions

Home » MCQs » Aeronautical Engineering » Interpolation Searching Algorithm Multiple Choice MCQ

# Interpolation Searching Algorithm Multiple Choice MCQ

Which of the following is the most desirable condition for interpolation search?

a) array should be sorted

b) array should not be sorted but the values should be uniformly distributed

c) array should have a less than 64 elements

d) array should be sorted and the values should be uniformly distributed

**
View Answer**

Answer: d

Explanation: Desirable condition for interpolation search is that the array should be sorted and the values should be uniformly distributed. The algorithm would fail to give the correct result if array is not sorted.

Interpolation search is a variation of?

a) Linear search

b) Binary search

c) Jump search

d) Exponential search

**
View Answer**

Answer: b

Explanation: Interpolation search is a variation of binary search which gives the best result when the array has uniformly distributed values. Interpolation search goes to different positions depending on the value being searched whereas binary search always goes to the middle element.

Interpolation search performs better than binary search when?

a) array has uniformly distributed values but is not sorted

b) array is sorted and has uniform distribution of values

c) array is sorted but the values are not uniformly distributed

d) array is not sorted

**
View Answer**

Answer: b

Explanation: Interpolation search is an improvement over a binary search for the case when array is sorted and has uniformly distributed values. Binary search performs better when the values are not distributed uniformly.

In which of the following case jump search performs better than interpolation search?

a) When array has uniformly distributed values but is not sorted

b) when array is sorted and has uniform distribution of values

c) when array is sorted but the values increases exponentially

d) when array is not sorted

**
View Answer**

Answer: c

Explanation: In case of non uniform distribution of values the time complexity of interpolation search is O(n) whereas the average time complexity of jump search is O(n1/2). So in such a case jump search has a better performance.

What is the time complexity of interpolation search when the input array has uniformly distributed values and is sorted?

a) O(n)

b) O(log log n)

c) O(n log n)

d) O(log n)

**
View Answer**

Answer: b

Explanation: Interpolation search goes to different positions in the array depending on the value being searched. It is an improvement over binary search and has a time complexity of O(log log n).

What is the auxiliary space requirement of interpolation search?

a) O(n)

b) O(2^{n})

c) O(1)

d) O(log n)

**
View Answer**

Answer: c

Explanation: Interpolation search does not require any auxiliary space for finding the element being searched. So it has a constant auxiliary space O(1).

What is the time complexity of exponential search when the input array is sorted but the values are not uniformly distributed?

a) O(n^{1/2})

b) O(log log n)

c) O(n)

d) O(log n)

**
View Answer**

Answer: c

Explanation: When an array has non uniformly distributed values then in that case the algorithm of interpolation search fails to work efficiently. As a result, it has a time complexity of O(n) in such a case.

Which of the following searching algorithm is fastest when the input array is sorted and has uniformly distributed values?

a) jump search

b) exponential search

c) binary search

d) interpolation search

**
View Answer**

Answer: d

Explanation: Interpolation search has a time complexity of O( log log n) when the array is sorted and has uniformly distributed values. It has the least time complexity out of the given options for such a case.

Which of the following searching algorithm is fastest when the input array is sorted but has non uniformly distributed values?

a) jump search

b) linear search

c) binary search

d) interpolation search

**
View Answer**

Answer: c

Explanation: Interpolation search has a time complexity of O(n) when the array does not have uniformly distributed values. So in such a case binary search has the least time complexity out of the given options.

Which of the following searching algorithm is fastest when the input array is not sorted but has uniformly distributed values?

a) jump search

b) linear search

c) binary search

d) interpolation search

**
View Answer**

Answer: b

Explanation: Out of the given options linear search is the only searching algorithm which can be applied to arrays which are not sorted. It has a time complexity of O(n) in the worst case.

Interpolation search is an in place algorithm.

a) true

b) false

**
View Answer**

Answer: a

Explanation: Interpolation search has an auxiliary space complexity of O(1). So it qualifies as an in place algorithm.

Interpolation search has a better time complexity than exponential search for any given array.

a) True

b) False

**
View Answer**

Answer: b

Explanation: The worst case time complexity of interpolation search and exponential search are O(n) and O(log n) respectively. So exponential search is better when the worst case scenario is considered.

What is the formula used for calculating the position in interpolation search?

(x = element being searched, A[] = input array, low and high are the leftmost and rightmost index of A[] respectively)

a) ((x – A[low]) * (high – low)) / (A[high] – A[low])

b) high + ((x – A[low]) * (high – low)) / (A[high] – A[low])

c) low + ((x – A[low]) * (high – low)) / (A[high] – A[low])

d) x + ((x – A[low]) * (high – low)) / (A[high] – A[low])

**
View Answer**

Answer: c

Explanation: For calculating the position after each iteration in interpolation search we use the formula low + ((x – A[low]) * (high – low)) / (A[high] – A[low]). Then the value at the calculated position is compared with the element being searched.

What are the updated values of high and low in the array if the element being searched is greater than the value at calculated index in interpolation search? (pos = current position)

a) low = pos + 1, high remains unchanged

b) high = pos – 1, low remains unchanged

c) low = low +1, high = high – 1

d) low = pos +1, high = pos – 1

**
View Answer**

Answer: a

Explanation: When the element being searched is greater than the value at the calculated position then in that case we update low and high remains unaltered. Updated value of low is low = pos + 1.

What are the updated values of high and low in the array if the element being searched is lower than the value at calculated index in interpolation search? (pos = current position)

a) low = pos + 1, high remains unchanged

b) high = pos – 1, low remains unchanged

c) low = low +1, high = high – 1

d) low = pos +1, high = pos – 1

**
View Answer**

Answer: b

Explanation: When the element being searched is lower than the value at the calculated position then in that case we update high and low remains unaltered. Updated value of high is high = pos – 1.