MCQs
#includeint arr[31], len = 0;void recursive_dec_to_bin(int n){ if(n == 0 && len == 0) { arr[len++] = 0; return; } if(n == 0) return; __________; recursive_dec_to_bin(n/2);}int main(){ int n = 100,i; recursive_dec_to_bin(n); for(i=len-1; i>=0; i--) printf("%d",arr[i]); return 0;}Which of the following lines should be inserted to complete the above code?
The line "arr[len++] = n % 2 should be inserted to complete the above code.
The time complexity of the above iterative code used to find the largest and smallest element in a linked list is O(n).
The line fibo(n “ 1) + fibo(n “ 2) should be inserted to complete the above code.
The time complexity of the above iterative implementation used to find the largest and the smallest element in an array is O(n).
The space complexity of the above recursive implementation to find the factorial of a number is O(1).
The line "1 + recursive_get_len(current_node->next) should be inserted to complete the above code.
The program prints the numbers from 10 to 1.
The line "1 + recursive_get_len(s, len+1) should be inserted to complete the code.
The condition in the while loop "temp->next == 0, checks if the current element is the last element. If the current element is the last element,the value of the current element is not compared with the value to be searched. So, even though the number 6 is present in the linked list, it will print not found.
The recursive call "recursive_search_num(arr, num, idx+1, len) should be added to complete the above code.