What does the following property define in C#? [code] public static int BinarySearch<T>(T[] array, int index, int length, T value) [/code]

What does the following property define in C#?
Code:
public static int BinarySearch<T>(T[] array, int index, int length, T value)
A. Searches a portion of the array specified by array for the value specified by value
B. The search begins at the index specified by index and is restricted to length elements. Returns the index of the first match
C. If value is not found, returns a zero value
D. All of the mentioned
 
Answer: b
Explanation: Searches a portion of the array specified by array for the value specified by value. The search begins at the index specified by index and is restricted to length elements. Returns the index of the first match. If the value is not found, returns a negative value. The array should be sorted and one-dimensional.
 

Tìm kiếm

Back
Top