Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) If a binary search is used to search for the number 4 in the 11-element array

ID: 655442 • Letter: 1

Question

1) If a binary search is used to search for the number 4 in the 11-element array shown below, which value will the 4 be compared to first?

   1 2 3 4 5 6 7 8 9 10 11 12 17

1

7

8

9

17

2) True/false: Memory cannot be allocated after a program is already running

3) To find a value that is in an unordered array of 100 items, linear search must examine an average of ______

7

10

50

100

101

4) To locate a value that is in an ordered array of 50 items, linear search must examine at most____ values.

1

6

25

50

51

5) If a selection sort is used to arrange the number 7 5 3 9 2 6 in ascending order, what order will that data be in after the first pass?

2 5 3 9 7 6

5 7 3 9 2 6

5 3 7 2 6 9

2 3 5 6 7 9

None of these

6) The statement

typedef int oneDArray[20];

     does which of the following?

Creates an array of 20 integers

Makes oneDArray a copy of another 20-integer array

Makes oneDarray an alias for a data type that holds 20 integers

Creates a one-dimensional integer array with all elements initialized to 20

None of these

Explanation / Answer

1) If a binary search is used to search for the number 4 in the 11-element array shown below, which value will the 4 be compared to first?
   1 2 3 4 5 6 7 8 9 10 11 12 17
7 // first it will be compared with mid value i.e 7.
2) True/false: Memory cannot be allocated after a program is already running false
3) To find a value that is in an unordered array of 100 items, linear search must examine an average of 100
4) To locate a value that is in an ordered array of 50 items, linear search must examine at most 50 values.
5) If a selection sort is used to arrange the number 7 5 3 9 2 6 in ascending order, what order will that data be in after the first pass?
2 5 3 9 7 6
6) The statement
typedef int oneDArray[20];     does which of the following?
Makes oneDarray an alias for a data type that holds 20 integers