Assume int[] scores = {1, 20, 30, 40, 50}, what value does java.util.Arrays.binarySearch(scores, 3) return?
a. 0
b. -1
c. 1
d. 2
e. -2
e The binarySearch method returns the index of the search key if it is contained in the list. Otherwise, it returns –insertion point - 1 . The insertion point is the point at which the key would be inserted into the list. In this case the insertion point is 1 . Note that the array index starts from 0.
You might also like to view...
How many subnets do you get with a subnet of 192.168.1.0/28?
A) 12 B) 13 C) 16 D) 20
Identify a factor that determines the level of competition and long-term profitability of an industry.
a. The degree of rivalry between competitors is low in industries with many equally sized competitors. b. The threat of substitute products can increase the profitability of industry competitors. c. The bargaining power of suppliers doesn’taffect the industry’s profitability. d. The threat of new competitors raises the level of competition.