Which element does binary search compare with the target value first?
AThe first element
BThe last element
CA random element
DThe middle element
Answer & Solution
Correct answer: D. The middle element
Binary search begins by comparing the target value to the middle element.
Keep practising Arrays in Java (Single and Double Dimensional)
Browse all Arrays in Java (Single and Double Dimensional) questions for ICSE Class 10, or explore more Computer Applications topics.
Related questions
Match compact math:
1. Tri: p. Half matrix
2. Deg 2: q. Quadratic
3. Form: r. PolynomialMatch multi order:
1. Row: p. Last index
2. Col: q. First index
3. Dims: r. High rankMatch ring algebra:
1. Ring: p. Noncomm
2. Square: q. N by N
3. Order: r. DimensionMatch zero offset:
1. Base: p. Origin
2. Min: q. Zero based
3. Tuple: r. Multi dimMatch Iliffe costs:
1. Dual: p. 2 indices
2. Fetch: q. Row fetch
3. Jagged: r. VaryingMatch pure diag:
1. Diag: p. Off-diag 0
2. Unit: q. Diag 1s
3. Main: r. i equals jMatch mult cache:
1. Mat A: p. Row major
2. Mat B: q. Col major
3. Prod: r. Optimal GCMatch bit strides:
1. Power 2: p. Fast
2. Coeff: q. Stride c
3. Shift: r. Bit step