Programming Logic and Design, 8e
Solutions 8-
Programming Logic and Design, 8th Edition
Chapter 8
Review Questions
REVIEW QUESTIONS
1.Employee records stored in order from highest-paid to lowest-paid have been sorted in _____ order.
a.recursiveb.ascendingc.staggeredd.descending
2.Student records stored in alphabetical order by last name have been sorted in _____ order.
3.When computers sort data, they always _____.
4.Which of the following code segments correctly swaps the values of variables named xand y
?
1

Programming Logic and Design, 8e
5.Which type of sort compares list items in pairs, swapping any two adjacent valuesthat are out of order?
a.insertion sortb.indexed sortc.bubble sortd.selection sort
6.To sort a list of 15 values using a bubble sort, the greatest number of times you would have to pass through the list making comparisons is _____.
7.To completely sort a list of eight values using a bubble sort, the greatest possible number of required pair comparisons is _____.

Programming Logic and Design, 8e
8.When you do not know how many items need to be sorted in a program, you can create an array that has _____.
9.In a bubble sort, on each pass through the list that must be sorted, you can stop making pair comparisons _____.
a.one comparison soonerb.two comparisons soonerc.one comparison laterd.two comparisons later
10.When performing a bubble sort on a list of 10 values, you can stop making passesthrough the list of values as soon as _____ on a single pass through the list.
11.The bubble sort is _____.