Home / MCQ Bank / Computer
Computer Miscellaneous On Data Structures

What is the output of the following code? #include<stdio.h> int max_of_two(int a, int b) { if(a > b) return a; return b; } int min_of_two(int a, int b) { if(a < b) return a; return b; } int recursive_max_element(int *arr, int len, int idx) { if(idx == len - 1) return arr[idx]; return max_of_two(arr[idx], recursive_max_element(arr, len, idx + 1)); } int recursive_min_element(int *arr, int len, int idx) { if(idx == len - 1) return arr[idx]; return min_of_two(arr[idx], recursive_min_element(arr, len, idx + 1)); } int main() { int n = 10, idx = 0, arr[] = {5,2,6,7,8,9,3,-1,1,10}; int max_element = recursive_max_element(arr,n,idx); int min_element = recursive_min_element(arr,n,idx); printf("%d %d",max_element,min_element); return 0; }

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option B • 10 -1

Related Computer Questions

Which of the following network transports doesn't PHP support? What are the parameters of the method JSON.parse()? Arrangement of keys on keyboard is called__________? The most basic element of any HTML page is In Java, what access modifier is used to specify that a class member can be accessed only within its class?