Q383
What is the output of the following code? #include int recursive_binary_search(int *arr, int num, int lo, int hi) if(lo > hi) return -1; int mid = (lo + hi)/2; if(arr[mid] == num) return mid; else if(arr[mid] < num) lo = mid + 1; else hi = mid - 1; return recursive_binary_search(arr, num, lo, hi); int main() int arr[8] = 1,2,3,4,5,6,7,8,num = 7,len = 8; int indx = recursive_binary_search(arr,num,0,len-1); printf("Index of %d is %d",num,indx); return 0;
A.
Index of 7 is 4
B.
Index of 7 is 5
C.
Index of 7 is 6
AnswerD.
Index of 7 is 7
Answer: Option C
Solution
Answer: Option C
No explanation is given for this question Let's Discuss on Board