## Click on any option to know the CORRECT ANSWERS

 Question 1
Kadane's algorithm is used to find .....
 A Longest increasing subsequence B Longest palindrome subsequence C Maximum sub-array sum D All of the mentioned

Question 1 Explanation:
Kadane's algorithm is used to find the maximum sub-array sum for a given array.

 Question 2
Kadane's algorithm uses which of the following techniques?
 A Divide and conquer B Dynamic programming C Recursion D All of the mentioned

Question 2 Explanation:

 Question 3
For which of the following inputs would Kadane's algorithm produce the CORRECT output?
 A {0, 1, 2, 3} B {-1, 0, 1} C {-1, -2, -3, 0} D All of the mentioned

Question 3 Explanation:
Kadane's algorithm works if the input array contains at least one non-negative element. All the array inputs have at least one non-negative element. So, Kadane's algorithm will produce the right output for all of the mentioned inputs.

 Question 4
For which of the following inputs would Kadane's algorithm produce a WRONG output?
 A {1, 0, -1} B {-1, -2, -3} C {1, 2, 3} D {0, 0, 0}

Question 4 Explanation:
Kadane's algorithm doesn't work for all negative numbers. So, the answer is {-1, -2, -3}.

 Question 5
Complete the following code for Kadane's algorithm:

#include<stdio.h> int max....num(int a, int b) { if(a > b) return a; return b; } int kadane....algo(int *arr, int len) {	 int ans, sum, idx; ans =0; sum =0; for(idx =0; idx < len; idx++) { sum = max....num(0, sum + arr[idx]); ans = .....; } return ans; } int main() { int arr[] = {-2, -3, 4, -1, -2, 1, 5, -3}, len=7; int ans = kadane....algo(arr, len); printf("%d", ans); return 0; }
 A max....num(sum, sum + arr[idx]) B sum C sum + arr[idx]. D max....num(sum, ans)