MCQOPTIONS
Saved Bookmarks
| 1. |
Consider the C function given below. Assume that the array listA contains n (> 0) elements, sorted in ascending order. int ProcessArray(int *listA, int x, int n) { int i, j, k; i = 0; j = n-1; do { k = (i+j)/2; if (x |
| A. | It will run into an infinite loop when x is not in listA |
| B. | It is an implementation of binary search |
| C. | It will always find the maximum element in listA |
| D. | It will return −1 even when x is present in listA. |
| Answer» C. It will always find the maximum element in listA | |