Kindergarten
1st
2nd
3rd
4th
5th
6th
7th
8th
9th
10th
11th
12th
Higher Ed
Other
Subjects
ELA
Math
Science
Social Studies
Art
Computer Science
French
German
Music
Physical Education
Spanish
Other
Private Library
BR 1 Arrays
starstarstarstarstarstarstarstarstarstar
by John Chapin
| 3 Questions
Note from the author:
AP CS Bell Ringer
1
1 pt
Consider searching for a given value in an array. Which of the following must be true in order to successfully use the binary search?

I. The values in the array must be numbers.
II. The values in the array must be in sorted order.
III. The array must not contain any duplicate values.
I Only
II Only
I and II ONly
II and III only
I, II, and II
2
1 pt
Consider searching for a given value in a sorted array. Under which of the following circumstances will the sequential search be faster than the binary search?
The given value is the first element of the array.
The given value is the last element of the array
The given value is the middle element of the array.
The sequential search will never be faster than the binary search
3
1 pt
Assume the following declarations and assignments have been made.
int[] arr1 = {1, 2, 3, 4, 5, 6, 7, 8};
int[] arr2 = {4, 5, 6, 7, 8};
If the following segment of code is executed, what will arr1 and arr2 contain?
arr2 = arr1;
arr2[3] = 0;
arr1: {1, 2, 3, 4, 5, 6, 7, 8}
arr2: {4, 5, 6, 0, 8}
arr1: {1, 2, 3, 0, 5, 6, 7, 8}
arr2: {4, 5, 6, 7, 8}
arr1: {1, 2, 3, 0, 5, 6, 7, 8}
arr2: {1, 2, 3, 0, 5, 6, 7, 8}
arr1: {1, 2, 3, 4, 5, 6, 7, 8}
arr2: {4, 5, 6, 7, 8}