Chapter 9

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Which sorting algorithm sorts the first two elements of an array before inserting the remaining elements into that sorted part of the array?

Insertion

In the swap module, the third variable is declared as a ________ variable.

Local

In a binary search, what is the maximum number of comparisons that need to be performed if the array contains 1000 elements?

None of the above

In the bubble sort algorithm, the two arguments sent into the swap module are ________.

None of the above

Which sorting algorithm moves elements to their final sorted position in the array?

Selection

What does the variable middle represent in a binary search algorithm?

Subscript of the midpoint

To order an array of strings in alphabetic order, the sorting algorithm should be structured for ________ order.

ascending

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

The sequential search algorithm is simple and most efficient to use with a large data array.

False

The swap module is executed with three arguments to correctly swap the elements in an array.

False

True/False: Computer programming languages are only able to perform sort algorithms on numeric arrays.

False

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.

False

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.

False

True/False: The bubble sort is limited to arranging data only in acceding order.

False

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.

False

Which statement is true after the execution of the following statements? Set t = x Set x = y Set y = t

x and y swapped their values

Which statement is true after the execution of the following statements? Set x = y Set y = x

x contains the value in y and y stayed the same

Which of the following is a sorting algorithm?

All of the above

When the elements in an array are stored from lowest to highest, the array is sorted in ________ order.

Ascending

Which of the following search algorithms should be used on large arrays if speed is important?

Binary

Which search algorithm uses three variables to mark positions within the array as it searches for the searchValue?

Binary

Which searching algorithm requires the array to be ordered?

Binary

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

Which of the following sorting algorithms is the least efficient?

Bubble sort

True/False: All sorting algorithms contain a group of statements that swap values in array elements.

True

True/False: In a selection sort algorithm, the variable minValue holds the smallest value found in the scanned area of the array.

True

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.

True

True/False: Swapping the contents of two variables requires a third variable that can serve as a temporary storage location.

True

True/False: The data in an array can be sorted in either ascending or descending order.

True

In a selection sort, which variable holds the subscript of the element with the smallest value found in the scanned area of the array?

minIndex


Set pelajaran terkait

2. The Strange Situation Test: Ainsworth's Attachment Theory for Infants

View Set

Ch. 9 The Central Nervous System

View Set

Bacterial Skin Infections: Impetigo, Furuncles and Carbuncles

View Set

فيزياء-الفصل ثاني + ثالث

View Set

Module 2 - OOP Core Concepts and Recursion

View Set

Understanding Animal Biology: Unit 9

View Set