A: Linear search does not require the array to be sorted, whereas, binary search requires that the array be sorted.
Linear search checks for the search item in a linear fashion from the beginning cell till the end, whereas, Binary search repeatedly dividing the array into halves and the search takes place in one of the halves. The element is searched in the middle cell of every half.
The Examiner may ask you to explain in brief the logic used you to solve the program.
You know what you have written so just give a brief summary of the logic used by
you.
The Examiner may ask you to tell what is control variable in your loop.
So if your loop is for(int i = 1; i <= 5; i++) then the control variable is ‘i’.
The Examiner may ask you to tell what is the return type of a function you used.
So if your function is boolean isPrime(int n) then the return type is ‘boolean’.