# Java Programming

Computing

## Quiz 14 :Searching and Sorting

Question Type
In a selection sort, a list is sorted by selecting elements in the list, one at a time, and moving them to their proper positions.
Free
True False

True

Tags
Choose question tag
In a sequential search, you search an array starting from the middle component.
Free
True False

False

Tags
Choose question tag
A list is a set of related values that do not necessarily have the same type.
Free
True False

False

Tags
Choose question tag
To sort a list of 1000, selection sort makes about 5,000 key comparisons.
True False
Tags
Choose question tag
In the binary search algorithm, two key comparisons are made through every iteration of the loop.
True False
Tags
Choose question tag
In insertion sort, during the sorting phase the array containing the list is divided into three sublists.
True False
Tags
Choose question tag
Selection sort swaps the smallest element in the unsorted portion of the list to a new position.
True False
Tags
Choose question tag
Key comparisons are also called item comparisons.
True False
Tags
Choose question tag
Suppose that you have the following list. int[] list = {2, 4, 6, 8, 10, 12, 14, 16}; Further assume that binary search is used to determine whether 15 is in list. When the loop terminates, the value of the index variable last is 6.
True False
Tags
Choose question tag
In a sequential search, the array must be sorted.
True False
Tags
Choose question tag
Selection sort uses nested for loops.
True False
Tags
Choose question tag
A selection sort always starts with the middle element of the list.
True False
Tags
Choose question tag
A sequential search is most efficient for large lists.
True False
Tags
Choose question tag
The selection sort algorithm repeatedly moves the smallest element from the unsorted list to the top of the unsorted list.
True False
Tags
Choose question tag
In selection sort, initially, the entire list, that is, list[0]...list[listLength], is the unsorted list.
True False
Tags
Choose question tag
The insertion sort algorithm sorts a list by repeatedly inserting an element in its proper place into a sorted sublist.
True False
Tags
Choose question tag
A binary search can be performed on both sorted and unsorted lists.
True False
Tags
Choose question tag
On average, the number of comparisons made by a sequential search is equal to one-third the size of the list.
True False