Chapter 9

25 July 2022
4.7 (114 reviews)
30 test answers

Unlock all answers in this set

Unlock answers (26)
question
When the elements in an array are stored from lowest to highest, the array is sorted in ________ order.
answer
Ascending
question
In the swap module, the third variable is declared as a ________ variable.
answer
Local
question
True/False: In a selection sort algorithm, the variable minValue holds the smallest value found in the scanned area of the array.
answer
True
question
What does the variable middle represent in a binary search algorithm?
answer
Subscript of the midpoint
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
Which of the following search algorithms should be used on large arrays if speed is important?
answer
Binary
question
Which sorting algorithm sorts the first two elements of an array before inserting the remaining elements into that sorted part of the array?
answer
Insertion
question
In a binary search, what is the maximum number of comparisons that need to be performed if the array contains 1000 elements?
answer
None of the above
question
Which sorting algorithm moves elements to their final sorted position in the array?
answer
Selection
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
True/False: Swapping the contents of two variables requires a third variable that can serve as a temporary storage location.
answer
True
question
True/False: 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
False
question
True/False: Computer programming languages are only able to perform sort algorithms on numeric arrays.
answer
False
question
The sequential search algorithm is simple and most efficient to use with a large data array.
answer
False
question
The swap module is executed with three arguments to correctly swap the elements in an array.
answer
False
question
True/False: 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.
answer
True
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
True/False: All sorting algorithms contain a group of statements that swap values in array elements.
answer
True
question
True/False: The data in an array can be sorted in either ascending or descending order.
answer
True
question
In the bubble sort algorithm, the two arguments sent into the swap module are ________.
answer
None of the above
question
Which of the following sorting algorithms is the least efficient?
answer
Bubble sort
question
Which searching algorithm requires the array to be ordered?
answer
Binary
question
True/False: The bubble sort is limited to arranging data only in acceding order.
answer
False
question
To order an array of strings in alphabetic order, the sorting algorithm should be structured for ________ order.
answer
ascending
question
True/False: 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
False
question
Which search algorithm uses three variables to mark positions within the array as it searches for the searchValue?
answer
Binary
question
Which statement is true after the execution of the following statements? Set t = x Set x = y Set y = t
answer
x and y swapped their values
question
Which of the following is a sorting algorithm?
answer
All of the above
question
Which statement is true after the execution of the following statements? Set x = y Set y = x
answer
x contains the value in y and y stayed the same
question
True/False: 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.
answer
False