CIS103 Chapter 9

25 July 2022
4.7 (114 reviews)
36 test answers

Unlock all answers in this set

Unlock answers (32)
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
answer
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
answer
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
answer
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.
answer
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
answer
none of the above
question
Which of the following sorting algorithms is the least efficient?
answer
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]
answer
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
answer
none of the above
question
The swap module is executed with three arguments to correctly swap the elements in an array. true or false
answer
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.
answer
f
question
insertion sort Selection sort Bubble sort are all what type of algorithm?
answer
sorting algorithm
question
t or f All sorting algorithms contain a group of statements that swap values in array elements.
answer
t
question
Which of the search algorithms should be used on large arrays if speed is important?
answer
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.
answer
f
question
Which search algorithm uses three variables to mark positions within the array as it searches for the searchValue?
answer
binary
question
The data in an array can be sorted in either ascending or descending order. t or f
answer
t
question
When the elements in an array are stored from lowest to highest, the array is sorted in ________ order.
answer
ascending
question
To order an array of strings in alphabetic order, the sorting algorithm should be structured for ________ order.
answer
ascending
question
Which searching algorithm requires the array to be ordered?
answer
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
answer
t
question
The sequential search algorithm is simple and most efficient to use with a large data array t or f
answer
f
question
t or f The data in an array can be sorted in either ascending or descending order.
answer
t
question
Which sorting algorithm moves elements to their final sorted position in the array?
answer
selection
question
In the swap module, the third variable is declared as a ________ variable.
answer
local
question
Computer programming languages are only able to perform sort algorithms on numeric arrays. true or false
answer
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
answer
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
answer
false
question
What does the variable middle represent in a binary search algorithm?
answer
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
answer
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.
answer
ascending
question
All sorting algorithms contain a group of statements that swap values in array elements. t or f
answer
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.
answer
bubble
question
t or f Computer programming languages are only able to perform sort algorithms on numeric arrays.
answer
f
question
In a selection sort, which variable holds the subscript of the element with the smallest value found in the scanned area of the array?
answer
minIndex
question
Which sorting algorithm moves elements to their final sorted position in the array?
answer
selection
question
The sequential search algorithm is simple and most efficient to use with a large data array. t or f
answer
f