# CIS103 Chapter 9

## Unlock all answers in this set

question
In a binary search, if the search fails to find the item on the first attempt, then there are 999 elements left to search in an array of 1000 elements. t or f
f
question
Which statement is true after the execution of the following statements? Set t = x Set x = y Set y = t x and y contain their original values y contains the value in x and x stayed the same x and y swapped their values x contains the value in y and y stayed the same None of the above
x and y swapped their values
question
Swapping the contents of two variables requires a third variable that can serve as a temporary storage location. t or f
t
question
t or f n a sequential search, each element is compared to the searchValue and the search stops when the value is found or the end of the array is encountered.
t
question
In the bubble sort algorithm, the two arguments sent into the swap module are ________. array[index+1] and array[index-1] array[index] and array[index-1] array[index-1] and array[index+1] array[index-1] and array[index] None of the above
none of the above
question
Which of the following sorting algorithms is the least efficient?
bubble sort
question
In an insertion sort, what order are the elements in an array placed using the following Boolean expression? // variable p is used to scan the array While p > 0 AND array[p-1] > array[p]
descending
question
in a binary search, what is the maximum number of comparisons that need to be performed if the array contains 1000 elements? 500 100 250 1000 None of the above
none of the above
question
The swap module is executed with three arguments to correctly swap the elements in an array. true or false
false
question
t or f The biggest advantage of the bubble sort algorithm is that values move only by one element at a time toward their final destination in the array.
f
question
insertion sort Selection sort Bubble sort are all what type of algorithm?
sorting algorithm
question
t or f All sorting algorithms contain a group of statements that swap values in array elements.
t
question
Which of the search algorithms should be used on large arrays if speed is important?
binary
question
t of f When values in an array need to be swapped, the array and the size of the array have to be sent to the swap module.
f
question
Which search algorithm uses three variables to mark positions within the array as it searches for the searchValue?
binary
question
The data in an array can be sorted in either ascending or descending order. t or f
t
question
When the elements in an array are stored from lowest to highest, the array is sorted in ________ order.
ascending
question
To order an array of strings in alphabetic order, the sorting algorithm should be structured for ________ order.
ascending
question
Which searching algorithm requires the array to be ordered?
binary
question
In a selection sort algorithm, the variable minValue holds the smallest value found in the scanned area of the array. t or f
t
question
The sequential search algorithm is simple and most efficient to use with a large data array t or f
f
question
t or f The data in an array can be sorted in either ascending or descending order.
t
question
Which sorting algorithm moves elements to their final sorted position in the array?
selection
question
In the swap module, the third variable is declared as a ________ variable.
local
question
Computer programming languages are only able to perform sort algorithms on numeric arrays. true or false
false
question
In a sequential search, each element is compared to the searchValue and the search stops when the value is found or the end of the array is encountered. t or f
t
question
When values in an array need to be swapped, the array and the size of the array have to be sent to the swap module. t or f
false
question
What does the variable middle represent in a binary search algorithm?
subscript and midpoint
question
Which statement is true after the execution of the following statements? Set x = y Set y = x x and y contain their original values y contains the value in x and x stayed the same x contains the value in y and y stayed the same x and y swapped their values None of the above
x contains the value in y and y stayed the same
question
To order an array of strings in alphabetic order, the sorting algorithm should be structured for ________ order.
ascending
question
All sorting algorithms contain a group of statements that swap values in array elements. t or f
true
question
As the ________ sorting algorithm makes passes through and compares the elements of the array, certain values move toward the end of the array with each pass.
bubble
question
t or f Computer programming languages are only able to perform sort algorithms on numeric arrays.